Spurious NPE in guardWithTest

Christian Thalinger christian.thalinger at oracle.com
Tue Dec 14 09:10:33 PST 2010


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.

> 
> Step to reproduce:
> download Gru: http://www-igm.univ-mlv.fr/~forax/tmp/Gru.tgz
> 
> run: groovy examples/mixin.groovy
> 
> It should print some bytecodes and "groovy yai" ...
> if there is no NPE.

I will have a look.

> 
> Rémi
> PS: yes, Gru a prototype of groovy on top of JSR292 :)

Nice!

-- Christian


More information about the mlvm-dev mailing list