Oups, another crash

Rémi Forax forax at univ-mlv.fr
Sun Aug 8 07:09:11 PDT 2010


Here is a sample code that crash the VM:

import java.dyn.*;

public class Crash {
   public static void foo(Object o) { }

   public static void main(String[] args) {
     MethodHandles.Lookup lookup = MethodHandles.lookup();
     MethodHandle mh = lookup.findStatic(Crash.class, "foo",
       MethodType.methodType(void.class, Object.class));

     for(;;) {
       try {
          mh.invokeExact("bad arg!");
       } catch(WrongMethodTypeException e) {
         // do nothing
       } catch(Throwable t) {
         t.printStackTrace();
       }
     }
   }
}

I try to do an invoke exact with the wrong signature (String instead of 
Object),
the VM throws a WrongMethodTypeException. But when the JIT is triggered, 
the VM crashs.

Rémi





More information about the mlvm-dev mailing list