Interface JitCodeGenerator.PcGen

Enclosing class:
JitCodeGenerator<THIS extends JitCompiledPassage>

public static interface JitCodeGenerator.PcGen
A mechanism to emit bytecode that loads a program counter
  • Method Details

    • loadOffset

      static JitCodeGenerator.PcGen loadOffset(Address address)
      Create a generator that loads a constant program counter value
      Parameters:
      address - the program counter
      Returns:
      the generator
    • loadTarget

      static <THIS extends JitCompiledPassage> JitCodeGenerator.PcGen loadTarget(Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitVal target)
      Create a generator that loads a variable program counter
      Type Parameters:
      THIS - the type of the generated passage
      Parameters:
      localThis - a handle to the local holding the this reference
      gen - the code generator
      target - the value (probably a variable) to load to get the program counter
      Returns:
      the generator
    • loadLocal

      static <THIS extends JitCompiledPassage> JitCodeGenerator.PcGen loadLocal(Local<Types.TLong> local)
      Create a generator that loads the program counter from a temporary local

      This is used to verify a re-written indirect branch whose target constant became invalidated. In that case, the actual run-time target is loaded using loadTarget(Local, JitCodeGenerator, JitVal) and then stored into a temporary local. That target is compared to the now-invalidated constant target. If it matches, the direct internal branch is taken. Otherwise, we exit. LATER: If it happens that the target JitVal is allocated in a local, anyway, the temporary local is a bit redundant. It might be nice to avoid that.

      Type Parameters:
      THIS - the type of the generated passage
      Parameters:
      local - the local holding the program counter
      Returns:
      the generator
    • gen

      <N extends Emitter.Next> Emitter<Emitter.Ent<N, Types.TLong>> gen(Emitter<N> em)
      Emit bytecode to load a program counter
      Type Parameters:
      N - the incoming stack
      Parameters:
      em - the emitter typed with the incoming stack
      Returns:
      the emitter typed with the resulting stack, i.e., having pushed the counter value