@Override public Instr clone(CloneInfo ii) { return new PutFieldInstr(getTarget().cloneForInlining(ii), getName(), getValue().cloneForInlining(ii)); }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { IRubyObject object = (IRubyObject) getTarget().retrieve(context, self, currScope, currDynScope, temp); VariableAccessor a = getAccessor(object); Object value = getValue().retrieve(context, self, currScope, currDynScope, temp); a.set(object, value); return null; }
@Override public Instr cloneForInlining(InlinerInfo ii) { return new PutFieldInstr(operands[TARGET].cloneForInlining(ii), ref, operands[VALUE].cloneForInlining(ii)); }
/** * Additional metadata about this method. */ public MethodData getMethodData() { if (methodData == null) { List<String> ivarNames = new ArrayList<>(); InterpreterContext context = ensureInstrsReady(); for (Instr i : context.getInstructions()) { switch (i.getOperation()) { case GET_FIELD: ivarNames.add(((GetFieldInstr) i).getId()); break; case PUT_FIELD: ivarNames.add(((PutFieldInstr) i).getId()); break; } } methodData = new MethodData(method.getId(), method.getFile(), ivarNames); } return methodData; } }
case PUT_CONST: return PutConstInstr.decode(this); case PUT_CVAR: return PutClassVariableInstr.decode(this); case PUT_FIELD: return PutFieldInstr.decode(this); case PUT_GLOBAL_VAR: return PutGlobalVarInstr.decode(this); case RAISE_ARGUMENT_ERROR: return RaiseArgumentErrorInstr.decode(this);
@Override public Instr cloneForInlining(InlinerInfo ii) { return new PutFieldInstr(operands[TARGET].cloneForInlining(ii), ref, operands[VALUE].cloneForInlining(ii)); }
/** * Additional metadata about this method. */ public MethodData getMethodData() { if (methodData == null) { List<String> ivarNames = new ArrayList<>(); InterpreterContext context = ensureInstrsReady(); for (Instr i : context.getInstructions()) { switch (i.getOperation()) { case GET_FIELD: ivarNames.add(((GetFieldInstr) i).getId()); break; case PUT_FIELD: ivarNames.add(((PutFieldInstr) i).getId()); break; } } methodData = new MethodData(method.getId(), method.getFile(), ivarNames); } return methodData; } }
case PUT_CONST: return PutConstInstr.decode(this); case PUT_CVAR: return PutClassVariableInstr.decode(this); case PUT_FIELD: return PutFieldInstr.decode(this); case PUT_GLOBAL_VAR: return PutGlobalVarInstr.decode(this); case RAISE_ARGUMENT_ERROR: return RaiseArgumentErrorInstr.decode(this);
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { IRubyObject object = (IRubyObject) getTarget().retrieve(context, self, currDynScope, temp); // FIXME: Why getRealClass? Document RubyClass clazz = object.getMetaClass().getRealClass(); // FIXME: Should add this as a field for instruction clazz.getVariableAccessorForWrite(getRef()).set(object, getValue().retrieve(context, self, currDynScope, temp)); return null; }
@Override public Instr clone(CloneInfo ii) { return new PutFieldInstr(getTarget().cloneForInlining(ii), getName(), getValue().cloneForInlining(ii)); }
public static PutFieldInstr decode(IRReaderDecoder d) { return new PutFieldInstr(d.decodeOperand(), d.decodeSymbol(), d.decodeOperand()); }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { IRubyObject object = (IRubyObject) getTarget().retrieve(context, self, currScope, currDynScope, temp); VariableAccessor a = getAccessor(object); Object value = getValue().retrieve(context, self, currScope, currDynScope, temp); a.set(object, value); return null; }
public VariableAccessor getAccessor(IRubyObject o) { RubyClass cls = o.getMetaClass().getRealClass(); VariableAccessor localAccessor = accessor; if (localAccessor.getClassId() != cls.hashCode()) { localAccessor = cls.getVariableAccessorForWrite(getId()); accessor = localAccessor; } return localAccessor; }
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { IRubyObject object = (IRubyObject) getTarget().retrieve(context, self, currDynScope, temp); // FIXME: Why getRealClass? Document RubyClass clazz = object.getMetaClass().getRealClass(); // FIXME: Should add this as a field for instruction clazz.getVariableAccessorForWrite(getRef()).set(object, getValue().retrieve(context, self, currDynScope, temp)); return null; }
public static PutFieldInstr decode(IRReaderDecoder d) { return new PutFieldInstr(d.decodeOperand(), d.decodeSymbol(), d.decodeOperand()); }
public VariableAccessor getAccessor(IRubyObject o) { RubyClass cls = o.getMetaClass().getRealClass(); VariableAccessor localAccessor = accessor; if (localAccessor.getClassId() != cls.hashCode()) { localAccessor = cls.getVariableAccessorForWrite(getId()); accessor = localAccessor; } return localAccessor; }