Halve the function object creation code size

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 9
    • Affects Version/s: 9
    • Component/s: core-libs
    • b46
    • generic
    • generic

        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.

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

                Created:
                Updated:
                Resolved: