Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8054223

Nashorn: AssertionError when use __DIR__ and ScriptEngine.eval()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Environment:

      jdk9 b25

    • Subcomponent:
    • Resolved In Build:
      b26
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        Run simple code : "print(__DIR__)" with jjs - it's ok,
        but run this code with ScriptEngine.eval :
        Exception in thread "main" java.lang.AssertionError: Failed generating bytecode for <eval>:1
        at jdk.nashorn.internal.codegen.CompilationPhase$11.transform(CompilationPhase.java:450)
        at jdk.nashorn.internal.codegen.CompilationPhase.apply(CompilationPhase.java:685)
        at jdk.nashorn.internal.codegen.Compiler.compile(Compiler.java:524)
        at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.compileTypeSpecialization(RecompilableScriptFunctionData.java:445)
        at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.getBest(RecompilableScriptFunctionData.java:592)
        at jdk.nashorn.internal.runtime.ScriptFunctionData.getGeneric(ScriptFunctionData.java:317)
        at jdk.nashorn.internal.runtime.ScriptFunctionData.createGenericInvoker(ScriptFunctionData.java:274)
        at jdk.nashorn.internal.runtime.ScriptFunctionData.getGenericInvoker(ScriptFunctionData.java:268)
        at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:550)
        at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:222)
        at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:376)
        at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:465)
        at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:429)
        at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:425)
        at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:153)
        at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
        at Main.main(Main.java:12)
        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:484)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
        Caused by: java.lang.AssertionError
        at jdk.nashorn.internal.codegen.CodeGenerator$OptimisticOperation.replaceCompileTimeProperty(CodeGenerator.java:4747)
        at jdk.nashorn.internal.codegen.CodeGenerator$OptimisticOperation.replaceCompileTimeProperty(CodeGenerator.java:4724)
        at jdk.nashorn.internal.codegen.CodeGenerator$LoadScopeVar.consumeStack(CodeGenerator.java:463)
        at jdk.nashorn.internal.codegen.CodeGenerator$OptimisticOperation.emit(CodeGenerator.java:4499)
        at jdk.nashorn.internal.codegen.CodeGenerator$OptimisticOperation.emit(CodeGenerator.java:4461)
        at jdk.nashorn.internal.codegen.CodeGenerator.loadIdent(CodeGenerator.java:334)
        at jdk.nashorn.internal.codegen.CodeGenerator.access$200(CodeGenerator.java:182)
        at jdk.nashorn.internal.codegen.CodeGenerator$1.enterIdentNode(CodeGenerator.java:702)
        at jdk.nashorn.internal.ir.IdentNode.accept(IdentNode.java:134)
        at jdk.nashorn.internal.codegen.CodeGenerator.loadExpression(CodeGenerator.java:699)
        at jdk.nashorn.internal.codegen.CodeGenerator.loadExpression(CodeGenerator.java:675)
        at jdk.nashorn.internal.codegen.CodeGenerator.loadExpressionUnbounded(CodeGenerator.java:533)
        at jdk.nashorn.internal.codegen.CodeGenerator.loadArgs(CodeGenerator.java:1224)
        at jdk.nashorn.internal.codegen.CodeGenerator.access$4700(CodeGenerator.java:182)
        at jdk.nashorn.internal.codegen.CodeGenerator$2$2.loadStack(CodeGenerator.java:1280)
        at jdk.nashorn.internal.codegen.CodeGenerator$OptimisticOperation.emit(CodeGenerator.java:4476)
        at jdk.nashorn.internal.codegen.CodeGenerator$OptimisticOperation.emit(CodeGenerator.java:4461)
        at jdk.nashorn.internal.codegen.CodeGenerator$2.scopeCall(CodeGenerator.java:1286)
        at jdk.nashorn.internal.codegen.CodeGenerator$2.enterIdentNode(CodeGenerator.java:1378)
        at jdk.nashorn.internal.ir.IdentNode.accept(IdentNode.java:134)
        at jdk.nashorn.internal.codegen.CodeGenerator.loadCallNode(CodeGenerator.java:1237)
        at jdk.nashorn.internal.codegen.CodeGenerator.access$1700(CodeGenerator.java:182)
        at jdk.nashorn.internal.codegen.CodeGenerator$1.enterCallNode(CodeGenerator.java:832)
        at jdk.nashorn.internal.ir.CallNode.accept(CallNode.java:175)
        at jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
        at jdk.nashorn.internal.ir.LexicalContextExpression.accept(LexicalContextExpression.java:46)
        at jdk.nashorn.internal.ir.CallNode.accept(CallNode.java:41)
        at jdk.nashorn.internal.codegen.CodeGenerator.loadExpression(CodeGenerator.java:699)
        at jdk.nashorn.internal.codegen.CodeGenerator.loadExpression(CodeGenerator.java:675)
        at jdk.nashorn.internal.codegen.CodeGenerator.loadExpressionAsType(CodeGenerator.java:671)
        at jdk.nashorn.internal.codegen.CodeGenerator$15.evaluate(CodeGenerator.java:3760)
        at jdk.nashorn.internal.codegen.CodeGenerator$Store.store(CodeGenerator.java:4350)
        at jdk.nashorn.internal.codegen.CodeGenerator.loadASSIGN(CodeGenerator.java:3762)
        at jdk.nashorn.internal.codegen.CodeGenerator.access$500(CodeGenerator.java:182)
        at jdk.nashorn.internal.codegen.CodeGenerator$1.enterASSIGN(CodeGenerator.java:760)
        at jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor.enterBinaryNode(NodeOperatorVisitor.java:113)
        at jdk.nashorn.internal.ir.BinaryNode.accept(BinaryNode.java:315)
        at jdk.nashorn.internal.codegen.CodeGenerator.loadExpression(CodeGenerator.java:699)
        at jdk.nashorn.internal.codegen.CodeGenerator.loadExpression(CodeGenerator.java:675)
        at jdk.nashorn.internal.codegen.CodeGenerator.loadAndDiscard(CodeGenerator.java:3592)
        at jdk.nashorn.internal.codegen.CodeGenerator.enterExpressionStatement(CodeGenerator.java:1544)
        at jdk.nashorn.internal.ir.ExpressionStatement.accept(ExpressionStatement.java:61)
        at jdk.nashorn.internal.ir.Node.accept(Node.java:240)
        at jdk.nashorn.internal.ir.Block.accept(Block.java:152)
        at jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
        at jdk.nashorn.internal.ir.Block.accept(Block.java:391)
        at jdk.nashorn.internal.ir.FunctionNode.accept(FunctionNode.java:351)
        at jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
        at jdk.nashorn.internal.ir.LexicalContextExpression.accept(LexicalContextExpression.java:46)
        at jdk.nashorn.internal.ir.FunctionNode.accept(FunctionNode.java:52)
        at jdk.nashorn.internal.codegen.CompilationPhase$11.transform(CompilationPhase.java:437)
        ... 21 more

          Attachments

          1. Main.java
            0.4 kB
          2. test.js
            0.0 kB

            Issue Links

              Activity

                People

                Assignee:
                sundar Sundararajan Athijegannathan
                Reporter:
                slugovoy Sergey Lugovoy (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: