admin管理员组文章数量:1431413
Running jjs
or ScriptEngine#eval
on my JavaScript () crashes with this exception and no more details:
Exception in thread "main" java.lang.RuntimeException: Method code too large!
at jdk.internal.objectweb.asm.MethodWriter.getSize(MethodWriter.java:2065)
at jdk.internal.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:856)
at jdk.nashorn.internal.codegen.ClassEmitter.toByteArray(ClassEmitter.java:577)
at jdk.nashorn.internal.codegen.CompilationPhase$8.transform(CompilationPhase.java:396)
at jdk.nashorn.internal.codegen.CompilationPhase.apply(CompilationPhase.java:513)
at jdk.nashorn.internal.codegen.Compilerpile(Compiler.java:361)
at jdk.nashorn.internal.runtime.Contextpile(Context.java:1071)
at jdk.nashorn.internal.runtime.ContextpileScript(Context.java:1019)
at jdk.nashorn.internal.runtime.ContextpileScript(Context.java:490)
at jdk.nashorn.tools.Shell.runScripts(Shell.java:306)
at jdk.nashorn.tools.Shell.run(Shell.java:168)
at jdk.nashorn.tools.Shell.main(Shell.java:132)
at jdk.nashorn.tools.Shell.main(Shell.java:111)
How can I figure out what is causing the method code to be too large? I've tried some log options to jjs
(--log=codegen:info
), but I haven't seen anything that points at a culprit.
I've tested with Java versions 1.9.0-ea-b34 and 1.8.0_20-b26.
Running jjs
or ScriptEngine#eval
on my JavaScript (https://gist.github./also/005fd7c200b20f012e10) crashes with this exception and no more details:
Exception in thread "main" java.lang.RuntimeException: Method code too large!
at jdk.internal.objectweb.asm.MethodWriter.getSize(MethodWriter.java:2065)
at jdk.internal.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:856)
at jdk.nashorn.internal.codegen.ClassEmitter.toByteArray(ClassEmitter.java:577)
at jdk.nashorn.internal.codegen.CompilationPhase$8.transform(CompilationPhase.java:396)
at jdk.nashorn.internal.codegen.CompilationPhase.apply(CompilationPhase.java:513)
at jdk.nashorn.internal.codegen.Compiler.pile(Compiler.java:361)
at jdk.nashorn.internal.runtime.Context.pile(Context.java:1071)
at jdk.nashorn.internal.runtime.Context.pileScript(Context.java:1019)
at jdk.nashorn.internal.runtime.Context.pileScript(Context.java:490)
at jdk.nashorn.tools.Shell.runScripts(Shell.java:306)
at jdk.nashorn.tools.Shell.run(Shell.java:168)
at jdk.nashorn.tools.Shell.main(Shell.java:132)
at jdk.nashorn.tools.Shell.main(Shell.java:111)
How can I figure out what is causing the method code to be too large? I've tried some log options to jjs
(--log=codegen:info
), but I haven't seen anything that points at a culprit.
I've tested with Java versions 1.9.0-ea-b34 and 1.8.0_20-b26.
Share Improve this question asked Oct 12, 2014 at 20:12 alsoalso 9747 silver badges22 bronze badges2 Answers
Reset to default 5Nashorn tries to split too large scripts/functions into smaller blocks to pile to bytecode to workaround the per method bytecode size limit imposed by JVM. The Nashorn splitter has improved in jdk 1.8.0 update 40 (being developed, not yet released - but early access available from https://jdk8.java/download.html. You may want to try that as well.
The current JDK 8u40 is still throwing the bug. Ref the detailed note on:
http://skrishnamachari.wordpress./2014/06/18/nashorn-bug/
Also is there a possibility to access the latest Nashorn source to be able to quickly debug through. Atleast find a hack/ validate and have it stick for our use till some final patch is provided.
本文标签: javaTroubleshooting Nashorn quotMethod code too largequot exceptionStack Overflow
版权声明:本文标题:java - Troubleshooting Nashorn "Method code too large!" exception - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745572820a2664149.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论