Class ModuleVersionGuardInstr

All Implemented Interfaces:
FixedArityInstr

public class ModuleVersionGuardInstr extends TwoOperandInstr implements FixedArityInstr
This instruction will be generated whenever speculative optimizations are performed based on assuming that an object's metaclass is C (as determined by the version number of C -- where the version number changes every time C's class structure changes).
  • Constructor Details

    • ModuleVersionGuardInstr

      public ModuleVersionGuardInstr(RubyModule module, int expectedVersion, Operand candidateObj, Label failurePathLabel)
  • Method Details

    • getCandidateObject

      public Operand getCandidateObject()
      The object whose metaclass token has to be verified
    • getFailurePathLabel

      public Label getFailurePathLabel()
      Where to jump if the version assumption fails?
    • getModule

      public RubyModule getModule()
    • getExpectedVersion

      public int getExpectedVersion()
    • toStringNonOperandArgs

      public String[] toStringNonOperandArgs()
      Overrides:
      toStringNonOperandArgs in class Instr
    • clone

      public Instr clone(CloneInfo ii)
      Description copied from class: Instr
      Clone the instruction for use in an inlining context (either when a scope is inlined into another scope, or when a block has to be cloned because its associated call belongs to an inlined scope). This might renaming variables and labels to eliminate naming conflicts. The implementation might vary on the cloning mode.
      Specified by:
      clone in class Instr
      Parameters:
      ii - This object manages renaming of variables and labels, handles args and return values.
      Returns:
      a new instruction that can be used in the target scope.
    • interpretAndGetNewIPC

      public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc)
      Overrides:
      interpretAndGetNewIPC in class Instr
    • visit

      public void visit(IRVisitor visitor)
      Overrides:
      visit in class Instr