Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
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).
public class ModuleVersionGuardInstr extends Instr {
The token value that has been assumed
    private final int expectedVersion;

The module whose version we are testing
    private final RubyModule module;

The object whose metaclass token has to be verifie
    private Operand candidateObj;

Where to jump if the version assumption fails?
    private Label failurePathLabel;
    public ModuleVersionGuardInstr(RubyModule moduleint expectedVersionOperand candidateObjLabel failurePathLabel) {
        this. = module;
        this. = expectedVersion;
        this. = candidateObj;
        this. = failurePathLabel;
    public Label getFailurePathLabel() {
        return ;
    public Operand[] getOperands() {
        return new Operand[] {  };
    public void simplifyOperands(Map<OperandOperandvalueMapboolean force) {
         = .getSimplifiedOperand(valueMapforce);
    public String toString() {
        return super.toString() + "(" +  + ", " +  + "[" + .getName() + "], " +  + ")";
    public Instr cloneForInlinedScope(InlinerInfo ii) {
    public Instr cloneForBlockCloning(InlinerInfo ii) {
    public boolean versionMatches(ThreadContext contextDynamicScope currDynScopeIRubyObject selfObject[] temp) {
        IRubyObject receiver = (IRubyObject.retrieve(contextselfcurrDynScopetemp);
        // if (module.getGeneration() != expectedVersion) ... replace this instr with a direct jump
        // SSS FIXME: This is not always correct.  Implementation class is not always receiver.getMetaClass()
        // as we know from how we add instance-methods.  We add it to rubyClass value on the stack.  So, how
        // do we handle this sticky situation?
        return (receiver.getMetaClass().getGeneration() == );
    public void visit(IRVisitor visitor) {
New to GrepCode? Check out our FAQ X