From 453e8b7eb3a660575112b5d56f82614179837ca3 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 6 Nov 2016 23:52:27 +0800 Subject: [PATCH 1/2] runtime: support configurations without moninj, log or dds --- artiq/runtime.rs/libksupport/api.rs | 7 +++++-- artiq/runtime.rs/src/lib.rs | 2 ++ artiq/runtime/rtio.c | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/artiq/runtime.rs/libksupport/api.rs b/artiq/runtime.rs/libksupport/api.rs index aa6483bbd..81c4d75df 100644 --- a/artiq/runtime.rs/libksupport/api.rs +++ b/artiq/runtime.rs/libksupport/api.rs @@ -105,13 +105,16 @@ static mut API: &'static [(&'static str, *const ())] = &[ api!(rtio_input_timestamp), api!(rtio_input_data), -// #if ((defined CONFIG_RTIO_DDS_COUNT) && (CONFIG_RTIO_DDS_COUNT > 0)) + #[cfg(rtio_dds_count)] api!(dds_init), + #[cfg(rtio_dds_count)] api!(dds_init_sync), + #[cfg(rtio_dds_count)] api!(dds_batch_enter), + #[cfg(rtio_dds_count)] api!(dds_batch_exit), + #[cfg(rtio_dds_count)] api!(dds_set), -// #endif api!(i2c_init), api!(i2c_start), diff --git a/artiq/runtime.rs/src/lib.rs b/artiq/runtime.rs/src/lib.rs index e661c427f..48efd5d0d 100644 --- a/artiq/runtime.rs/src/lib.rs +++ b/artiq/runtime.rs/src/lib.rs @@ -75,6 +75,7 @@ mod rpc_proto; mod kernel; mod session; +#[cfg(has_rtio_moninj)] mod moninj; #[cfg(has_rtio_analyzer)] mod analyzer; @@ -109,6 +110,7 @@ pub unsafe extern fn rust_main() { let mut scheduler = sched::Scheduler::new(); scheduler.spawner().spawn(16384, session::thread); + #[cfg(has_rtio_moninj)] scheduler.spawner().spawn(4096, moninj::thread); #[cfg(has_rtio_analyzer)] scheduler.spawner().spawn(4096, analyzer::thread); diff --git a/artiq/runtime/rtio.c b/artiq/runtime/rtio.c index 09f71d9d4..ac5168224 100644 --- a/artiq/runtime/rtio.c +++ b/artiq/runtime/rtio.c @@ -124,6 +124,7 @@ unsigned int rtio_input_data(int channel) void rtio_log_va(long long int timestamp, const char *fmt, va_list args) { +#ifdef CONFIG_RTIO_LOG_CHANNEL // This executes on the kernel CPU's stack, which is specifically designed // for allocation of this kind of massive buffers. int len = vsnprintf(NULL, 0, fmt, args); @@ -152,6 +153,7 @@ void rtio_log_va(long long int timestamp, const char *fmt, va_list args) i = 0; } } +#endif } void rtio_log(long long int timestamp, const char *fmt, ...) From 6e77f65d500f22381edaf75454ffb4ac1a33dd7d Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Mon, 7 Nov 2016 14:33:17 +0000 Subject: [PATCH 2/2] compiler: Clarify recv_rpc value names and documentation [nfc] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the phi emitted for the pointer parameter to recv_rpc was – rather confusingly – called "size", and the pseudo-code in the comment had bit-rotted. Signed-off-by: David Nadlinger --- artiq/compiler/transforms/llvm_ir_generator.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/artiq/compiler/transforms/llvm_ir_generator.py b/artiq/compiler/transforms/llvm_ir_generator.py index c755a43ee..e9643aa04 100644 --- a/artiq/compiler/transforms/llvm_ir_generator.py +++ b/artiq/compiler/transforms/llvm_ir_generator.py @@ -1265,10 +1265,12 @@ class LLVMIRGenerator: return ll.Undefined # T result = { - # void *ptr = NULL; - # loop: int size = rpc_recv("tag", ptr); + # void *ret_ptr = alloca(sizeof(T)); + # void *ptr = ret_ptr; + # loop: int size = recv_rpc(ptr); + # // Non-zero: Provide `size` bytes of extra storage for variable-length data. # if(size) { ptr = alloca(size); goto loop; } - # else *(T*)ptr + # else *(T*)ret_ptr # } llprehead = self.llbuilder.basic_block llhead = self.llbuilder.append_basic_block(name="rpc.head") @@ -1283,7 +1285,7 @@ class LLVMIRGenerator: self.llbuilder.branch(llhead) self.llbuilder.position_at_end(llhead) - llphi = self.llbuilder.phi(llslotgen.type, name="rpc.size") + 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],