Thursday 15 May 2014

java - Troubleshooting Nashorn "Method code too large!" exception -



java - Troubleshooting Nashorn "Method code too large!" exception -

running jjs or scriptengine#eval on javascript (https://gist.github.com/also/005fd7c200b20f012e10) crashes exception , no more details:

exception in thread "main" java.lang.runtimeexception: method code large! @ jdk.internal.org.objectweb.asm.methodwriter.getsize(methodwriter.java:2065) @ jdk.internal.org.objectweb.asm.classwriter.tobytearray(classwriter.java:856) @ jdk.nashorn.internal.codegen.classemitter.tobytearray(classemitter.java:577) @ jdk.nashorn.internal.codegen.compilationphase$8.transform(compilationphase.java:396) @ jdk.nashorn.internal.codegen.compilationphase.apply(compilationphase.java:513) @ jdk.nashorn.internal.codegen.compiler.compile(compiler.java:361) @ jdk.nashorn.internal.runtime.context.compile(context.java:1071) @ jdk.nashorn.internal.runtime.context.compilescript(context.java:1019) @ jdk.nashorn.internal.runtime.context.compilescript(context.java:490) @ jdk.nashorn.tools.shell.runscripts(shell.java:306) @ jdk.nashorn.tools.shell.run(shell.java:168) @ jdk.nashorn.tools.shell.main(shell.java:132) @ jdk.nashorn.tools.shell.main(shell.java:111)

how can figure out causing method code large? i've tried log options jjs (--log=codegen:info), haven't seen points @ culprit.

i've tested java versions 1.9.0-ea-b34 , 1.8.0_20-b26.

nashorn tries split big scripts/functions smaller blocks compile bytecode workaround per method bytecode size limit imposed jvm. nashorn splitter has improved in jdk 1.8.0 update 40 (being developed, not yet released - access available https://jdk8.java.net/download.html. may want seek well.

java javascript java-8 nashorn java-9

No comments:

Post a Comment