Hi All,
I'm working on using Nashorn to do server-side rendering of react components.  
As an example, I used a comment box component to run a microbenchmark.   With 
the default options, the 8u31 version significantly outperforms 8u40 versions 
and later.  Please see: 
https://github.com/maximenajim/nashorn-react-jmh-microbenchmark.git
I attempted to run Nashorn with optimistic types using the argument 
--optimistic-types=true.  However, I got the following NullPointerException.   
Thank you in advance for your feedback,Maxime Najim
Steps to reproduce NullPointerException:$ git clone 
https://github.com/maximenajim/nashorn-react-jmh-microbenchmark$ cd 
nashorn-react-jmh-microbenchmark/
$ git checkout optimistic-types $ mvn clean install$ java -jar 
target/benchmarks.jar

java.lang.VerifyError: Code generation bug in "L:4-1$L:12339$measure$wrapper": 
likely stack misaligned: java.lang.NullPointerException <eval> at 
jdk.nashorn.internal.codegen.CodeGenerator.leaveFunctionNode(CodeGenerator.java:2159)
 at jdk.nashorn.internal.ir.FunctionNode.accept(FunctionNode.java:374) at 
jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
 at 
jdk.nashorn.internal.ir.LexicalContextExpression.accept(LexicalContextExpression.java:47)
 at jdk.nashorn.internal.ir.FunctionNode.accept(FunctionNode.java:57) at 
jdk.nashorn.internal.codegen.CompilationPhase.transformFunction(CompilationPhase.java:720)
 at 
jdk.nashorn.internal.codegen.CompilationPhase.access$100(CompilationPhase.java:68)
 at 
jdk.nashorn.internal.codegen.CompilationPhase$13.transform(CompilationPhase.java:472)
 at 
jdk.nashorn.internal.codegen.CompilationPhase.apply(CompilationPhase.java:716) 
at jdk.nashorn.internal.codegen.Compiler.compile(Compiler.java:620) at 
jdk.nashorn.internal.runtime.CompiledFunction.handleRewriteException(CompiledFunction.java:867)
 at 
jdk.nashorn.internal.runtime.CompiledFunction.handleRewriteException(CompiledFunction.java:723)
 at 
jdk.nashorn.internal.scripts.Script$Recompilation$1403$380675AA$\^eval\_$cu1$restOf.L:4-1$L:11653$mountChildren(<eval>:11848)
 at 
jdk.nashorn.internal.scripts.Script$Recompilation$1382$235479A$\^eval\_$cu1$restOf.L:4-1$L:7098$_createContentMarkup(<eval>:7358)
 at 
jdk.nashorn.internal.scripts.Script$Recompilation$1380$233235AAA$\^eval\_$cu1$restOf.L:4-1$L:7098$mountComponent(<eval>:7280)
 at 
jdk.nashorn.internal.scripts.Script$Recompilation$1280$398039AAI$\^eval\_.L:4-1$L:12339$measure$wrapper(<eval>:12389)
 at 
jdk.nashorn.internal.scripts.Script$Recompilation$1352$196118AAI$\^eval\_$cu1$restOf.L:4-1$L:5318$mountComponent(<eval>:6126)
 at 
jdk.nashorn.internal.scripts.Script$Recompilation$1280$398039AAI$\^eval\_.L:4-1$L:12339$measure$wrapper(<eval>:12389)
 at 
jdk.nashorn.internal.scripts.Script$Recompilation$1279$424862$\^eval\_$cu1$restOf.L:4-1$L:13253$renderToString$L:13291(<eval>:13293)
 at 
jdk.nashorn.internal.scripts.Script$Recompilation$1257$491538AAAAAAAA$\^eval\_.L:4-1$L:15298$perform(<eval>:15432)
 at 
jdk.nashorn.internal.scripts.Script$Recompilation$1256$424461A$\^eval\_$cu1$restOf.L:4-1$L:13253$renderToString(<eval>:13291)
 at 
jdk.nashorn.internal.scripts.Script$Recompilation$1239$3830A$\^eval\_$cu1$restOf.renderServer(<eval>:112)
 at 
jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:642)
 at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:228) 
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393) at 
jdk.nashorn.api.scripting.ScriptObjectMirror.callMember(ScriptObjectMirror.java:199)
 at 
jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:383)
 at 
jdk.nashorn.api.scripting.NashornScriptEngine.invokeFunction(NashornScriptEngine.java:190)
 at 
com.github.maximenajim.ReactMicroBenchmark.microbenchmark(ReactMicroBenchmark.java:46)
 at 
com.github.maximenajim.generated.ReactMicroBenchmark_microbenchmark.microbenchmark_thrpt_jmhStub(ReactMicroBenchmark_microbenchmark.java:104)
 at 
com.github.maximenajim.generated.ReactMicroBenchmark_microbenchmark.microbenchmark_Throughput(ReactMicroBenchmark_microbenchmark.java:69)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:497) at 
org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:430)
 at 
org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:412)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266) at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
at java.lang.Thread.run(Thread.java:745)Caused by: 
java.lang.NullPointerException at 
jdk.nashorn.internal.codegen.CodeGenerator.generateContinuationHandler(CodeGenerator.java:5328)
 at 
jdk.nashorn.internal.codegen.CodeGenerator.leaveFunctionNode(CodeGenerator.java:2141)
 ... 40 more

Reply via email to