@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); }
@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(); } }
@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; }
@SuppressWarnings("unused") @Specialization protected RNull resetCondHands(Object stack) { // TODO throw RInternalError.unimplemented(); }
@Override public final Object call(RArgsValuesAndNames args) { throw RInternalError.unimplemented("unimplemented external builtin: " + name); }
@Override public byte[] readBinChars() throws IOException { throw RInternalError.unimplemented(); }
@Override public int readBin(ByteBuffer buffer) throws IOException { throw RInternalError.unimplemented(); }
@Override public String readChar(int nchars, boolean useBytes) throws IOException { throw RInternalError.unimplemented(); }
@Override public void writeChar(String s, int pad, String eos, boolean useBytes) throws IOException { throw RInternalError.unimplemented(); }
@Override public void writeString(String s, boolean nl) throws IOException { throw RInternalError.unimplemented(); }
@Override public OutputStream getOutputStream() throws IOException { throw RInternalError.unimplemented(); }