forked from M-Labs/artiq
firmware, compiler: rename rpc functions to be more consistent.
This commit is contained in:
parent
13c6e96760
commit
d04e611232
|
@ -340,11 +340,11 @@ class LLVMIRGenerator:
|
|||
llty = ll.FunctionType(llvoid, [])
|
||||
elif name == "memcmp":
|
||||
llty = ll.FunctionType(lli32, [llptr, llptr, lli32])
|
||||
elif name == "send_rpc":
|
||||
elif name == "rpc_send":
|
||||
llty = ll.FunctionType(llvoid, [lli32, llsliceptr, llptrptr])
|
||||
elif name == "send_async_rpc":
|
||||
elif name == "rpc_send_async":
|
||||
llty = ll.FunctionType(llvoid, [lli32, llsliceptr, llptrptr])
|
||||
elif name == "recv_rpc":
|
||||
elif name == "rpc_recv":
|
||||
llty = ll.FunctionType(lli32, [llptr])
|
||||
elif name == "now":
|
||||
llty = lli64
|
||||
|
@ -359,7 +359,7 @@ class LLVMIRGenerator:
|
|||
llglobal = ll.Function(self.llmodule, llty, name)
|
||||
if name in ("__artiq_raise", "__artiq_reraise", "llvm.trap"):
|
||||
llglobal.attributes.add("noreturn")
|
||||
if name in ("rtio_log", "send_rpc", "send_async_rpc",
|
||||
if name in ("rtio_log", "rpc_send", "rpc_send_async",
|
||||
"watchdog_set", "watchdog_clear",
|
||||
self.target.print_function):
|
||||
llglobal.attributes.add("nounwind")
|
||||
|
@ -1242,10 +1242,10 @@ class LLVMIRGenerator:
|
|||
self.llbuilder.store(llargslot, llargptr)
|
||||
|
||||
if fun_type.async:
|
||||
self.llbuilder.call(self.llbuiltin("send_async_rpc"),
|
||||
self.llbuilder.call(self.llbuiltin("rpc_send_async"),
|
||||
[llservice, lltagptr, llargs])
|
||||
else:
|
||||
self.llbuilder.call(self.llbuiltin("send_rpc"),
|
||||
self.llbuilder.call(self.llbuiltin("rpc_send"),
|
||||
[llservice, lltagptr, llargs])
|
||||
|
||||
# Don't waste stack space on saved arguments.
|
||||
|
@ -1257,7 +1257,7 @@ class LLVMIRGenerator:
|
|||
# T result = {
|
||||
# void *ret_ptr = alloca(sizeof(T));
|
||||
# void *ptr = ret_ptr;
|
||||
# loop: int size = recv_rpc(ptr);
|
||||
# loop: int size = rpc_recv(ptr);
|
||||
# // Non-zero: Provide `size` bytes of extra storage for variable-length data.
|
||||
# if(size) { ptr = alloca(size); goto loop; }
|
||||
# else *(T*)ret_ptr
|
||||
|
@ -1278,12 +1278,12 @@ class LLVMIRGenerator:
|
|||
llphi = self.llbuilder.phi(llslotgen.type, name="rpc.ptr")
|
||||
llphi.add_incoming(llslotgen, llprehead)
|
||||
if llunwindblock:
|
||||
llsize = self.llbuilder.invoke(self.llbuiltin("recv_rpc"), [llphi],
|
||||
llsize = self.llbuilder.invoke(self.llbuiltin("rpc_recv"), [llphi],
|
||||
llheadu, llunwindblock,
|
||||
name="rpc.size.next")
|
||||
self.llbuilder.position_at_end(llheadu)
|
||||
else:
|
||||
llsize = self.llbuilder.call(self.llbuiltin("recv_rpc"), [llphi],
|
||||
llsize = self.llbuilder.call(self.llbuiltin("rpc_recv"), [llphi],
|
||||
name="rpc.size.next")
|
||||
lldone = self.llbuilder.icmp_unsigned('==', llsize, ll.Constant(llsize.type, 0),
|
||||
name="rpc.done")
|
||||
|
|
|
@ -86,9 +86,9 @@ static mut API: &'static [(&'static str, *const ())] = &[
|
|||
api!(watchdog_set = ::watchdog_set),
|
||||
api!(watchdog_clear = ::watchdog_clear),
|
||||
|
||||
api!(send_rpc = ::send_rpc),
|
||||
api!(send_async_rpc = ::send_async_rpc),
|
||||
api!(recv_rpc = ::recv_rpc),
|
||||
api!(rpc_send = ::rpc_send),
|
||||
api!(rpc_send_async = ::rpc_send_async),
|
||||
api!(rpc_recv = ::rpc_recv),
|
||||
|
||||
api!(cache_get = ::cache_get),
|
||||
api!(cache_put = ::cache_put),
|
||||
|
|
|
@ -121,7 +121,7 @@ extern fn abort() -> ! {
|
|||
loop {}
|
||||
}
|
||||
|
||||
extern fn send_rpc(service: u32, tag: CSlice<u8>, data: *const *const ()) {
|
||||
extern fn rpc_send(service: u32, tag: CSlice<u8>, data: *const *const ()) {
|
||||
while !rpc_queue::empty() {}
|
||||
send(&RpcSend {
|
||||
async: false,
|
||||
|
@ -131,7 +131,7 @@ extern fn send_rpc(service: u32, tag: CSlice<u8>, data: *const *const ()) {
|
|||
})
|
||||
}
|
||||
|
||||
extern fn send_async_rpc(service: u32, tag: CSlice<u8>, data: *const *const ()) {
|
||||
extern fn rpc_send_async(service: u32, tag: CSlice<u8>, data: *const *const ()) {
|
||||
while rpc_queue::full() {}
|
||||
rpc_queue::enqueue(|mut slice| {
|
||||
let length = {
|
||||
|
@ -153,7 +153,7 @@ extern fn send_async_rpc(service: u32, tag: CSlice<u8>, data: *const *const ())
|
|||
})
|
||||
}
|
||||
|
||||
extern fn recv_rpc(slot: *mut ()) -> usize {
|
||||
extern fn rpc_recv(slot: *mut ()) -> usize {
|
||||
send(&RpcRecvRequest(slot));
|
||||
recv!(&RpcRecvReply(ref result) => {
|
||||
match result {
|
||||
|
@ -281,7 +281,7 @@ unsafe fn attribute_writeback(typeinfo: *const ()) {
|
|||
attributes = attributes.offset(1);
|
||||
|
||||
if (*attribute).tag.len() > 0 {
|
||||
send_async_rpc(0, (*attribute).tag, [
|
||||
rpc_send_async(0, (*attribute).tag, [
|
||||
&object as *const _ as *const (),
|
||||
&(*attribute).name as *const _ as *const (),
|
||||
(object as usize + (*attribute).offset) as *const ()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
from artiq.language.core import *
|
||||
from artiq.language.types import *
|
||||
|
||||
# CHECK: call void @send_async_rpc
|
||||
# CHECK: call void @rpc_send_async
|
||||
|
||||
@rpc(flags={"async"})
|
||||
def foo():
|
||||
|
|
Loading…
Reference in New Issue