Top Description Fields Constructors Methods
org.jruby.ir.instructions

public Class ModuleVersionGuardInstr

extends TwoOperandInstr
implements FixedArityInstr
Class Inheritance
All Implemented Interfaces
org.jruby.ir.instructions.FixedArityInstr
Imports
org.jruby.RubyModule, org.jruby.ir.IRVisitor, .Operation, org.jruby.ir.operands.Label, .Operand, org.jruby.ir.transformations.inlining.CloneInfo, org.jruby.parser.StaticScope, org.jruby.runtime.DynamicScope, .ThreadContext, org.jruby.runtime.builtin.IRubyObject

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).

Field Summary

Modifier and TypeField and Description
private final int
private final RubyModule

Constructor Summary

AccessConstructor and Description
public
ModuleVersionGuardInstr(RubyModule module, int expectedVersion, Operand candidateObj, Label failurePathLabel)

Method Summary

Modifier and TypeMethod and Description
public Instr
clone(CloneInfo
This object manages renaming of variables and labels, handles args and return values.
ii
)

Implements abstract org.jruby.ir.instructions.Instr.clone.

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).

public Operand
getCandidateObject()

The object whose metaclass token has to be verified

public int
public Label
getFailurePathLabel()

Where to jump if the version assumption fails?

public RubyModule
public int
public String[]
private boolean
versionMatches(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp)

public void
Inherited from org.jruby.ir.instructions.TwoOperandInstr:
getOperand1getOperand2getOperandssetOperandsetOperand1setOperand2

Field Detail

expectedVersionback to summary
private final int expectedVersion
moduleback to summary
private final RubyModule module

Constructor Detail

ModuleVersionGuardInstrback to summary
public ModuleVersionGuardInstr(RubyModule module, int expectedVersion, Operand candidateObj, Label failurePathLabel)

Method Detail

cloneback to summary
public Instr clone(CloneInfo ii)

Implements abstract org.jruby.ir.instructions.Instr.clone.

Doc from org.jruby.ir.instructions.Instr.clone.

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.

Parameters
ii:CloneInfo

This object manages renaming of variables and labels, handles args and return values.

Returns:Instr

a new instruction that can be used in the target scope.

Annotations
@Override
getCandidateObjectback to summary
public Operand getCandidateObject()

The object whose metaclass token has to be verified

getExpectedVersionback to summary
public int getExpectedVersion()
getFailurePathLabelback to summary
public Label getFailurePathLabel()

Where to jump if the version assumption fails?

getModuleback to summary
public RubyModule getModule()
interpretAndGetNewIPCback to summary
public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc)

Overrides org.jruby.ir.instructions.Instr.interpretAndGetNewIPC.

Annotations
@Override
toStringNonOperandArgsback to summary
public String[] toStringNonOperandArgs()

Overrides org.jruby.ir.instructions.Instr.toStringNonOperandArgs.

Annotations
@Override
versionMatchesback to summary
private boolean versionMatches(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp)
visitback to summary
public void visit(IRVisitor visitor)

Overrides org.jruby.ir.instructions.Instr.visit.

Annotations
@Override