From 646393731c458f6100fb167cb23e950654c01191 Mon Sep 17 00:00:00 2001 From: David Mak Date: Tue, 13 Aug 2024 17:07:00 +0800 Subject: [PATCH] WIP --- nac3artiq/src/codegen.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nac3artiq/src/codegen.rs b/nac3artiq/src/codegen.rs index ee465ebf..e6e38e45 100644 --- a/nac3artiq/src/codegen.rs +++ b/nac3artiq/src/codegen.rs @@ -430,6 +430,8 @@ fn gen_rpc_tag( buffer.push(b'a'); buffer.push((ndarray_ndims & 0xFF) as u8); gen_rpc_tag(ctx, ndarray_dtype, buffer)?; + + println!("[{buffer:#04X?}]"); } _ => return Err(format!("Unsupported type: {:?}", ctx.unifier.stringify(ty))), } @@ -548,11 +550,15 @@ fn rpc_codegen_callback_fn<'ctx>( .unwrap(); let arg_slot = if matches!(&*ctx.unifier.get_ty_immutable(*arg_ty), TypeEnum::TObj { obj_id, .. } if *obj_id == PrimDef::NDArray.id()) { + println!("Codegen for ndarray RPC"); + + debug_assert_eq!(u64::from(size_type.get_bit_width() / 8), 4); + unsafe { ctx.builder .build_in_bounds_gep( arg_slot, - &[size_type.const_int(u64::from(size_type.get_bit_width() / 8), false)], // should be 4 + &[size_type.const_int(4, false)], // should be 4 "", ) .unwrap()