protected String getNameFromSymbolInfo(VirtualFrame frame, RList symbol) { if (nameExtract == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); nameExtract = ExtractVectorNode.create(ElementAccessMode.SUBSCRIPT, true); } return RRuntime.asString(nameExtract.applyAccessField(frame, symbol, "name")); }
protected long getAddressFromSymbolInfo(VirtualFrame frame, RList symbol) { if (addressExtract == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); addressExtract = ExtractVectorNode.create(ElementAccessMode.SUBSCRIPT, true); } return ((RExternalPtr) addressExtract.applyAccessField(frame, symbol, "address")).getAddr(); }
@SuppressWarnings("unused") @Specialization protected Object updateLengthError(Object vector, Object lengthVector) { controlVisibility(); CompilerDirectives.transferToInterpreter(); throw RError.error(this, RError.Message.INVALID_UNNAMED_VALUE); }
@Specialization public Object methodMissing(RubyBasicObject self, Object[] args, RubyProc block) { notDesignedForCompilation(); CompilerDirectives.transferToInterpreter(); final RubySymbol name = (RubySymbol) args[0]; final Object[] sentArgs = Arrays.copyOfRange(args, 1, args.length); return methodMissing(self, name, sentArgs, block); }
@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); } }
@Specialization public Object methodMissing( RubyBasicObject self, Object[] args, @SuppressWarnings("unused") UndefinedPlaceholder block) { notDesignedForCompilation(); CompilerDirectives.transferToInterpreter(); final RubySymbol name = (RubySymbol) args[0]; final Object[] sentArgs = Arrays.copyOfRange(args, 1, args.length); return methodMissing(self, name, sentArgs, null); }
@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); }