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

Halve the function object creation code size

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b46
    • CPU:
      generic
    • OS:
      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

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: