Пример #1
0
 @Override
 public void execute(VirtualFrame frame, Object value) {
   CompilerDirectives.transferToInterpreterAndInvalidate();
   MaterializedFrame enclosingFrame = RArguments.getEnclosingFrame(frame);
   if (enclosingFrame != null) {
     execute(frame, value, enclosingFrame);
   } else {
     // we're in global scope, do a local write instead
     replace(UnresolvedWriteLocalFrameVariableNodeGen.create(getRhs(), symbol, mode))
         .execute(frame, value);
   }
 }
Пример #2
0
 @Specialization
 protected int doNArgs(VirtualFrame frame) {
   int result = 0;
   if (RArguments.getFunction(frame) == null) {
     return RRuntime.INT_NA;
   }
   int l = RArguments.getArgumentsLength(frame);
   for (int i = 0; i < l; i++) {
     Object arg = RArguments.getArgument(frame, i);
     if (arg instanceof RPromise) {
       isPromiseProfile.enter();
       RPromise promise = (RPromise) arg;
       if (!promise.isDefault()) {
         result++;
       }
     } else if (arg instanceof RArgsValuesAndNames) {
       result += ((RArgsValuesAndNames) arg).getLength();
     } else if (!(arg instanceof RMissing)) {
       result++;
     }
   }
   return result;
 }
Пример #3
0
 @Override
 public void execute(VirtualFrame frame, Object value, MaterializedFrame enclosingFrame) {
   MaterializedFrame profiledEnclosingFrame = enclosingFrameProfile.profile(enclosingFrame);
   if (hasValueProfile.profile(writeNode.getFrameSlotNode().hasValue(profiledEnclosingFrame))) {
     writeNode.execute(frame, value, profiledEnclosingFrame);
   } else {
     MaterializedFrame superFrame = RArguments.getEnclosingFrame(profiledEnclosingFrame);
     if (nullSuperFrameProfile.profile(superFrame == null)) {
       // Might be the case if "{ x <<- 42 }": This is in globalEnv!
       superFrame = REnvironment.globalEnv().getFrame();
     }
     nextNode.execute(frame, value, superFrame);
   }
 }
Пример #4
0
 @Override
 public void execute(VirtualFrame frame, Object value, MaterializedFrame enclosingFrame) {
   CompilerDirectives.transferToInterpreterAndInvalidate();
   if (getName().isEmpty()) {
     throw RError.error(this, RError.Message.ZERO_LENGTH_VARIABLE);
   }
   final WriteSuperFrameVariableNodeHelper writeNode;
   if (REnvironment.isGlobalEnvFrame(enclosingFrame)) {
     /*
      * we've reached the global scope, do unconditional write. if this is the first node
      * in the chain, needs the rhs and enclosingFrame nodes
      */
     AccessEnclosingFrameNode enclosingFrameNode =
         RArguments.getEnclosingFrame(frame) == enclosingFrame
             ? new AccessEnclosingFrameNode()
             : null;
     writeNode =
         WriteSuperFrameVariableNodeGen.create(
             getRhs(),
             enclosingFrameNode,
             FrameSlotNode.create(
                 findOrAddFrameSlot(
                     enclosingFrame.getFrameDescriptor(), symbol, FrameSlotKind.Illegal)),
             getName(),
             mode);
   } else {
     WriteSuperFrameVariableNode actualWriteNode =
         WriteSuperFrameVariableNodeGen.create(
             null, null, FrameSlotNode.create(symbol), this.getName(), mode);
     writeNode =
         new WriteSuperFrameVariableConditionalNode(
             actualWriteNode,
             new UnresolvedWriteSuperFrameVariableNode(symbol, null, mode),
             getRhs());
   }
   replace(writeNode).execute(frame, value, enclosingFrame);
 }
Пример #5
0
 @Override
 public void execute(VirtualFrame frame, Object value) {
   assert RArguments.getEnclosingFrame(frame) != null;
   execute(frame, value, RArguments.getEnclosingFrame(frame));
 }