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!
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_mapon the function builder (part of thecranelift-frontendcrate) 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!
fitzgen commented on issue #11101:
FWIW, here is where we actually read the GC refs off the stack:
But yeah filing issues or asking on zulip is fine.
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?
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!
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