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

Method finalize

cranelift/jit/src/memory/arena.rs:48–65  ·  view source on GitHub ↗
(&mut self, branch_protection: BranchProtection)

Source from the content-addressed store, hash-verified

46 }
47
48 fn finalize(&mut self, branch_protection: BranchProtection) {
49 if self.finalized {
50 return;
51 }
52
53 // Executable regions are handled separately to correctly deal with
54 // branch protection and cache coherence.
55 if self.target_prot == region::Protection::READ_EXECUTE {
56 super::set_readable_and_executable(self.ptr, self.len, branch_protection)
57 .expect("unable to set memory protection for jit memory segment");
58 } else {
59 unsafe {
60 region::protect(self.ptr, self.len, self.target_prot)
61 .expect("unable to change memory protection for jit memory segment");
62 }
63 }
64 self.finalized = true;
65 }
66
67 // Note: We do pointer arithmetic on `ptr` passed to `Segment::new` here.
68 // This assumes that `ptr` is valid for `len` bytes, or will result in UB.

Callers 4

finalize_definitionsMethod · 0.45
large_virtual_allocationFunction · 0.45
switch_errorFunction · 0.45
mainFunction · 0.45

Calls 4

OkFunction · 0.85
pipeline_flush_mtFunction · 0.50
expectMethod · 0.45

Tested by 1

switch_errorFunction · 0.36