Ejemplo n.º 1
0
 @Override
 public boolean computeScopeFlags(IRScope scope) {
   // CON: No native [] impls require backref/lastline for a literal String arg,
   // so we don't have to deopt frame here.
   super.computeScopeFlags(scope);
   return true;
 }
Ejemplo n.º 2
0
 private static void processCall(
     ThreadContext context,
     Instr instr,
     Operation operation,
     IRScope scope,
     DynamicScope currDynScope,
     Object[] temp,
     IRubyObject self,
     Block block,
     Block.Type blockType) {
   Object result = null;
   switch (operation) {
     case RUNTIME_HELPER:
       {
         RuntimeHelperCall rhc = (RuntimeHelperCall) instr;
         result = rhc.callHelper(context, currDynScope, self, temp, scope, blockType);
         setResult(temp, currDynScope, rhc.getResult(), result);
         break;
       }
     case CALL_1F:
       {
         OneFixnumArgNoBlockCallInstr call = (OneFixnumArgNoBlockCallInstr) instr;
         IRubyObject r =
             (IRubyObject) retrieveOp(call.getReceiver(), context, self, currDynScope, temp);
         result = call.getCallSite().call(context, self, r, call.getFixnumArg());
         setResult(temp, currDynScope, call.getResult(), result);
         break;
       }
     case CALL_1O:
       {
         OneOperandArgNoBlockCallInstr call = (OneOperandArgNoBlockCallInstr) instr;
         IRubyObject r =
             (IRubyObject) retrieveOp(call.getReceiver(), context, self, currDynScope, temp);
         IRubyObject o = (IRubyObject) call.getArg1().retrieve(context, self, currDynScope, temp);
         result = call.getCallSite().call(context, self, r, o);
         setResult(temp, currDynScope, call.getResult(), result);
         break;
       }
     case CALL_0O:
       {
         ZeroOperandArgNoBlockCallInstr call = (ZeroOperandArgNoBlockCallInstr) instr;
         IRubyObject r =
             (IRubyObject) retrieveOp(call.getReceiver(), context, self, currDynScope, temp);
         result = call.getCallSite().call(context, self, r);
         setResult(temp, currDynScope, call.getResult(), result);
         break;
       }
     case NORESULT_CALL_1O:
       {
         OneOperandArgNoBlockNoResultCallInstr call =
             (OneOperandArgNoBlockNoResultCallInstr) instr;
         IRubyObject r =
             (IRubyObject) retrieveOp(call.getReceiver(), context, self, currDynScope, temp);
         IRubyObject o = (IRubyObject) call.getArg1().retrieve(context, self, currDynScope, temp);
         call.getCallSite().call(context, self, r, o);
         break;
       }
     case NORESULT_CALL:
       instr.interpret(context, currDynScope, self, temp, block);
       break;
     case CALL:
     default:
       result = instr.interpret(context, currDynScope, self, temp, block);
       setResult(temp, currDynScope, instr, result);
       break;
   }
 }