First test for Invokedynamic with Backport

6 views
Skip to first unread message

Chanwit Kaewkasi

unread,
Jun 22, 2009, 8:51:01 AM6/22/09
to jvm-la...@googlegroups.com
Hi,

I did test my generated code for Invokedynamic with Remi's backport.
The transformation works fine, but some APIs seem to be different.
I used b61 APIs, which contain
MethodHandles.insertArgument(MethodHandle, int, Object),
while the backport comes with the newer version of APIs.

I ran on Cygwin with the following command:

$ java -javaagent:backport/jsr292-backport.jar -cp
".;./target/classes" g7.tests.classgen.Fib

Here's the stack trace:

Exception in thread "main" java.lang.NoSuchMethodError:
jsr292.java.dyn.MethodHandles.insertArgument(Ljsr292/java/dyn/MethodHandle;ILjava/lang/Object;)Ljsr292/java/dyn/MethodHandle;
at com.chanwit.g7.runtime.G7Bootstrap.bootstrap(G7Bootstrap.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jsr292.java.dyn.MHLookupUnreflectMethod.invoke(MHLookupUnreflectMethod.java:29)
at jsr292.java.dyn.MHLookupUnreflectMethod.$invoke$(MHLookupUnreflectMethod.java:73)
at jsr292.java.dyn.BootstrapCallSite.bootstrapCallSite(BootstrapCallSite.java:30)
at jsr292.java.dyn.BootstrapCallSite$BootstrapInvoker.$invoke$(BootstrapCallSite.java:81)
at g7.tests.classgen.Fib.$indy_stub6$(Fib.groovy)
at g7.tests.classgen.Fib.main(Fib.groovy)

Cheers.

Chanwit

--
Chanwit Kaewkasi
PhD Candidate,
Centre for Novel Computing
School of Computer Science
The University of Manchester
Oxford Road
Manchester
M13 9PL, UK

Rémi Forax

unread,
Jun 22, 2009, 8:59:21 AM6/22/09
to jvm-la...@googlegroups.com
The backport is directly derived from the mlvm repository sources.
The jdk7b61 comes from the same repository but from an older revision.

Here, insertArgument was renamed insertArguments, notice the last 's'.
see http://www.mail-archive.com/mlvm...@openjdk.java.net/msg00681.html

Rémi

Chanwit Kaewkasi a écrit :

Chanwit Kaewkasi

unread,
Jun 22, 2009, 9:05:19 AM6/22/09
to jvm-la...@googlegroups.com
Hi Remi,

Hope the b62 includes this update.
In the mean time, I will try to build and test with the mlvm.

Chanwit

Chanwit Kaewkasi

unread,
Jun 23, 2009, 8:49:32 AM6/23/09
to jvm-la...@googlegroups.com
Hi Remi,

I recompiled the Fib program against the latest mlvm, and then reran
the program with backport using the same command:

$ java -javaagent:backport/jsr292-backport.jar -cp .:target/classes
g7.tests.classgen.Fib

and I got this exception (at least it seems that JIT trasformation of
the backport was trying to do something):

methodInfo map {$indy_stub2$=INDY_INVOKE:delegate(invoke class
java.lang.Object fib[class java.lang.Object]),
$indy_stub1$=INDY_INVOKE:delegate(invoke class java.lang.Integer
minus[class java.lang.Integer, class java.lang.Integer]),
$indy_stub0$=INDY_INVOKE:delegate(invoke class java.lang.Boolean
__lt__[class java.lang.Integer, class java.lang.Integer])}
Exception in thread "main" java.lang.VerifyError
at sun.instrument.InstrumentationImpl.redefineClasses0(Native Method)
at sun.instrument.InstrumentationImpl.redefineClasses(InstrumentationImpl.java:150)
at jsr292.weaver.jit.JIT.retransform(JIT.java:45)
at g7.tests.classgen.Fib.$indy_stub0$(Fib.groovy)
at g7.tests.classgen.Fib.fib(Fib.groovy)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jsr292.java.dyn.MHLookupUnreflectMethod.invoke(MHLookupUnreflectMethod.java:29)
at jsr292.java.dyn.MHLookupUnreflectMethod.$invoke$(MHLookupUnreflectMethod.java:59)
at jsr292.java.dyn.MHDelegator.$invoke$(MHDelegator.java:25)
at g7.tests.classgen.Fib.$indy_stub4$(Fib.groovy)
at g7.tests.classgen.Fib.fib(Fib.groovy)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jsr292.java.dyn.MHLookupUnreflectMethod.invoke(MHLookupUnreflectMethod.java:29)
at jsr292.java.dyn.MHLookupUnreflectMethod.$invoke$(MHLookupUnreflectMethod.java:59)
at jsr292.java.dyn.MHDelegator.$invoke$(MHDelegator.java:25)
at g7.tests.classgen.Fib.$indy_stub2$(Fib.groovy)
at g7.tests.classgen.Fib.fib(Fib.groovy)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jsr292.java.dyn.MHLookupUnreflectMethod.invoke(MHLookupUnreflectMethod.java:29)
at jsr292.java.dyn.MHLookupUnreflectMethod.$invoke$(MHLookupUnreflectMethod.java:59)
at jsr292.java.dyn.MHDelegator.$invoke$(MHDelegator.java:25)
at g7.tests.classgen.Fib.$indy_stub4$(Fib.groovy)
at g7.tests.classgen.Fib.fib(Fib.groovy)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jsr292.java.dyn.MHLookupUnreflectMethod.invoke(MHLookupUnreflectMethod.java:29)
at jsr292.java.dyn.MHLookupUnreflectMethod.$invoke$(MHLookupUnreflectMethod.java:59)
at jsr292.java.dyn.MHDelegator.$invoke$(MHDelegator.java:25)
at g7.tests.classgen.Fib.$indy_stub2$(Fib.groovy)
at g7.tests.classgen.Fib.fib(Fib.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jsr292.java.dyn.MHLookupUnreflectMethod.invoke(MHLookupUnreflectMethod.java:29)
at jsr292.java.dyn.MHLookupUnreflectMethod.$invoke$(MHLookupUnreflectMethod.java:59)
at jsr292.java.dyn.MHDelegator.$invoke$(MHDelegator.java:25)
at jsr292.java.dyn.MethodHandles.invoke_1(MethodHandles.java:504)
at com.chanwit.g7.runtime.G7Bootstrap.fallback_1(G7Bootstrap.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jsr292.java.dyn.MHLookupUnreflectMethod.invoke(MHLookupUnreflectMethod.java:29)
at jsr292.java.dyn.MHLookupUnreflectMethod.$invoke$(MHLookupUnreflectMethod.java:66)
at jsr292.java.dyn.MHInserter.$invoke$(MHInserter.java:52)
at jsr292.java.dyn.BootstrapCallSite$BootstrapInvoker.$invoke$(BootstrapCallSite.java:81)
at g7.tests.classgen.Fib.$indy_stub8$(Fib.groovy)
at g7.tests.classgen.Fib.main(Fib.groovy)


Chanwit

Rémi Forax

unread,
Jun 23, 2009, 8:58:26 AM6/23/09
to jvm-la...@googlegroups.com
Chanwit Kaewkasi a écrit :

> Hi Remi,
>
> I recompiled the Fib program against the latest mlvm, and then reran
> the program with backport using the same command:
>
> $ java -javaagent:backport/jsr292-backport.jar -cp .:target/classes
> g7.tests.classgen.Fib
>
> and I got this exception (at least it seems that JIT trasformation of
> the backport was trying to do something):
>

You're right, your code trigger a recompilation of 3 invokedynamic calls and
stupidly fail :(

Could you jar all the classes in target and . and send them to me ?
(using my private email address)

> methodInfo map {$indy_stub2$=INDY_INVOKE:delegate(invoke class
> java.lang.Object fib[class java.lang.Object]),
> $indy_stub1$=INDY_INVOKE:delegate(invoke class java.lang.Integer
> minus[class java.lang.Integer, class java.lang.Integer]),
> $indy_stub0$=INDY_INVOKE:delegate(invoke class java.lang.Boolean
> __lt__[class java.lang.Integer, class java.lang.Integer])}
>

[...]

Rémi

Reply all
Reply to author
Forward
0 new messages