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

Failed generating bytecode for goog Int code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 8u60
    • core-libs

      FULL PRODUCT VERSION :
      java version "1.8.0_60-ea"
      Java(TM) SE Runtime Environment (build 1.8.0_60-ea-b11)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b11, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Darwin Mike-Fikess-MacBook-Pro.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      For the following JavaScript (which is a minimal repro from from goog Closure integer manipulation code):

      ! function() {
          function t(t, i) {
              for (var $ = !0, r = t.length - 1; r >= 0; r--) {
                    $ && e == i
              }
          }
          function i(i) {
              return r = new t(0)
          } {
              i(0)
          }
      }();

      jjs will fail to generate bytecode

      REGRESSION. Last worked in version 8u45

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_45"
      Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute the file in jjs:

      $JAVA_HOME/bin/jjs file.js

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expect no output
      ACTUAL -
      Failure to generate bytecode

      ERROR MESSAGES/STACK TRACES THAT OCCUR :

      Exception in thread "main" java.lang.AssertionError: Failed generating bytecode for min-nash19.js:4
      at jdk.nashorn.internal.codegen.CompilationPhase$13.transform(CompilationPhase.java:486)
      at jdk.nashorn.internal.codegen.CompilationPhase.apply(CompilationPhase.java:728)
      at jdk.nashorn.internal.codegen.Compiler.compile(Compiler.java:620)
      at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.compileTypeSpecialization(RecompilableScriptFunctionData.java:512)
      at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.getBest(RecompilableScriptFunctionData.java:729)
      at jdk.nashorn.internal.runtime.ScriptFunctionData.getBestConstructor(ScriptFunctionData.java:243)
      at jdk.nashorn.internal.runtime.ScriptFunction.findNewMethod(ScriptFunction.java:480)
      at jdk.nashorn.internal.runtime.ScriptObject.lookup(ScriptObject.java:1878)
      at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:100)
      at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:94)
      at jdk.internal.dynalink.support.CompositeTypeBasedGuardingDynamicLinker.getGuardedInvocation(CompositeTypeBasedGuardingDynamicLinker.java:176)
      at jdk.internal.dynalink.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:124)
      at jdk.internal.dynalink.support.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:154)
      at jdk.internal.dynalink.DynamicLinker.relink(DynamicLinker.java:234)
      at jdk.nashorn.internal.scripts.Script$Recompilation$2$156I$min_nash19.L:1$i(min-nash19.js:8)
      at jdk.nashorn.internal.scripts.Script$Recompilation$1$13$min_nash19.L:1(min-nash19.js:10)
      at jdk.nashorn.internal.scripts.Script$min_nash19.:program(min-nash19.js:1)
      at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
      at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:228)
      at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
      at jdk.nashorn.tools.Shell.apply(Shell.java:397)
      at jdk.nashorn.tools.Shell.runScripts(Shell.java:326)
      at jdk.nashorn.tools.Shell.run(Shell.java:172)
      at jdk.nashorn.tools.Shell.main(Shell.java:136)
      at jdk.nashorn.tools.Shell.main(Shell.java:112)
      Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
      at jdk.nashorn.internal.codegen.Label$Stack.pop(Label.java:300)
      at jdk.nashorn.internal.codegen.MethodEmitter.popType(MethodEmitter.java:279)
      at jdk.nashorn.internal.codegen.MethodEmitter.pop(MethodEmitter.java:502)
      at jdk.nashorn.internal.codegen.CodeGenerator.loadAND_OR(CodeGenerator.java:3788)
      at jdk.nashorn.internal.codegen.CodeGenerator.access$3300(CodeGenerator.java:182)
      at jdk.nashorn.internal.codegen.CodeGenerator$1.enterAND(CodeGenerator.java:1068)
      at jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor.enterBinaryNode(NodeOperatorVisitor.java:111)
      at jdk.nashorn.internal.ir.BinaryNode.accept(BinaryNode.java:339)
      at jdk.nashorn.internal.codegen.CodeGenerator.loadExpression(CodeGenerator.java:840)
      at jdk.nashorn.internal.codegen.CodeGenerator.loadExpression(CodeGenerator.java:816)
      at jdk.nashorn.internal.codegen.CodeGenerator.loadAndDiscard(CodeGenerator.java:3658)
      at jdk.nashorn.internal.codegen.CodeGenerator.enterExpressionStatement(CodeGenerator.java:1712)
      at jdk.nashorn.internal.ir.ExpressionStatement.accept(ExpressionStatement.java:63)
      at jdk.nashorn.internal.ir.Node.accept(Node.java:261)
      at jdk.nashorn.internal.ir.Block.accept(Block.java:154)
      at jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
      at jdk.nashorn.internal.ir.Block.accept(Block.java:409)
      at jdk.nashorn.internal.codegen.CodeGenerator.enterForOrWhile(CodeGenerator.java:3422)
      at jdk.nashorn.internal.codegen.CodeGenerator.enterForNode(CodeGenerator.java:1743)
      at jdk.nashorn.internal.ir.ForNode.accept(ForNode.java:93)
      at jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
      at jdk.nashorn.internal.ir.LexicalContextStatement.accept(LexicalContextStatement.java:55)
      at jdk.nashorn.internal.ir.LoopNode.accept(LoopNode.java:36)
      at jdk.nashorn.internal.ir.Node.accept(Node.java:261)
      at jdk.nashorn.internal.ir.Block.accept(Block.java:154)
      at jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
      at jdk.nashorn.internal.ir.Block.accept(Block.java:409)
      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:732)
      at jdk.nashorn.internal.codegen.CompilationPhase.access$100(CompilationPhase.java:69)
      at jdk.nashorn.internal.codegen.CompilationPhase$13.transform(CompilationPhase.java:473)
      ... 24 more

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      ! function() {
          function t(t, i) {
              for (var $ = !0, r = t.length - 1; r >= 0; r--) {
                    $ && e == i
              }
          }
          function i(i) {
              return r = new t(0)
          } {
              i(0)
          }
      }();
      ---------- END SOURCE ----------

            hannesw Hannes Wallnoefer
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: