From 153592f1cce11a1e375ce0d4233e6e912e292b16 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 9 Aug 2015 02:25:58 +0300 Subject: [PATCH] Naming. --- artiq/compiler/transforms/llvm_ir_generator.py | 6 +++--- soc/runtime/ksupport.c | 16 ++++++++-------- soc/runtime/ksupport.h | 2 +- soc/runtime/messages.h | 4 ++-- soc/runtime/session.c | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/artiq/compiler/transforms/llvm_ir_generator.py b/artiq/compiler/transforms/llvm_ir_generator.py index ca6e8da35..9928c560f 100644 --- a/artiq/compiler/transforms/llvm_ir_generator.py +++ b/artiq/compiler/transforms/llvm_ir_generator.py @@ -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): diff --git a/soc/runtime/ksupport.c b/soc/runtime/ksupport.c index 9a866908c..187e33220 100644 --- a/soc/runtime/ksupport.c +++ b/soc/runtime/ksupport.c @@ -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); // } } diff --git a/soc/runtime/ksupport.h b/soc/runtime/ksupport.h index 41561330f..2aa83ce63 100644 --- a/soc/runtime/ksupport.h +++ b/soc/runtime/ksupport.h @@ -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, ...); diff --git a/soc/runtime/messages.h b/soc/runtime/messages.h index 55d53aca9..46294f8e6 100644 --- a/soc/runtime/messages.h +++ b/soc/runtime/messages.h @@ -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; diff --git a/soc/runtime/session.c b/soc/runtime/session.c index eadaa1990..f5e846477 100644 --- a/soc/runtime/session.c +++ b/soc/runtime/session.c @@ -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");