MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / register_constant

Method register_constant

cranelift/codegen/src/machinst/buffer.rs:670–677  ·  view source on GitHub ↗

Similar to [`MachBuffer::register_constants`] but registers a single constant metadata. This function is useful in situations where not all constants are known at the time of emission.

(&mut self, constant: &VCodeConstant, data: &VCodeConstantData)

Source from the content-addressed store, hash-verified

668 /// situations where not all constants are known at the time of
669 /// emission.
670 pub fn register_constant(&mut self, constant: &VCodeConstant, data: &VCodeConstantData) {
671 let c2 = self.constants.push(MachBufferConstant {
672 upcoming_label: None,
673 align: data.alignment(),
674 size: data.as_slice().len(),
675 });
676 assert_eq!(*constant, c2);
677 }
678
679 /// Completes constant emission by iterating over `self.used_constants` and
680 /// filling in the "holes" with the constant values provided by `constants`.

Callers 2

register_constantsMethod · 0.80
registerMethod · 0.80

Calls 4

pushMethod · 0.45
alignmentMethod · 0.45
lenMethod · 0.45
as_sliceMethod · 0.45

Tested by

no test coverage detected