Factor out FuncEnvironment and ModuleEnvironment into a separate file.

This commit is contained in:
Dan Gohman
2018-08-03 13:04:05 -07:00
parent 63bc52d9fd
commit 779128d14d
4 changed files with 472 additions and 451 deletions

View File

@@ -3,8 +3,8 @@
use cranelift_codegen::ir;
use cranelift_wasm::GlobalIndex;
use environ::DataInitializer;
use module::{Module, TableElements};
use DataInitializer;
const PAGE_SIZE: usize = 65536;
@@ -83,7 +83,8 @@ impl Instance {
/// Returns a slice of the contents of allocated linear memory.
pub fn inspect_memory(&self, memory_index: usize, address: usize, len: usize) -> &[u8] {
&self.memories
&self
.memories
.get(memory_index)
.unwrap_or_else(|| panic!("no memory for index {}", memory_index))
[address..address + len]