Stream: git-cranelift

Topic: cranelift / Issue #589 A "safe" subset for Cranelift IR


view this post on Zulip GitHub (Feb 28 2020 at 23:25):

alexcrichton transferred Issue #589:

What if we added heap_load and heap_store instructions, which would roughly be legalized into heap_addr+load and heap_addr+store. That way, frontends could produce Cranelift IR without themselves dealing with plain load and store, which would eliminate the possibility of misusing them and facing undefined behavior.

The next step would be to add a wasm-like indirect call instruction, possibly named table_call. This would be more complex because we don't yet have a builtin way to legalize this that includes signature checking, but it's doable.

Then, it's plausible to imagine defining an IR subset which is completely safe, yet still reasonably complete. We could then clearly document unsafe constructs like load and store as such, possibly with an optional verifier pass that could enforce that no unsafe constructs are present, and make it easy for people to generate IR without having to worry about undefined behavior.


Last updated: Dec 23 2024 at 13:07 UTC