Spurious NPE in guardWithTest

Christian Thalinger christian.thalinger at oracle.com
Mon Dec 20 02:58:03 PST 2010


On Dec 14, 2010, at 8:12 PM, Rémi Forax wrote:
> On 12/14/2010 06:10 PM, Christian Thalinger wrote:
>> On Dec 14, 2010, at 6:02 PM, Rémi Forax wrote:
>>> With the jdk7b121, sometimes when I call a MH created with guardWith, it
>>> get a NPE because the target is NULL :(
>>> 
>>> groovy examples/mixin.groovy
>>> 
>>> java.lang.NullPointerException
>>>     at
>>> sun.dyn.MethodHandleImpl$GuardWithTest.invoke_L1(MethodHandleImpl.java:963)
>>>     at java.dyn.MethodHandle.invokeVarargs(MethodHandle.java:336)
>>>     at org.codehaus.groovy2.lang.MOPLinker.fallback(MOPLinker.java:145)
>>>     at sun.dyn.FilterGeneric$F1.invoke_C0(FilterGeneric.java:516)
>>>     at mixin.run(Unknown Source)
>>>     at
>>> groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:264)
>>>     at groovy.lang.GroovyShell.run(GroovyShell.java:227)
>>>     at groovy.lang.GroovyShell.run(GroovyShell.java:157)
>>>     at groovy.ui.GroovyMain.processOnce(GroovyMain.java:496)
>>>     at groovy.ui.GroovyMain.run(GroovyMain.java:311)
>>>     at groovy.ui.GroovyMain.process(GroovyMain.java:297)
>>>     at groovy.ui.GroovyMain.processArgs(GroovyMain.java:112)
>>>     at groovy.ui.GroovyMain.main(GroovyMain.java:93)
>>> Caught: java.lang.NullPointerException
>>> 
>>> Because MHs.guardWithTest() explicitly test that the target is not null,
>>> I think there is a bug somewhere in the VM.
>> Does it also happen with -Xint?  Or C1?  I guess you're using C2.
> 
> Xint => same problem
> I use C2 on a 64bits VM, I could reproduce it with C2 using a 32bits VM
> but not with C1 (32bits VM).

I can reproduce it on x86 and SPARC with -Xint.  I'm not sure yet what causes this but can this be an API problem?

-- Christian


More information about the mlvm-dev mailing list