Skip to main content

Module constant

Module constant 

Source
Expand description

Constants

The constant pool defined here allows Cranelift to avoid emitting the same constant multiple times. As constants are inserted in the pool, a handle is returned; the handle is a Cranelift Entity. Inserting the same data multiple times will always return the same handle.

Future work could include:

  • ensuring alignment of constants within the pool,
  • bucketing constants by size.

Structsยง

ConstantData
This type describes the actual constant data. Note that the bytes stored in this structure are expected to be in little-endian order; this is due to ease-of-use when interacting with WebAssembly values, which are little-endian by design.
ConstantPool
Maintains the mapping between a constant handle (i.e. Constant) and its constant data (i.e. ConstantData).