Review feedback.

This commit is contained in:
Chris Fallin
2022-01-31 16:11:25 -08:00
parent 570dee63f3
commit 982df2f2e5
7 changed files with 332 additions and 310 deletions

View File

@@ -2,10 +2,10 @@
//!
//! `RuntimeLinearMemory` is to WebAssembly linear memories what `Table` is to WebAssembly tables.
use crate::instance::MemFdSlot;
use crate::memfd::MemoryMemFd;
use crate::mmap::Mmap;
use crate::vmcontext::VMMemoryDefinition;
use crate::MemFdSlot;
use crate::MemoryMemFd;
use crate::Store;
use anyhow::Error;
use anyhow::{bail, format_err, Result};
@@ -162,6 +162,13 @@ impl MmapMemory {
let len = request_bytes - pre_guard_bytes;
let mut memfd_slot = MemFdSlot::create(base as *mut _, len);
memfd_slot.instantiate(minimum, Some(image))?;
unsafe {
// On drop, we will unmap our mmap'd range that
// this memfd_slot was mapped on top of, so there
// is no need for the memfd_slot to wipe it with
// an anonymous mapping first.
memfd_slot.no_clear_on_drop();
}
Some(memfd_slot)
}
None => None,