protected IRubyObject[] prepareArgumentsSimple(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { IRubyObject[] newArgs = new IRubyObject[argsCount]; for (int i = 0; i < argsCount; i++) { // receiver is operands[0] newArgs[i] = (IRubyObject) operands[i+1].retrieve(context, self, currScope, currDynScope, temp); } return newArgs; }
@Override public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { Object val = array.retrieve(context, self, currScope, currDynScope, temp); return (val instanceof RubyArray) ? val : context.nil; }
public IRubyObject[] retrieveArrayElts(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { IRubyObject[] elements = new IRubyObject[elts.length]; for (int i = 0; i < elements.length; i++) { elements[i] = (IRubyObject) elts[i].retrieve(context, self, currScope, currDynScope, temp); } return elements; }
private RubyString[] retrievePieces(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { Operand[] operands = getOperands(); int length = operands.length; RubyString[] strings = new RubyString[length]; for (int i = 0; i < length; i++) { strings[i] = (RubyString) operands[i].retrieve(context, self, currScope, currDynScope, temp); } return strings; }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { IRubyObject excType = (IRubyObject) getArg1().retrieve(context, self, currScope, currDynScope, temp); Object excObj = getArg2().retrieve(context, self, currScope, currDynScope, temp); return IRRuntimeHelpers.isExceptionHandled(context, excType, excObj); }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { StaticScope scope = (StaticScope) getStartingScope().retrieve(context, self, currScope, currDynScope, temp); Operand object = getObject(); IRubyObject arg = object == null ? null : (IRubyObject) object.retrieve(context, self, currScope, currDynScope, temp); return IRRuntimeHelpers.getModuleFromScope(context, scope, arg); }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { Object container = getContainer().retrieve(context, self, currScope, currDynScope, temp); Object superClass = getSuperClass().retrieve(context, self, currScope, currDynScope, temp); return IRRuntimeHelpers.newInterpretedClassBody(context, newIRClassBody, container, superClass); }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { String newNameString = getNewName().retrieve(context, self, currScope, currDynScope, temp).toString(); String oldNameString = getOldName().retrieve(context, self, currScope, currDynScope, temp).toString(); context.runtime.getGlobalVariables().alias(newNameString, oldNameString); return null; }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); IRubyObject arg1 = (IRubyObject) getArg1().retrieve(context, self, currScope, dynamicScope, temp); return getCallSite().call(context, self, object, arg1); } }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { RubyArray args = (RubyArray) getArgsArray().retrieve(context, self, currScope, currDynScope, temp); Helpers.irCheckArgsArrayArity(context, args, required, opt, rest); return null; }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { return IRRuntimeHelpers.irToAry(context, (IRubyObject) getArray().retrieve(context, self, currScope, currDynScope, temp)); }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { return IRRuntimeHelpers.splatArray(context, (IRubyObject) getArray().retrieve(context, self, currScope, currDynScope, temp), getDup()); }
@Override public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc) { Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp); return value1 == UndefinedValue.UNDEFINED ? getJumpTarget().getTargetPC() : ipc; }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); IRubyObject[] values = prepareArguments(context, self, currScope, dynamicScope, temp); callSite.call(context, self, object, values); return null; }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); return getCallSite().call(context, self, object); } }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); return getCallSite().call(context, self, object, fixNum); } }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); return getCallSite().call(context, self, object, flote); } }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) { // NOTE: This logic shouod always match the CALL_10B logic in InterpreterEngine.processCall IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp); IRubyObject arg1 = (IRubyObject) getArg1().retrieve(context, self, currScope, dynamicScope, temp); Block preparedBlock = prepareBlock(context, self, currScope, dynamicScope, temp); if (hasLiteralClosure()) { return getCallSite().callIter(context, self, object, arg1, preparedBlock); } return getCallSite().call(context, self, object, arg1, preparedBlock); } }
@Override public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc) { Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp); return ((IRubyObject)value1).isTrue() ? getJumpTarget().getTargetPC() : ipc; } }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { IRubyObject[] args = prepareArguments(context, self, currScope, currDynScope, temp); Block block = prepareBlock(context, self, currScope, currDynScope, temp); RubyModule definingModule = (RubyModule) getDefiningModule().retrieve(context, self, currScope, currDynScope, temp); return IRRuntimeHelpers.classSuper(context, self, getId(), definingModule, args, block); }