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

Reverse the order of "this" and "callee" parameters in generated functions

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • None
    • core-libs
    • None

      When functions need a callee parameter, we emit a signature of the form "Object this, ScriptFunction callee, ...", but then we need to create method handles using permuteArguments() for dyn:call, which quite logically passes (callee, this, ...) (as the receiver of the "dyn:call" is actually the callee).

      We could avoid the need for a permuteArguments() if we were to change the order, so that when a function needs a callee, the bytecode method takes "ScriptFunction callee, Object this, ...".

      Unfortunately, several places in the code rely on the assumption that local variable 0 is always "this" (note: all generated methods are static, so this has no significance - they are not instance methods). Actually eliminating this assumption might cause the code to be somewhat nicer - we'll see.

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

              Created:
              Updated:
              Resolved: