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

Halve the function object creation code size

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 9
    • 9
    • core-libs
    • b46
    • generic
    • generic

    Backports

      Description

        Currently we need 16 bytes to create a ScriptFunction in bytecode:

          new ScriptFunctionImpl
          dup
          getstatic Script$f.constants : [Object;
          iconst_1
          aaload
          checkcast RecompilableScriptFunctionData
          aload_2
          invokespecial ScriptFunctionImpl.<init>(RecompilableScriptFunctionData;ScriptObject;)V

        This can be reduced to 8 by introducing a factory method ScriptFunctionImpl.create(Object[] constants, int index, ScriptObject scope):

          getstatic Script$f.constants : [Object;
          iconst_1
          aload 2
          invokestatic ScriptFunctionImpl.create([Object;IScriptObject;)ScriptFunction;

        For methods containing lots of function declarations (e.g. typically the top-level program) this is a significant reduction in bytecode size.

        Attachments

          Issue Links

            Activity

              People

                attila Attila Szegedi
                attila Attila Szegedi
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: