예제 #1
0
파일: Internal.java 프로젝트: graalvm/fastr
  @Specialization
  protected Object doInternal(VirtualFrame frame, RPromise x) {
    if (builtinCallNode == null) {
      RNode call = (RNode) x.getRep();
      RNode operand = (RNode) RASTUtils.unwrap(call);

      if (!(operand instanceof RCallNode)) {
        errorProfile.enter();
        throw RError.error(this, RError.Message.INVALID_INTERNAL);
      }

      RCallNode callNode = (RCallNode) operand;
      RNode func = callNode.getFunctionNode();
      String name = ((ReadVariableNode) func).getIdentifier();
      RFunction function = RContext.lookupBuiltin(name);
      if (function == null
          || function.isBuiltin() && function.getRBuiltin().getKind() != RBuiltinKind.INTERNAL) {
        errorProfile.enter();
        if (function == null && notImplemented(name)) {
          throw RInternalError.unimplemented(".Internal " + name);
        }
        throw RError.error(this, RError.Message.NO_SUCH_INTERNAL, name);
      }

      // .Internal function is validated
      CompilerDirectives.transferToInterpreterAndInvalidate();
      builtinCallNode = insert(RCallNode.createInternalCall(callNode, function));
    }
    return builtinCallNode.execute(frame);
  }
예제 #2
0
 @Override
 public Object getRelementImpl(int index) {
   if (index == 0) {
     String name = getBuiltin().getName();
     assert name == name.intern();
     return RDataFactory.createSymbol(name);
   } else {
     throw RInternalError.unimplemented();
   }
 }
예제 #3
0
 @Override
 public long seek(long offset, SeekMode seekMode, SeekRWMode seekRWMode) throws IOException {
   long position = inputStream.getChannel().position();
   switch (seekMode) {
     case ENQUIRE:
       break;
     case CURRENT:
       if (offset != 0) {
         inputStream.getChannel().position(position + offset);
       }
       break;
     case START:
       inputStream.getChannel().position(offset);
       break;
     case END:
       throw RInternalError.unimplemented();
   }
   return position;
 }
예제 #4
0
 @SuppressWarnings("unused")
 @Specialization
 protected RNull resetCondHands(Object stack) {
   // TODO
   throw RInternalError.unimplemented();
 }
예제 #5
0
 @Override
 public final Object call(RArgsValuesAndNames args) {
   throw RInternalError.unimplemented("unimplemented external builtin: " + name);
 }
예제 #6
0
 @Override
 public byte[] readBinChars() throws IOException {
   throw RInternalError.unimplemented();
 }
예제 #7
0
 @Override
 public int readBin(ByteBuffer buffer) throws IOException {
   throw RInternalError.unimplemented();
 }
예제 #8
0
 @Override
 public String readChar(int nchars, boolean useBytes) throws IOException {
   throw RInternalError.unimplemented();
 }
예제 #9
0
 @Override
 public void writeChar(String s, int pad, String eos, boolean useBytes) throws IOException {
   throw RInternalError.unimplemented();
 }
예제 #10
0
 @Override
 public void writeString(String s, boolean nl) throws IOException {
   throw RInternalError.unimplemented();
 }
예제 #11
0
 @Override
 public OutputStream getOutputStream() throws IOException {
   throw RInternalError.unimplemented();
 }