Stream: git-wasmtime

Topic: wasmtime / issue #11101 Cranelift: example of stackmap co...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2025 at 15:30):

iradicek opened issue #11101:

Following this article, it seems it should be fairly straightforward to define a user stack map during codegen. However, I couldn’t find an example of this anywhere in the documentation. Additionally, I wasn’t able to find an example of how to use this information at runtime either.

Is there a simple example available for this? And if not, could I get a pointer to where I might look for relevant code or documentation, so I could try putting together a minimal example myself?

Also, please let me know if this isn’t the right place to ask this kind of question. Thank you!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2025 at 15:57):

cfallin commented on issue #11101:

The use of this feature by Wasmtime is probably the best existing reference: for example, you can see here or here where the code that translates Wasm GC primitives to CLIF uses declare_value_needs_stack_map on the function builder (part of the cranelift-frontend crate) to ensure that values are spilled to stackslots at safepoints, and here where the metadata that comes out of the compiler result is translated into a form that Wasmtime's GC can use during stack walks.

@fitzgen could probably answer any other specific questions you have -- please feel free to ask on our Zulip!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 15:19):

fitzgen commented on issue #11101:

FWIW, here is where we actually read the GC refs off the stack:

https://github.com/bytecodealliance/wasmtime/blob/d89228850b649385dc3e661d994c5e21c8fcf8ec/crates/wasmtime/src/runtime/store.rs#L1542-L1589

But yeah filing issues or asking on zulip is fine.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 25 2025 at 10:37):

iradicek commented on issue #11101:

Thanks a lot for your responses. Will check those references out :)

My goal is to write a minimal example (for a custom language) that uses cranelift to emit stackmaps and reads them at runtime. Should I leave this issue open for any further questions or better to close it and ask any new questions on zulip?

view this post on Zulip Wasmtime GitHub notifications bot (Jun 25 2025 at 15:08):

fitzgen closed issue #11101:

Following this article, it seems it should be fairly straightforward to define a user stack map during codegen. However, I couldn’t find an example of this anywhere in the documentation. Additionally, I wasn’t able to find an example of how to use this information at runtime either.

Is there a simple example available for this? And if not, could I get a pointer to where I might look for relevant code or documentation, so I could try putting together a minimal example myself?

Also, please let me know if this isn’t the right place to ask this kind of question. Thank you!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 25 2025 at 15:08):

fitzgen commented on issue #11101:

Probably better to close this issue and ask general/higher-level questions on zulip. If you have focused questions or think something might be off with an API or the implementation of some method, then an issue is very welcome.

Look forward to hearing how your adventures go!


Last updated: Dec 06 2025 at 07:03 UTC