Stream: cranelift

Topic: Meaningful differences between R64 and I64 for non-WASM


view this post on Zulip Floppy (Jun 03 2024 at 00:10):

To my understanding R64 has something to do with WASM. But when using cranelift as a codegen backend to my own language compiler, can I use R64 as a way to distinguish integers from pointers so that I don't have to track that outside of cranelift?

My plan is to inline the data payload of a sum type (tag+data) if it fits in a single cranelift value, or pass it as a stack slot address if it doesn't. Marking whether it's meant to be used as a stack slot or as an inlined value by simply checking whether the type of the value is R64would simplify my code a bit.

From what I can tell I64 and R64 are in most cases treated indistinguishably?

view this post on Zulip bjorn3 (Jun 03 2024 at 07:55):

The difference is that r64 types end up in the stack map if any is generated. Note that we are currently moving wasmtime from letting cranelift generate stack maps using r64 to having the wasm->clif ir step generate them. This will remove the r64 type.

view this post on Zulip bjorn3 (Jun 03 2024 at 07:56):

Also a lot of operations you may need don't work on r64 like iadd.

view this post on Zulip fitzgen (he/him) (Jun 03 2024 at 11:33):

https://github.com/bytecodealliance/wasmtime/pull/8728 has some more details and motivation about moving this stuff into clif producers

Tracking GC references and producing stack maps is a significant amount of complexity in regalloc2. At the same time, GC reference value types are pretty annoying to deal with in Cranelift itself. ...

Last updated: Nov 26 2024 at 01:30 UTC