/** * 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; } }
public VariableAccessor getAccessor(IRubyObject o) { RubyClass cls = o.getMetaClass().getRealClass(); VariableAccessor localAccessor = accessor; if (localAccessor.getClassId() != cls.hashCode()) { localAccessor = cls.getVariableAccessorForRead(getId()); accessor = localAccessor; } return localAccessor; }
/** * 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; } }
public VariableAccessor getAccessor(IRubyObject o) { RubyClass cls = o.getMetaClass().getRealClass(); VariableAccessor localAccessor = accessor; if (localAccessor.getClassId() != cls.hashCode()) { localAccessor = cls.getVariableAccessorForRead(getId()); accessor = localAccessor; } return localAccessor; }
@Override public void GetFieldInstr(GetFieldInstr getfieldinstr) { visit(getfieldinstr.getSource()); jvmMethod().getField(getfieldinstr.getId()); jvmStoreLocal(getfieldinstr.getResult()); }
@Override public void GetFieldInstr(GetFieldInstr getfieldinstr) { visit(getfieldinstr.getSource()); jvmMethod().getField(getfieldinstr.getId()); jvmStoreLocal(getfieldinstr.getResult()); }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { IRubyObject object = (IRubyObject) getSource().retrieve(context, self, currScope, currDynScope, temp); VariableAccessor a = getAccessor(object); Object result = a == null ? null : (IRubyObject)a.get(object); if (result == null) { Ruby runtime = context.runtime; if (runtime.isVerbose()) { runtime.getWarnings().warning(IVAR_NOT_INITIALIZED, str(runtime, "instance variable ", ids(runtime, getId()), " not initialized")); } result = context.nil; } return result; }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { IRubyObject object = (IRubyObject) getSource().retrieve(context, self, currScope, currDynScope, temp); VariableAccessor a = getAccessor(object); Object result = a == null ? null : (IRubyObject)a.get(object); if (result == null) { Ruby runtime = context.runtime; if (runtime.isVerbose()) { runtime.getWarnings().warning(IVAR_NOT_INITIALIZED, str(runtime, "instance variable ", ids(runtime, getId()), " not initialized")); } result = context.nil; } return result; }
if (context.runtime.isVerbose()) { context.runtime.getWarnings().warning(IRubyWarnings.ID.IVAR_NOT_INITIALIZED, str(context.runtime, "instance variable ", ids(context.runtime, gfi.getId()), " not initialized"));
if (context.runtime.isVerbose()) { context.runtime.getWarnings().warning(IRubyWarnings.ID.IVAR_NOT_INITIALIZED, str(context.runtime, "instance variable ", ids(context.runtime, gfi.getId()), " not initialized"));