forked from M-Labs/artiq
1
0
Fork 0
This commit is contained in:
whitequark 2015-08-09 02:25:58 +03:00
parent b26af5df60
commit 153592f1cc
5 changed files with 17 additions and 17 deletions

View File

@ -153,7 +153,7 @@ class LLVMIRGenerator:
llty = ll.FunctionType(ll.VoidType(), [self.llty_of_type(builtins.TException())])
elif name == "__artiq_reraise":
llty = ll.FunctionType(ll.VoidType(), [])
elif name == "rpc":
elif name == "send_rpc":
llty = ll.FunctionType(ll.IntType(32), [ll.IntType(32), ll.IntType(8).as_pointer()],
var_arg=True)
else:
@ -609,7 +609,7 @@ class LLVMIRGenerator:
tag += self._rpc_tag(arg.type, arg.type, None)
else:
tag += self._rpc_tag(arg.type, arg.type, arg.loc)
tag += b":\x00"
tag += b"\x00"
lltag = self.llconst_of_const(ir.Constant(tag, builtins.TStr()))
llargs = []
@ -619,7 +619,7 @@ class LLVMIRGenerator:
self.llbuilder.store(llarg, llargslot)
llargs.append(llargslot)
return self.llbuiltin("rpc"), [llservice, lltag] + llargs
return self.llbuiltin("send_rpc"), [llservice, lltag] + llargs
def prepare_call(self, insn):
if types.is_rpc_function(insn.target_function().type):

View File

@ -92,7 +92,7 @@ static const struct symbol runtime_exports[] = {
{"log", &log},
{"lognonl", &lognonl},
{"rpc", &rpc},
{"send_rpc", &send_rpc},
/* direct syscalls */
{"rtio_get_counter", &rtio_get_counter},
@ -301,19 +301,19 @@ void watchdog_clear(int id)
mailbox_send_and_wait(&request);
}
int rpc(int service, const char *tag, ...)
int send_rpc(int service, const char *tag, ...)
{
struct msg_rpc_send_request request;
struct msg_base *reply;
struct msg_rpc_send request;
request.type = MESSAGE_TYPE_RPC_SEND_REQUEST;
request.type = MESSAGE_TYPE_RPC_SEND;
request.service = service;
request.tag = tag;
va_start(request.args, tag);
mailbox_send_and_wait(&request);
va_end(request.args);
reply = mailbox_wait_and_receive();
// struct msg_base *reply;
// reply = mailbox_wait_and_receive();
// if(reply->type == MESSAGE_TYPE_RPC_REPLY) {
// int result = ((struct msg_rpc_reply *)reply)->result;
// mailbox_acknowledge();
@ -325,8 +325,8 @@ int rpc(int service, const char *tag, ...)
// mailbox_acknowledge();
// __artiq_raise(&exception);
// } else {
log("Malformed MESSAGE_TYPE_RPC_REQUEST reply type %d",
reply->type);
// log("Malformed MESSAGE_TYPE_RPC_REQUEST reply type %d",
// reply->type);
while(1);
// }
}

View File

@ -5,7 +5,7 @@ long long int now_init(void);
void now_save(long long int now);
int watchdog_set(int ms);
void watchdog_clear(int id);
int rpc(int service, const char *tag, ...);
int send_rpc(int service, const char *tag, ...);
void lognonl(const char *fmt, ...);
void log(const char *fmt, ...);

View File

@ -14,7 +14,7 @@ enum {
MESSAGE_TYPE_WATCHDOG_SET_REQUEST,
MESSAGE_TYPE_WATCHDOG_SET_REPLY,
MESSAGE_TYPE_WATCHDOG_CLEAR,
MESSAGE_TYPE_RPC_SEND_REQUEST,
MESSAGE_TYPE_RPC_SEND,
MESSAGE_TYPE_RPC_RECV_REQUEST,
MESSAGE_TYPE_RPC_RECV_REPLY,
MESSAGE_TYPE_RPC_EXCEPTION,
@ -81,7 +81,7 @@ struct msg_watchdog_clear {
int id;
};
struct msg_rpc_send_request {
struct msg_rpc_send {
int type;
int service;
const char *tag;

View File

@ -650,7 +650,7 @@ static int send_rpc_request(int service, const char *tag, va_list args)
out_packet_start(REMOTEMSG_TYPE_RPC_REQUEST);
out_packet_int32(service);
while(*tag != ':') {
while(*tag) {
void *value = va_arg(args, void*);
if(!kloader_validate_kpointer(value))
return 0;
@ -735,8 +735,8 @@ static int process_kmsg(struct msg_base *umsg)
break;
}
case MESSAGE_TYPE_RPC_SEND_REQUEST: {
struct msg_rpc_send_request *msg = (struct msg_rpc_send_request *)umsg;
case MESSAGE_TYPE_RPC_SEND: {
struct msg_rpc_send *msg = (struct msg_rpc_send *)umsg;
if(!send_rpc_request(msg->service, msg->tag, msg->args)) {
log("Failed to send RPC request");