bytecodealliance / bytecodealliance/wasmtime
ISLE: support bool types and constants properly
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 121
Description
ISLE's prototype compiler was built with the simplifying assumption that all constants are integers. "Symbolic constants" (imported opaque values) like `$MYVALUE` were added later. It's possible to define `bool` as a primitive type, but the syntax for bool constants, `#t` and `#f`, results in generated code that uses integer values `1` and `0` because... everything is (was) an integer. This is clearly suboptimal! In #3572 @alexcrichton used the clever workaround of `$false`, leveraging the support for arbitrary passthrough of constant names to actually get a `false` in the code.
We should (i) add a `ConstBool` alongside `ConstInt` in the IR (`PatternInst` and `ExprInst`), and (ii) codegen these properly as Rust bool types. We might also consider at some point making our "primitive" type hierarchy a bit richer and distinguishing ints and bools, but that's lower-priority.
Contributor guide
Assessment
This issue has not been assessed yet.