Stream: general

Topic: How to store f32 using the Rust codegen API?


view this post on Zulip bjorn3 (Nov 23 2024 at 21:34):

I think func_builder.ins().store(mem_flags, r_ptr, val1, *r0 as i32 * MEM_CELL_SIZE); got the order of the pointer and the value wrong. Same for func_builder.ins().store(mem_flags, r_ptr, constants[*c], *r0 as i32 * MEM_CELL_SIZE);.

view this post on Zulip bjorn3 (Nov 23 2024 at 21:36):

By the way use CallConv::SystemV instead of CallConv::Fast. The latter is currently identical to the former, but unlike the former it is explicitly not guaranteed to be stable between Cranelift versions, nor guaranteed to be identical to any call conv that Rust can call, so you can't use it for functions that need to be called from Rust as opposed to from other Cranelift compiled code.

view this post on Zulip bjorn3 (Nov 23 2024 at 21:37):

Also it seems like you are forgetting to pass the length argument when calling the compiled function.

view this post on Zulip Farooq (Nov 24 2024 at 12:05):

oh shoot it was that simple? :)


Last updated: Dec 23 2024 at 13:07 UTC