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

Method drop

crates/wasmtime/src/runtime/code_memory.rs:54–74  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

52
53impl Drop for CodeMemory {
54 fn drop(&mut self) {
55 // If there is a custom code memory handler, restore the
56 // original (non-executable) state of the memory.
57 //
58 // We do this rather than invoking `unpublish()` because we
59 // want to skip the mprotect() if we natively own the mmap and
60 // are going to munmap soon anyway.
61 if let Some(mem) = self.custom_code_memory.as_ref() {
62 if self.published && self.needs_executable {
63 let text = self.text();
64 mem.unpublish_executable(text.as_ptr(), text.len())
65 .expect("Executable memory unpublish failed");
66 }
67 }
68
69 // Drop the registrations before `self.mmap` since they (implicitly) refer to it.
70 #[cfg(has_host_compiler_backend)]
71 let _ = self.unwind_registration.take();
72 #[cfg(feature = "debug-builtins")]
73 let _ = self.debug_registration.take();
74 }
75}
76
77fn _assert() {

Callers

nothing calls this directly

Calls 7

unpublish_executableMethod · 0.80
as_refMethod · 0.45
textMethod · 0.45
expectMethod · 0.45
as_ptrMethod · 0.45
lenMethod · 0.45
takeMethod · 0.45

Tested by

no test coverage detected