mirror of https://github.com/m-labs/artiq.git
subkernel: fix passing arguments
This commit is contained in:
parent
cbe7ac1cfd
commit
d1ee0ffb83
|
@ -1442,7 +1442,7 @@ class LLVMIRGenerator:
|
|||
llmax = self.map(insn.operands[1])
|
||||
lltagptr = self._build_subkernel_tags(insn.arg_types)
|
||||
return self.llbuilder.call(self.llbuiltin("subkernel_await_message"),
|
||||
[ll.Constant(lli32, 0), ll.Constant(lli64, 10_000), lltagptr, llmin, llmax],
|
||||
[ll.Constant(lli32, -1), ll.Constant(lli64, 10_000), lltagptr, llmin, llmax],
|
||||
name="subkernel.await.args")
|
||||
|
||||
def process_Closure(self, insn):
|
||||
|
|
|
@ -528,7 +528,7 @@ extern fn subkernel_send_message(id: u32, is_return: bool, destination: u8,
|
|||
}
|
||||
|
||||
#[unwind(allowed)]
|
||||
extern fn subkernel_await_message(id: u32, timeout: i64, tags: &CSlice<u8>, min: u8, max: u8) -> u8 {
|
||||
extern fn subkernel_await_message(id: i32, timeout: i64, tags: &CSlice<u8>, min: u8, max: u8) -> u8 {
|
||||
send(&SubkernelMsgRecvRequest { id: id, timeout: timeout, tags: tags.as_ref() });
|
||||
recv!(SubkernelMsgRecvReply { status, count } => {
|
||||
match status {
|
||||
|
|
|
@ -108,7 +108,7 @@ pub enum Message<'a> {
|
|||
SubkernelAwaitFinishRequest { id: u32, timeout: i64 },
|
||||
SubkernelAwaitFinishReply { status: SubkernelStatus },
|
||||
SubkernelMsgSend { id: u32, destination: Option<u8>, count: u8, tag: &'a [u8], data: *const *const () },
|
||||
SubkernelMsgRecvRequest { id: u32, timeout: i64, tags: &'a [u8] },
|
||||
SubkernelMsgRecvRequest { id: i32, timeout: i64, tags: &'a [u8] },
|
||||
SubkernelMsgRecvReply { status: SubkernelStatus, count: u8 },
|
||||
|
||||
Log(fmt::Arguments<'a>),
|
||||
|
|
|
@ -710,14 +710,14 @@ fn process_kern_message(io: &Io, aux_mutex: &Mutex,
|
|||
}
|
||||
#[cfg(has_drtio)]
|
||||
&kern::SubkernelMsgRecvRequest { id, timeout, tags } => {
|
||||
let message_received = subkernel::message_await(io, _subkernel_mutex, id, timeout);
|
||||
let message_received = subkernel::message_await(io, _subkernel_mutex, id as u32, timeout);
|
||||
let (status, count) = match message_received {
|
||||
Ok(ref message) => (kern::SubkernelStatus::NoError, message.count),
|
||||
Err(SubkernelError::Timeout) => (kern::SubkernelStatus::Timeout, 0),
|
||||
Err(SubkernelError::IncorrectState) => (kern::SubkernelStatus::IncorrectState, 0),
|
||||
Err(SubkernelError::SubkernelFinished) => {
|
||||
let res = subkernel::retrieve_finish_status(io, aux_mutex, _subkernel_mutex,
|
||||
routing_table, id)?;
|
||||
routing_table, id as u32)?;
|
||||
if res.comm_lost {
|
||||
(kern::SubkernelStatus::CommLost, 0)
|
||||
} else if let Some(exception) = &res.exception {
|
||||
|
|
|
@ -781,6 +781,8 @@ impl Manager {
|
|||
&kern::SubkernelMsgRecvRequest { id, timeout, tags } => {
|
||||
// negative timeout value means no timeout
|
||||
let max_time = if timeout > 0 { clock::get_ms() as i64 + timeout } else { timeout };
|
||||
// ID equal to -1 indicates wildcard for receiving arguments
|
||||
let id = if id == -1 { self.current_id } else { id as u32 };
|
||||
self.session.kernel_state = KernelState::MsgAwait {
|
||||
id: id, max_time: max_time, tags: tags.to_vec() };
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in New Issue