Exemplo n.º 1
0
 @ExplodeLoop
 @Override
 public void executeVoid(VirtualFrame frame) {
   for (RubyNode value : values) {
     value.executeVoid(frame);
   }
 }
Exemplo n.º 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);
  }
Exemplo n.º 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;
  }
Exemplo n.º 4
0
  @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;
    }
  }
Exemplo n.º 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);
   }
 }
Exemplo n.º 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;
        }
      }
    }
  }
Exemplo n.º 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;
  }