Commit 6d65a589

6d65a589df0bMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified

Description

fix(codegen): FFI :ptr arg unboxes bigint to int before void* cast

Details

Commit
6d65a589df0b
Parent
8ae0a60fbdf5

spinel_codegen.rbmodifiedView file

@@ -5199,8 +5199,11 @@
51995199 if infer_type(call_args[k]) == "poly"
52005200 @needs_rb_value = 1
52015201 result = result + "((void *)(" + compile_expr(call_args[k]) + ").v.p)"
5202+ elsif infer_type(call_args[k]) == "bigint" || expr_emit_is_bigint(call_args[k]) == 1
5203+ @needs_bigint = 1
5204+ result = result + "((void *)(uintptr_t)sp_bigint_to_int((sp_Bigint *)" + compile_expr(call_args[k]) + "))"
52025205 else
5203- result = result + "((void *)" + compile_expr(call_args[k]) + ")"
5206+ result = result + "((void *)(uintptr_t)" + compile_expr(call_args[k]) + ")"
52045207 end
52055208 elsif spec == "float_array" || spec == "int_array"
52065209 # Zero-copy bulk transfer (#474). The Spinel Array's contiguous