exception running JDK 8 test program
Gilles Duboscq
gilwooden at gmail.com
Thu Feb 14 13:33:18 PST 2013
By default the EnableInvokeDynamic is false, so you need to use
-XX:+UnlockDiagnosticVMOptions
-XX:+EnableInvokeDynamic on the command line:
mx vm -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic Twelve
If you want to make it default, apply this patch:
diff -r af07019db85d src/share/vm/runtime/globals.hpp
--- a/src/share/vm/runtime/globals.hpp Wed Feb 13 18:46:24 2013 +0100
+++ b/src/share/vm/runtime/globals.hpp Thu Feb 14 22:32:06 2013 +0100
@@ -3588,7 +3588,7 @@
product(uintx, SharedDummyBlockSize, 0,
\
"Size of dummy block used to shift heap addresses (in bytes)")
\
\
- diagnostic(bool, EnableInvokeDynamic, false,
\
+ diagnostic(bool, EnableInvokeDynamic, true,
\
"support JSR 292 (method handles, invokedynamic, "
\
"anonymous classes")
\
\
clean, and rebuild.
Hope this helps
- Gilles
On Thu, Feb 14, 2013 at 10:09 PM, Gary Frost <Gary.Frost at amd.com> wrote:
> Obviously ConstantPool tag 18 is MethodHandle. So this relates to the
> support for MethodHandles in classfiles.
>
> Gary
>
>
>
> -----Original Message-----
> From: graal-dev-bounces at openjdk.java.net [mailto:
> graal-dev-bounces at openjdk.java.net] On Behalf Of Venkatachalam, Vasanth
> Sent: Thursday, February 14, 2013 2:49 PM
> To: graal-dev at openjdk.java.net
> Subject: exception running JDK 8 test program
>
> Hi,
>
> When running the following JDK8 program (which has a lambda expression) in
> Graal, the VM throws the below exception and exits.
> We know that Graal doesn't yet support the compilation of lambda
> constructs, but we would have expected the execution to have fallen back to
> the Hotspot compiler/interpreter instead of simply failing.
> Any workarounds for this?
>
> public class Twelve{
> interface SAM{
> void run(int _id);
> }
>
> public static void For(int _count, SAM _sam){
> for (int id = 0; id<_count; id++){
> _sam.run(id);
> }
> }
>
> public static void main(String[] _args) {
> For(12, value ->{System.out.printf("%d * %d = %d\n", value, 12,
> (value*12));});
> }
> }
>
> Exception in thread "main" java.lang.ClassFormatError: This JVM does not
> support constant tag 18 in class file com/amd/aparapi/sample/mandel/Main
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
> at
> sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:491)
>
>
>
>
More information about the graal-dev
mailing list