bytecodealliance / bytecodealliance/wasmtime

Re-design constant pools

Open
#1,385 3 comments 0 reactions 0 assignees View on GitHub
cranelift:discussion
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

This is an open-ended issue for re-designing Cranelift's constant pools. In #1377 I added the ability to calculate the address of constants using `const_addr` and to declare constants in function preambles (e..g `const42 = [0 1 2...]`). Constant pools are still implemented at the function level, though, so there is no coalescing of constant values across functions.

I added the function-level `ConstantPool` implementation in order to support SIMD constants (which don't fit in the immediate fields of Cranelift's IR). This is not a pressing issue yet, but before other components start using constants, it might be good to discuss:
- should we implement constant pools at the global level and what would this look like?
- what should the relocation hooks look like for a more general constant pool implementation? Currently the interface looks like `RelocSink::reloc_constant(&mut self, CodeOffset, Reloc, ConstantOffset)` and this may need to change.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.