@Override public Instr clone(CloneInfo ii) { // SSS FIXME: Do we need to rename lvar really? It is just a name-proxy! return new StoreLocalVarInstr(scope, getValue().cloneForInlining(ii), (LocalVariable) getLocalVar().cloneForInlining(ii)); }
public Operand getValue() { return getOperand1(); }
/** This is the variable that is being stored into in this scope. This variable * doesn't participate in the computation itself. We just use it as a proxy for * its (a) name (b) offset (c) scope-depth. */ public LocalVariable getLocalVar() { return (LocalVariable) getOperand2(); }
/** * getLocalVar is saved for location and should not be simplified so we still know its original * depth/offset. */ @Override public void simplifyOperands(Map<Operand, Operand> valueMap, boolean force) { setOperand1(getValue().getSimplifiedOperand(valueMap, force)); }
public void decrementLVarScopeDepth() { setOperand2(getLocalVar().cloneForDepth(getLocalVar().getScopeDepth()-1)); }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { Object varValue = getValue().retrieve(context, self, currScope, currDynScope, temp); currDynScope.setValue((IRubyObject)varValue, getLocalVar().getLocation(), getLocalVar().getScopeDepth()); return null; }
private boolean addClosureExitStoreLocalVars(IRScope scope, ListIterator<Instr> instrs, Set<LocalVariable> dirtyVars, Map<Operand, Operand> varRenameMap) { boolean addedStores = false; boolean isEvalScript = scope instanceof IREvalScript; for (LocalVariable v : dirtyVars) { if (isEvalScript || !(v instanceof ClosureLocalVariable) || (scope != ((ClosureLocalVariable)v).definingScope)) { addedStores = true; instrs.add(new StoreLocalVarInstr(getLocalVarReplacement(v, scope, varRenameMap), scope, v)); } } return addedStores; }
@Override public void encode(IRWriterEncoder e) { super.encode(e); e.encode(getScope()); e.encode(getValue()); e.encode(getLocalVar()); }
LocalVariable lv = ((StoreLocalVarInstr)i).getLocalVar(); if (!lv.isSelf()) reqdLoads.add(lv); } else {
if (slvi.getLocalVar() == lv) { instrs.remove(); if (slvi.getLocalVar() == lv) { slvi.decrementLVarScopeDepth();
case B_UNDEF: return BUndefInstr.decode(this); case BINDING_LOAD: return LoadLocalVarInstr.decode(this); case BINDING_STORE: return StoreLocalVarInstr.decode(this); case BLOCK_GIVEN: return BlockGivenInstr.decode(this); case BNE: return BNEInstr.decode(this);
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { Object varValue = getValue().retrieve(context, self, currScope, currDynScope, temp); currDynScope.setValue((IRubyObject)varValue, getLocalVar().getLocation(), getLocalVar().getScopeDepth()); return null; }
private boolean addClosureExitStoreLocalVars(IRScope scope, ListIterator<Instr> instrs, Set<LocalVariable> dirtyVars, Map<Operand, Operand> varRenameMap) { boolean addedStores = false; boolean isEvalScript = scope instanceof IREvalScript; for (LocalVariable v : dirtyVars) { if (isEvalScript || !(v instanceof ClosureLocalVariable) || (scope != ((ClosureLocalVariable)v).definingScope)) { addedStores = true; instrs.add(new StoreLocalVarInstr(getLocalVarReplacement(v, scope, varRenameMap), scope, v)); } } return addedStores; }
@Override public void encode(IRWriterEncoder e) { super.encode(e); e.encode(getScope()); e.encode(getValue()); e.encode(getLocalVar()); }
LocalVariable lv = ((StoreLocalVarInstr)i).getLocalVar(); if (!lv.isSelf()) reqdLoads.add(lv); } else {
/** * getLocalVar is saved for location and should not be simplified so we still know its original * depth/offset. */ @Override public void simplifyOperands(Map<Operand, Operand> valueMap, boolean force) { setOperand1(getValue().getSimplifiedOperand(valueMap, force)); }
public void decrementLVarScopeDepth() { setOperand2(getLocalVar().cloneForDepth(getLocalVar().getScopeDepth()-1)); }
if (slvi.getLocalVar() == lv) { instrs.remove(); if (slvi.getLocalVar() == lv) { slvi.decrementLVarScopeDepth();
case B_UNDEF: return BUndefInstr.decode(this); case BINDING_LOAD: return LoadLocalVarInstr.decode(this); case BINDING_STORE: return StoreLocalVarInstr.decode(this); case BLOCK_GIVEN: return BlockGivenInstr.decode(this); case BNE: return BNEInstr.decode(this);
IRBytecodeAdapter m = jvmMethod(); jvmLoadLocal(DYNAMIC_SCOPE); int depth = storelocalvarinstr.getLocalVar().getScopeDepth(); int location = storelocalvarinstr.getLocalVar().getLocation(); Operand storeValue = storelocalvarinstr.getValue(); switch (depth) { case 0: