diff --git a/cranelift/jit/src/memory.rs b/cranelift/jit/src/memory.rs index 0aab70743a..3a001ac59f 100644 --- a/cranelift/jit/src/memory.rs +++ b/cranelift/jit/src/memory.rs @@ -179,6 +179,8 @@ impl Memory { } } } + + self.executable = self.allocations.len(); } /// Set all memory allocated in this `Memory` up to now as readonly. @@ -208,12 +210,15 @@ impl Memory { } } } + + self.executable = self.allocations.len(); } /// Frees all allocated memory regions that would be leaked otherwise. /// Likely to invalidate existing function pointers, causing unsafety. pub(crate) unsafe fn free_memory(&mut self) { self.allocations.clear(); + self.executable = 0; } }