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

Method code too large in Babel browser.js script

    Details

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

      Backports

        Description

        The Babel compiler contains a script called browser.js (or browser.min.js for the minified version) that causes a "method code too large" exception in Nashorn.

        http://dev.clojure.org/jira/browse/CLJS-1322

        I tracked the problem down to a function with a huge nested object literal.

        To reproduce:

        > jjs babel-min.js
        Exception in thread "main" java.lang.RuntimeException: Method code too large!
        at jdk.internal.org.objectweb.asm.MethodWriter.getSize(MethodWriter.java:2065)
        at jdk.internal.org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:856)
        at jdk.nashorn.internal.codegen.ClassEmitter.toByteArray(ClassEmitter.java:679)
        at jdk.nashorn.internal.codegen.CompilationPhase$13.transform(CompilationPhase.java:497)
        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.RecompilableScriptFunctionData.compileTypeSpecialization(RecompilableScriptFunctionData.java:514)
        at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.getBest(RecompilableScriptFunctionData.java:688)
        at jdk.nashorn.internal.runtime.ScriptFunctionData.getBestInvoker(ScriptFunctionData.java:237)
        at jdk.nashorn.internal.runtime.ScriptFunction.findCallMethod(ScriptFunction.java:592)
        at jdk.nashorn.internal.runtime.ScriptObject.lookup(ScriptObject.java:1833)
        at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:104)
        at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:98)
        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.nashorn.internal.runtime.ScriptFunction.createApplyOrCallCall(ScriptFunction.java:772)
        at jdk.nashorn.internal.runtime.ScriptFunction.findCallMethod(ScriptFunction.java:583)
        at jdk.nashorn.internal.runtime.ScriptObject.lookup(ScriptObject.java:1833)
        at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:104)
        at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:98)
        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:253)
        at jdk.nashorn.internal.scripts.Script$Recompilation$2$1AAA$babel_min.L:1(babel-min.js:2)
        at jdk.nashorn.internal.scripts.Script$Recompilation$1$babel_min.:program(babel-min.js:1)
        at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:640)
        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)
        1. babel-min.js
          448 kB
          Hannes Wallnoefer

          Activity

          Hide
          hannesw Hannes Wallnoefer added a comment -
          We currently only split array literals, but not object literals. Obviously we should split those, too.
          Show
          hannesw Hannes Wallnoefer added a comment - We currently only split array literals, but not object literals. Obviously we should split those, too.
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/dev/nashorn/rev/6e5080fdfaad
          User: hannesw
          Date: 2015-09-19 14:05:25 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/nashorn/rev/6e5080fdfaad User: hannesw Date: 2015-09-19 14:05:25 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/jdk9/nashorn/rev/6e5080fdfaad
          User: lana
          Date: 2015-09-30 22:17:42 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/nashorn/rev/6e5080fdfaad User: lana Date: 2015-09-30 22:17:42 +0000

            People

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

              Dates

              • Created:
                Updated:
                Resolved: