NullPointerException in HotSpotRuntime:lower when using Snippets
Mick Jordan
mick.jordan at oracle.com
Mon Jul 15 10:08:23 PDT 2013
On 7/14/13 10:13 AM, ATKIN-GRANVILLE Chris wrote:
> On 14 Jul 2013, at 17:10, Doug Simon <doug.simon at oracle.com> wrote:
>
>> How important is it that your instrumentation achieves complete coverage? Do you need to see every single array access in the program? This will not be possible in the current GraalVM because it's hard to guarantee that execution always happens in compiled code. For this, you really need to do bytecode instrumentation.
> We are only interested in array accesses that occur within loops (eventually we'll also extend to field accesses and so on, but for now we're sticking with arrays). Accesses that are not executed are unimportant as they pose no dependence risk.
>
> Perhaps it would be possible use ASM or another bytecode manipulation library to add in transformations from InstalledCode.getCode(). Would it be possible to somehow load modified bytecode into Graal or something like that?
>
>
Given your goals, as I understand them, have you looked at the Maxine VM
<https://wikis.oracle.com/display/MaxineVM/Home> and the VMA
<https://wikis.oracle.com/display/MaxineVM/Virtual+Machine+Level+Analysis>
extension? [I.e., how important is it that you run with Hotspot?]
I ran your example loopDependency example just now (with full bytecode
advising enabled). The output from the tool that analyses the trace
output (you can do the analysis online if you prefer), is attached. In
some sense VMA is equivalent to the bytecode transformation in systems
like Aspect/J but it is much more efficient and does not suffer the
problems of operating strictly "above" the VM. Maxine also implements
the JVMTI instrumentation framework and it is possible to write JVMTI
handlers in Java.
I have a version of VMA for Graal, which is based on inserting
AdviceNodes in the graph and then lowering those nodes via snippets to
hook into the Maxine runtime support for VMA. I'll be shipping all of
this by the end of the month. In principle Graal/VMA would work for
Hotspot but, as Doug notes, there are issues related to the overall
Hotspot environment. Not least is that VMA leverages Maxine's ability to
(safely) change the object layout to add support for efficient object
ids and extra bits for marking (which may not matter for your goals).
Mick
-------------- next part --------------
$ mx vm -cp $vmacp -XX:+VMAXJDK test.Glanville
bash-3.2$ qa
%% e AdviceRecords
39835000 main B ThreadStarting
48203000 main A 0 Unseen (com.sun.max.vm.type.VMClassLoader) -3:0
48216000 main A 0 Unseen (com.sun.max.vm.type.BootClassLoader) -2:0
48217000 main A 0 Unseen (sun.misc.Launcher$AppClassLoader) -1:0
48219000 main A 0 MethodEntry test.Glanville.main
48224000 main B 0 ConstLoadLong 5
48226000 main A 1 NewArray (int[]) 1:05
48229000 main B 3 StackAdjust DUP
48230000 main B 4 ConstLoadLong 1
48231000 main B 5 ConstLoadLong 1
48231000 main B 6 ArrayStoreLong (int[]) 1:0[1] 1
48233000 main B 7 StackAdjust DUP
48233000 main B 8 ConstLoadLong 2
48234000 main B 9 ConstLoadLong 2
48234000 main B 10 ArrayStoreLong (int[]) 1:0[2] 2
48234000 main B 11 StackAdjust DUP
48235000 main B 12 ConstLoadLong 3
48235000 main B 13 ConstLoadLong 3
48235000 main B 14 ArrayStoreLong (int[]) 1:0[3] 3
48236000 main B 15 StackAdjust DUP
48236000 main B 16 ConstLoadLong 4
48236000 main B 17 ConstLoadLong 4
48236000 main B 18 ArrayStoreLong (int[]) 1:0[4] 4
48237000 main B 19 StoreObject 1 (int[]) 1:0
48239000 main B 20 ConstLoadLong 5
48239000 main A 21 NewArray (int[]) 2:05
48240000 main B 23 StackAdjust DUP
48240000 main B 24 ConstLoadLong 0
48240000 main B 25 ConstLoadLong 4
48240000 main B 26 ArrayStoreLong (int[]) 2:0[0] 4
48241000 main B 27 StackAdjust DUP
48241000 main B 28 ConstLoadLong 1
48241000 main B 29 ConstLoadLong 3
48242000 main B 30 ArrayStoreLong (int[]) 2:0[1] 3
48242000 main B 31 StackAdjust DUP
48242000 main B 32 ConstLoadLong 2
48243000 main B 33 ConstLoadLong 2
48243000 main B 34 ArrayStoreLong (int[]) 2:0[2] 2
48243000 main B 35 StackAdjust DUP
48243000 main B 36 ConstLoadLong 3
48244000 main B 37 ConstLoadLong 1
48244000 main B 38 ArrayStoreLong (int[]) 2:0[3] 1
48244000 main B 39 StoreObject 2 (int[]) 2:0
48245000 main B 40 Load 1
48246000 main B 40 LoadObject
48248000 main B 41 Load 2
48248000 main B 41 LoadObject
48249000 main B 42 InvokeStatic test.Glanville.loopDependency
48346000 main A 0 MethodEntry test.Glanville.loopDependency
48349000 main B 0 Load 0
48350000 main B 0 LoadObject
48351000 main B 1 ArrayLength 5
48352000 main A 2 NewArray (int[]) 3:05
48353000 main B 4 StoreObject 2 (int[]) 3:0
48353000 main B 5 ConstLoadLong 0
48354000 main B 6 StoreLong 3 0
48355000 main B 7 Goto -> 21
48357000 main B 21 Load 3
48357000 main B 22 Load 0
48357000 main B 22 LoadObject
48358000 main B 23 ArrayLength 5
48358000 main B 24 IfInt IF_ICMPLT 0 5 -> 10
48359000 main B 10 Load 2
48360000 main B 10 LoadObject
48360000 main B 11 Load 3
48360000 main B 12 Load 0
48360000 main B 12 LoadObject
48361000 main B 13 Load 1
48361000 main B 13 LoadObject
48361000 main B 14 Load 3
48362000 main B 15 ArrayLoad (int[]) 2:0[0]
48363000 main B 16 ArrayLoad (int[]) 1:0[4]
48363000 main B 17 ArrayStoreLong (int[]) 3:0[0] 4
48364000 main B 18 OperationLong 3 IINC 1
48366000 main B 21 Load 3
48366000 main B 22 Load 0
48366000 main B 22 LoadObject
48367000 main B 23 ArrayLength 5
48367000 main B 24 IfInt IF_ICMPLT 1 5 -> 10
48367000 main B 10 Load 2
48368000 main B 10 LoadObject
48368000 main B 11 Load 3
48368000 main B 12 Load 0
48369000 main B 12 LoadObject
48369000 main B 13 Load 1
48369000 main B 13 LoadObject
48369000 main B 14 Load 3
48370000 main B 15 ArrayLoad (int[]) 2:0[1]
48370000 main B 16 ArrayLoad (int[]) 1:0[3]
48370000 main B 17 ArrayStoreLong (int[]) 3:0[1] 3
48371000 main B 18 OperationLong 3 IINC 1
48371000 main B 21 Load 3
48371000 main B 22 Load 0
48372000 main B 22 LoadObject
48372000 main B 23 ArrayLength 5
48372000 main B 24 IfInt IF_ICMPLT 2 5 -> 10
48373000 main B 10 Load 2
48373000 main B 10 LoadObject
48373000 main B 11 Load 3
48374000 main B 12 Load 0
48374000 main B 12 LoadObject
48374000 main B 13 Load 1
48374000 main B 13 LoadObject
48375000 main B 14 Load 3
48375000 main B 15 ArrayLoad (int[]) 2:0[2]
48375000 main B 16 ArrayLoad (int[]) 1:0[2]
48376000 main B 17 ArrayStoreLong (int[]) 3:0[2] 2
48376000 main B 18 OperationLong 3 IINC 1
48376000 main B 21 Load 3
48377000 main B 22 Load 0
48377000 main B 22 LoadObject
48377000 main B 23 ArrayLength 5
48377000 main B 24 IfInt IF_ICMPLT 3 5 -> 10
48378000 main B 10 Load 2
48378000 main B 10 LoadObject
48378000 main B 11 Load 3
48379000 main B 12 Load 0
48379000 main B 12 LoadObject
48379000 main B 13 Load 1
48379000 main B 13 LoadObject
48380000 main B 14 Load 3
48380000 main B 15 ArrayLoad (int[]) 2:0[3]
48380000 main B 16 ArrayLoad (int[]) 1:0[1]
48381000 main B 17 ArrayStoreLong (int[]) 3:0[3] 1
48381000 main B 18 OperationLong 3 IINC 1
48381000 main B 21 Load 3
48382000 main B 22 Load 0
48382000 main B 22 LoadObject
48382000 main B 23 ArrayLength 5
48382000 main B 24 IfInt IF_ICMPLT 4 5 -> 10
48383000 main B 10 Load 2
48383000 main B 10 LoadObject
48383000 main B 11 Load 3
48384000 main B 12 Load 0
48384000 main B 12 LoadObject
48384000 main B 13 Load 1
48384000 main B 13 LoadObject
48385000 main B 14 Load 3
48385000 main B 15 ArrayLoad (int[]) 2:0[4]
48385000 main B 16 ArrayLoad (int[]) 1:0[0]
48386000 main B 17 ArrayStoreLong (int[]) 3:0[4] 0
48386000 main B 18 OperationLong 3 IINC 1
48386000 main B 21 Load 3
48387000 main B 22 Load 0
48387000 main B 22 LoadObject
48387000 main B 23 ArrayLength 5
48388000 main B 24 IfInt IF_ICMPLT 5 5 -> 10
48388000 main B 27 Load 2
48388000 main B 27 LoadObject
48389000 main B 28 ReturnObject (int[]) 3:0
48390000 main B 45 StackAdjust POP
48391000 main B 46 Return
48394000 main B ThreadTerminating
%%
More information about the graal-dev
mailing list