Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b39
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        This example forms a long name for a function. Can we have graceful failure or handle it somehow?

        jjs -J-Djava.ext.dirs=$jdk9-dev/nashorn/dist/

        jjs> eval("function " + Array.apply(null,Array(0x10000)).join("a") + "(){}")

        Exception in thread "main" java.lang.AssertionError: Failed generating bytecode for <shell>#1:1<eval>@1:1
        at jdk.nashorn.internal.codegen.CompilationPhase$11.transform(CompilationPhase.java:448)
        at jdk.nashorn.internal.codegen.CompilationPhase.apply(CompilationPhase.java:685)
        at jdk.nashorn.internal.codegen.Compiler.compile(Compiler.java:506)
        at jdk.nashorn.internal.runtime.Context.compile(Context.java:1106)
        at jdk.nashorn.internal.runtime.Context.eval(Context.java:580)
        at jdk.nashorn.internal.objects.Global.directEval(Global.java:886)
        at jdk.nashorn.internal.scripts.Script$Recompilation$2$\^shell\_$cu2$restOf.:program(<shell>:1)
        at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:567)
        at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:221)
        at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:374)
        at jdk.nashorn.internal.runtime.Context.eval(Context.java:620)
        at jdk.nashorn.tools.Shell.readEvalPrint(Shell.java:448)
        at jdk.nashorn.tools.Shell.run(Shell.java:158)
        at jdk.nashorn.tools.Shell.main(Shell.java:133)
        at jdk.nashorn.tools.Shell.main(Shell.java:112)
        Caused by: java.lang.IllegalArgumentException
        at jdk.internal.org.objectweb.asm.ByteVector.putUTF8(ByteVector.java:242)
        at jdk.internal.org.objectweb.asm.ClassWriter.newUTF8(ClassWriter.java:1102)
        at jdk.internal.org.objectweb.asm.ClassWriter.newNameTypeItem(ClassWriter.java:1572)
        at jdk.internal.org.objectweb.asm.ClassWriter.newNameType(ClassWriter.java:1555)
        at jdk.internal.org.objectweb.asm.ClassWriter.newInvokeDynamicItem(ClassWriter.java:1326)
        at jdk.internal.org.objectweb.asm.MethodWriter.visitInvokeDynamicInsn(MethodWriter.java:969)
        at jdk.nashorn.internal.codegen.MethodEmitter.dynamicSet(MethodEmitter.java:2252)
        at jdk.nashorn.internal.codegen.CodeGenerator.storeFastScopeVar(CodeGenerator.java:470)
        at jdk.nashorn.internal.codegen.CodeGenerator.enterVarNode(CodeGenerator.java:3194)
        at jdk.nashorn.internal.ir.VarNode.accept(VarNode.java:125)
        at jdk.nashorn.internal.ir.Node.accept(Node.java:268)
        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:386)
        at jdk.nashorn.internal.ir.SplitNode.accept(SplitNode.java:94)
        at jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
        at jdk.nashorn.internal.ir.LexicalContextStatement.accept(LexicalContextStatement.java:53)
        at jdk.nashorn.internal.ir.SplitNode.accept(SplitNode.java:41)
        at jdk.nashorn.internal.ir.Node.accept(Node.java:268)
        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:386)
        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:435)
        ... 14 more

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  hannesw Hannes Wallnoefer
                  Reporter:
                  sundar Sundararajan Athijegannathan
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: