示例#1
0
 @ExplodeLoop
 @Override
 public void executeVoid(VirtualFrame frame) {
   for (RubyNode value : values) {
     value.executeVoid(frame);
   }
 }
示例#2
0
  @ExplodeLoop
  @Override
  public Object isDefined(VirtualFrame frame) {
    for (RubyNode value : values) {
      if (value.isDefined(frame) == getContext().getCoreLibrary().getNilObject()) {
        return getContext().getCoreLibrary().getNilObject();
      }
    }

    return super.isDefined(frame);
  }
示例#3
0
  @Override
  public Object execute(VirtualFrame frame) {
    // TODO(cs): can module ever not evaluate to a RubyModule?

    final RubyModule moduleObject = (RubyModule) module.execute(frame);

    final Object rhsValue = rhs.execute(frame);

    assert rhsValue != null;
    assert !(rhsValue instanceof String);

    moduleObject.setModuleConstant(name, rhsValue);

    return rhsValue;
  }
示例#4
0
文件: TryNode.java 项目: godfat/jruby
  @Override
  public Object execute(VirtualFrame frame) {
    while (true) {
      getContext().getSafepointManager().poll();

      Object result;

      try {
        result = tryPart.execute(frame);
      } catch (ControlFlowException exception) {
        controlFlowProfile.enter();
        throw exception;
      } catch (RaiseException exception) {
        raiseExceptionProfile.enter();

        try {
          return handleException(frame, exception);
        } catch (RetryException e) {
          continue;
        }
      } finally {
        clearExceptionVariableNode.execute(frame);
      }

      elseProfile.enter();
      elsePart.executeVoid(frame);
      return result;
    }
  }
示例#5
0
 @Override
 public Object execute(VirtualFrame frame) {
   if (CompilerDirectives.injectBranchProbability(
       getBranchProbability(), condition.executeBoolean(frame))) {
     if (CompilerDirectives.inInterpreter()) {
       thenCount++;
     }
     thenProfile.enter();
     return thenBody.execute(frame);
   } else {
     if (CompilerDirectives.inInterpreter()) {
       elseCount++;
     }
     elseProfile.enter();
     return elseBody.execute(frame);
   }
 }
 @Override
 public Object execute(VirtualFrame frame) {
   if (RubyArguments.getUserArgumentsCount(frame.getArguments()) < minimum) {
     defaultValueProfile.enter();
     return defaultValue.execute(frame);
   } else {
     return RubyArguments.getUserArgument(frame.getArguments(), index);
   }
 }
示例#7
0
  @Override
  public Object execute(VirtualFrame frame) {
    while (true) {
      try {
        final Object result = tryPart.execute(frame);
        elsePart.executeVoid(frame);
        return result;
      } catch (ControlFlowException exception) {
        controlFlowProfile.enter();

        throw exception;
      } catch (RuntimeException exception) {
        CompilerDirectives.transferToInterpreter();

        try {
          return handleException(frame, exception);
        } catch (RetryException e) {
          continue;
        }
      }
    }
  }
示例#8
0
  @Override
  public RubyBasicObject executeRubyBasicObject(VirtualFrame frame) {
    final Object object = child.execute(frame);

    RubyBasicObject boxedObject;

    if (object instanceof RubyBasicObject) {
      boxedObject = (RubyBasicObject) object;
    } else {
      boxBranch.enter();
      boxedObject = getContext().getCoreLibrary().box(object);
    }

    return boxedObject;
  }