mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-04 18:10:18 +00:00
Add memory_grow.wast
test file.
This commit is contained in:
parent
ba6bc71019
commit
e7923d3b32
@ -14,10 +14,12 @@
|
||||
(drop)
|
||||
(memory.grow (i32.const 0))
|
||||
|
||||
|
||||
(drop)
|
||||
(memory.grow (i32.const 2))
|
||||
|
||||
(drop)
|
||||
(memory.grow (i32.const 65536))
|
||||
|
||||
(drop)
|
||||
(memory.grow (i32.const 12))
|
||||
)
|
||||
|
@ -15,7 +15,7 @@ static ENV_VAR: &str = "WASM_GENERATE_SPECTESTS";
|
||||
static BANNER: &str = "// Rust test file autogenerated with cargo build (src/build_spectests.rs).
|
||||
// Please do NOT modify it by hand, as it will be reseted on next build.\n";
|
||||
|
||||
const TESTS: [&str; 57] = [
|
||||
const TESTS: [&str; 58] = [
|
||||
"spectests/address.wast",
|
||||
"spectests/align.wast",
|
||||
"spectests/binary.wast",
|
||||
@ -59,6 +59,7 @@ const TESTS: [&str; 57] = [
|
||||
"spectests/left_to_right.wast",
|
||||
"spectests/loop_.wast",
|
||||
"spectests/memory.wast",
|
||||
"spectests/memory_grow.wast",
|
||||
"spectests/memory_redundancy.wast",
|
||||
"spectests/nop.wast",
|
||||
"spectests/return_.wast",
|
||||
|
1602
src/spectests/memory_grow.rs
Normal file
1602
src/spectests/memory_grow.rs
Normal file
File diff suppressed because it is too large
Load Diff
@ -58,6 +58,7 @@ mod labels;
|
||||
mod left_to_right;
|
||||
mod loop_;
|
||||
mod memory;
|
||||
mod memory_grow;
|
||||
mod memory_redundancy;
|
||||
mod nop;
|
||||
mod return_;
|
||||
|
@ -508,13 +508,14 @@ extern "C" fn grow_memory(size: u32, memory_index: u32, instance: &mut Instance)
|
||||
let old_mem_size = instance
|
||||
.memory_mut(memory_index as usize)
|
||||
.grow(size)
|
||||
.unwrap_or(i32::max_value()); // Should be -1 ?
|
||||
.unwrap_or(-1);
|
||||
|
||||
// Get new memory bytes
|
||||
let new_mem_bytes = (old_mem_size as usize + size as usize) * LinearMemory::WASM_PAGE_SIZE;
|
||||
|
||||
// Update data_pointer
|
||||
instance.data_pointers.memories.get_unchecked_mut(memory_index as usize).len = new_mem_bytes;
|
||||
if old_mem_size != -1 {
|
||||
// Get new memory bytes
|
||||
let new_mem_bytes = (old_mem_size as usize + size as usize) * LinearMemory::WASM_PAGE_SIZE;
|
||||
// Update data_pointer
|
||||
instance.data_pointers.memories.get_unchecked_mut(memory_index as usize).len = new_mem_bytes;
|
||||
}
|
||||
|
||||
old_mem_size
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user