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

Method finish_constants

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

Completes constant emission by iterating over `self.used_constants` and filling in the "holes" with the constant values provided by `constants`. Returns the alignment required for this entire buffer. Alignment starts at the ISA's minimum function alignment and can be increased due to constant requirements.

(&mut self, constants: &VCodeConstants)

Source from the content-addressed store, hash-verified

683 /// at the ISA's minimum function alignment and can be increased due to
684 /// constant requirements.
685 fn finish_constants(&mut self, constants: &VCodeConstants) -> u32 {
686 let mut alignment = self.min_alignment;
687 for (constant, offset) in mem::take(&mut self.used_constants) {
688 let constant = constants.get(constant);
689 let data = constant.as_slice();
690 self.data[offset as usize..][..data.len()].copy_from_slice(data);
691 alignment = constant.alignment().max(alignment);
692 }
693 alignment
694 }
695
696 /// Returns a label that can be used to refer to the `constant` provided.
697 ///

Callers 1

finishMethod · 0.80

Calls 6

getMethod · 0.45
as_sliceMethod · 0.45
copy_from_sliceMethod · 0.45
lenMethod · 0.45
maxMethod · 0.45
alignmentMethod · 0.45

Tested by

no test coverage detected