Esempio n. 1
0
 @Specialization
 protected Object getDimNames(RAbstractContainer container) {
   controlVisibility();
   RList names;
   if (container instanceof RDataFrame) {
     dataframeProfile.enter();
     names = ((RDataFrame) container).getVector().getDimNames();
   } else if (container instanceof RFactor) {
     factorProfile.enter();
     names = ((RFactor) container).getVector().getDimNames();
   } else {
     otherProfile.enter();
     names = container.getDimNames(attrProfiles);
   }
   return nullProfile.profile(names == null) ? RNull.instance : names;
 }
Esempio 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);
   }
   return RFFIFactory.getRFFI()
       .getCallRFFI()
       .invokeCall(symbolInfo.address, symbolInfo.symbol, args.getArguments());
 }
Esempio n. 3
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});
 }
Esempio 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());
 }
Esempio n. 5
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;
 }