Ejemplo n.º 1
0
 @Specialization
 public Object callNamedFunctionWithPackage(
     String name, RArgsValuesAndNames args, String packageName) {
   controlVisibility();
   SymbolInfo symbolInfo = DLL.findSymbolInfo(name, packageName);
   if (symbolInfo == null) {
     errorProfile.enter();
     throw RError.error(this, Message.C_SYMBOL_NOT_IN_TABLE, name);
   }
   return RFFIFactory.getRFFI()
       .getCallRFFI()
       .invokeCall(symbolInfo.address, symbolInfo.symbol, args.getArguments());
 }
Ejemplo n.º 2
0
 @Specialization
 public Object callNamedFunctionWithPackage(
     String name, RArgsValuesAndNames args, String packageName) {
   controlVisibility();
   SymbolInfo symbolInfo = DLL.findSymbolInfo(name, packageName);
   if (symbolInfo == null) {
     errorProfile.enter();
     throw RError.error(this, Message.C_SYMBOL_NOT_IN_TABLE, name);
   }
   Object list = encodeArgumentPairList(args, symbolInfo.symbol);
   // TODO: provide proper values for the CALL, OP and RHO parameters
   return RFFIFactory.getRFFI()
       .getCallRFFI()
       .invokeCall(symbolInfo.address, symbolInfo.symbol, new Object[] {CALL, OP, list, RHO});
 }
Ejemplo n.º 3
0
 protected RuntimeException fallback(Object fobj) {
   String name = null;
   if (fobj instanceof RList) {
     name = lookupName((RList) fobj);
     name = name == UNKNOWN_EXTERNAL_BUILTIN ? null : name;
     if (name != null && lookupBuiltin((RList) fobj) != null) {
       /*
        * if we reach this point, then the cache saw a different value for f. the lists
        * that contain the information about native calls are never expected to change.
        */
       throw RInternalError.shouldNotReachHere(
           "fallback reached for " + getRBuiltin().name() + " " + name);
     }
   }
   throw RError.nyi(
       this,
       getRBuiltin().name() + " specialization failure: " + (name == null ? "<unknown>" : name));
 }
Ejemplo n.º 4
0
 @Specialization
 protected RList c(
     String f,
     RArgsValuesAndNames args,
     byte naok,
     byte dup,
     @SuppressWarnings("unused") RMissing rPackage,
     @SuppressWarnings("unused") RMissing encoding, //
     @Cached("create()") BranchProfile errorProfile) {
   controlVisibility();
   SymbolInfo symbolInfo = DLL.findRegisteredSymbolinInDLL(f, null, "");
   if (symbolInfo == null) {
     errorProfile.enter();
     throw RError.error(this, RError.Message.C_SYMBOL_NOT_IN_TABLE, f);
   }
   return DotC.dispatch(
       this, symbolInfo.address, symbolInfo.symbol, naok, dup, args.getArguments());
 }
Ejemplo n.º 5
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);
 }