On 12/06/2011 10:34 AM, Rémi Forax wrote: > On 12/05/2011 04:28 PM, Rémi Forax wrote: >> John, Christian, >> I was updating the multi-dispatch sample from the cookbook >> when the NoClassDefFoundError bug re-appear. > I've reduced the code to this simple sample: > public class NoClassDefFoundSample { > public void foo() { > // do nothing > } > > public static void main(String[] args) { > NoClassDefFoundSample classDefFoundSample = new > NoClassDefFoundSample(); > for(int i=0; i< 100000; i++) { > classDefFoundSample.foo(); // invokedynamic > } > } > } > > public class NoClassDefFoundBug { > // bootstrap method > public static CallSite invokevirtual(Lookup lookup, String name, > MethodType type) throws Throwable { > MethodHandle mh = lookup.findVirtual(type.parameterType(0), name, > type.dropParameterTypes(0, 1)); > > CallSite invokerCallSite = new MutableCallSite(mh); > > MethodHandle dynamicInvoker = invokerCallSite.dynamicInvoker(); > > CallSite callSite = new MutableCallSite(type); > callSite.setTarget(dynamicInvoker); > > return callSite; > } > } > > The sample triggers the JIT and the JITed code of the dynamicInvoker() > throws > the NoClassDefFoundError. > > Code is available here: > https://code.google.com/p/jsr292-cookbook/source/browse/#svn/trunk/multi-dispatch/src/bug > https://code.google.com/p/jsr292-cookbook/source/browse/trunk/multi-dispatch/NoClassDefFoundSample.java
I've forget to say that a workaround is to erase the type used the callsite before calling dynamicInvoker(). > > cheers, > Rémi cheers, Rémi _______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev