forked from M-Labs/artiq
Naming.
This commit is contained in:
parent
b26af5df60
commit
153592f1cc
@ -153,7 +153,7 @@ class LLVMIRGenerator:
|
|||||||
llty = ll.FunctionType(ll.VoidType(), [self.llty_of_type(builtins.TException())])
|
llty = ll.FunctionType(ll.VoidType(), [self.llty_of_type(builtins.TException())])
|
||||||
elif name == "__artiq_reraise":
|
elif name == "__artiq_reraise":
|
||||||
llty = ll.FunctionType(ll.VoidType(), [])
|
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()],
|
llty = ll.FunctionType(ll.IntType(32), [ll.IntType(32), ll.IntType(8).as_pointer()],
|
||||||
var_arg=True)
|
var_arg=True)
|
||||||
else:
|
else:
|
||||||
@ -609,7 +609,7 @@ class LLVMIRGenerator:
|
|||||||
tag += self._rpc_tag(arg.type, arg.type, None)
|
tag += self._rpc_tag(arg.type, arg.type, None)
|
||||||
else:
|
else:
|
||||||
tag += self._rpc_tag(arg.type, arg.type, arg.loc)
|
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()))
|
lltag = self.llconst_of_const(ir.Constant(tag, builtins.TStr()))
|
||||||
|
|
||||||
llargs = []
|
llargs = []
|
||||||
@ -619,7 +619,7 @@ class LLVMIRGenerator:
|
|||||||
self.llbuilder.store(llarg, llargslot)
|
self.llbuilder.store(llarg, llargslot)
|
||||||
llargs.append(llargslot)
|
llargs.append(llargslot)
|
||||||
|
|
||||||
return self.llbuiltin("rpc"), [llservice, lltag] + llargs
|
return self.llbuiltin("send_rpc"), [llservice, lltag] + llargs
|
||||||
|
|
||||||
def prepare_call(self, insn):
|
def prepare_call(self, insn):
|
||||||
if types.is_rpc_function(insn.target_function().type):
|
if types.is_rpc_function(insn.target_function().type):
|
||||||
|
@ -92,7 +92,7 @@ static const struct symbol runtime_exports[] = {
|
|||||||
|
|
||||||
{"log", &log},
|
{"log", &log},
|
||||||
{"lognonl", &lognonl},
|
{"lognonl", &lognonl},
|
||||||
{"rpc", &rpc},
|
{"send_rpc", &send_rpc},
|
||||||
|
|
||||||
/* direct syscalls */
|
/* direct syscalls */
|
||||||
{"rtio_get_counter", &rtio_get_counter},
|
{"rtio_get_counter", &rtio_get_counter},
|
||||||
@ -301,19 +301,19 @@ void watchdog_clear(int id)
|
|||||||
mailbox_send_and_wait(&request);
|
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_rpc_send request;
|
||||||
struct msg_base *reply;
|
|
||||||
|
|
||||||
request.type = MESSAGE_TYPE_RPC_SEND_REQUEST;
|
request.type = MESSAGE_TYPE_RPC_SEND;
|
||||||
request.service = service;
|
request.service = service;
|
||||||
request.tag = tag;
|
request.tag = tag;
|
||||||
va_start(request.args, tag);
|
va_start(request.args, tag);
|
||||||
mailbox_send_and_wait(&request);
|
mailbox_send_and_wait(&request);
|
||||||
va_end(request.args);
|
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) {
|
// if(reply->type == MESSAGE_TYPE_RPC_REPLY) {
|
||||||
// int result = ((struct msg_rpc_reply *)reply)->result;
|
// int result = ((struct msg_rpc_reply *)reply)->result;
|
||||||
// mailbox_acknowledge();
|
// mailbox_acknowledge();
|
||||||
@ -325,8 +325,8 @@ int rpc(int service, const char *tag, ...)
|
|||||||
// mailbox_acknowledge();
|
// mailbox_acknowledge();
|
||||||
// __artiq_raise(&exception);
|
// __artiq_raise(&exception);
|
||||||
// } else {
|
// } else {
|
||||||
log("Malformed MESSAGE_TYPE_RPC_REQUEST reply type %d",
|
// log("Malformed MESSAGE_TYPE_RPC_REQUEST reply type %d",
|
||||||
reply->type);
|
// reply->type);
|
||||||
while(1);
|
while(1);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ long long int now_init(void);
|
|||||||
void now_save(long long int now);
|
void now_save(long long int now);
|
||||||
int watchdog_set(int ms);
|
int watchdog_set(int ms);
|
||||||
void watchdog_clear(int id);
|
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 lognonl(const char *fmt, ...);
|
||||||
void log(const char *fmt, ...);
|
void log(const char *fmt, ...);
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ enum {
|
|||||||
MESSAGE_TYPE_WATCHDOG_SET_REQUEST,
|
MESSAGE_TYPE_WATCHDOG_SET_REQUEST,
|
||||||
MESSAGE_TYPE_WATCHDOG_SET_REPLY,
|
MESSAGE_TYPE_WATCHDOG_SET_REPLY,
|
||||||
MESSAGE_TYPE_WATCHDOG_CLEAR,
|
MESSAGE_TYPE_WATCHDOG_CLEAR,
|
||||||
MESSAGE_TYPE_RPC_SEND_REQUEST,
|
MESSAGE_TYPE_RPC_SEND,
|
||||||
MESSAGE_TYPE_RPC_RECV_REQUEST,
|
MESSAGE_TYPE_RPC_RECV_REQUEST,
|
||||||
MESSAGE_TYPE_RPC_RECV_REPLY,
|
MESSAGE_TYPE_RPC_RECV_REPLY,
|
||||||
MESSAGE_TYPE_RPC_EXCEPTION,
|
MESSAGE_TYPE_RPC_EXCEPTION,
|
||||||
@ -81,7 +81,7 @@ struct msg_watchdog_clear {
|
|||||||
int id;
|
int id;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct msg_rpc_send_request {
|
struct msg_rpc_send {
|
||||||
int type;
|
int type;
|
||||||
int service;
|
int service;
|
||||||
const char *tag;
|
const char *tag;
|
||||||
|
@ -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_start(REMOTEMSG_TYPE_RPC_REQUEST);
|
||||||
out_packet_int32(service);
|
out_packet_int32(service);
|
||||||
|
|
||||||
while(*tag != ':') {
|
while(*tag) {
|
||||||
void *value = va_arg(args, void*);
|
void *value = va_arg(args, void*);
|
||||||
if(!kloader_validate_kpointer(value))
|
if(!kloader_validate_kpointer(value))
|
||||||
return 0;
|
return 0;
|
||||||
@ -735,8 +735,8 @@ static int process_kmsg(struct msg_base *umsg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MESSAGE_TYPE_RPC_SEND_REQUEST: {
|
case MESSAGE_TYPE_RPC_SEND: {
|
||||||
struct msg_rpc_send_request *msg = (struct msg_rpc_send_request *)umsg;
|
struct msg_rpc_send *msg = (struct msg_rpc_send *)umsg;
|
||||||
|
|
||||||
if(!send_rpc_request(msg->service, msg->tag, msg->args)) {
|
if(!send_rpc_request(msg->service, msg->tag, msg->args)) {
|
||||||
log("Failed to send RPC request");
|
log("Failed to send RPC request");
|
||||||
|
Loading…
Reference in New Issue
Block a user