mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-25 02:12:13 +00:00
Add memory_grow.wast
test file.
This commit is contained in:
parent
ba6bc71019
commit
e7923d3b32
@ -14,10 +14,12 @@
|
|||||||
(drop)
|
(drop)
|
||||||
(memory.grow (i32.const 0))
|
(memory.grow (i32.const 0))
|
||||||
|
|
||||||
|
|
||||||
(drop)
|
(drop)
|
||||||
(memory.grow (i32.const 2))
|
(memory.grow (i32.const 2))
|
||||||
|
|
||||||
|
(drop)
|
||||||
|
(memory.grow (i32.const 65536))
|
||||||
|
|
||||||
(drop)
|
(drop)
|
||||||
(memory.grow (i32.const 12))
|
(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).
|
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";
|
// 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/address.wast",
|
||||||
"spectests/align.wast",
|
"spectests/align.wast",
|
||||||
"spectests/binary.wast",
|
"spectests/binary.wast",
|
||||||
@ -59,6 +59,7 @@ const TESTS: [&str; 57] = [
|
|||||||
"spectests/left_to_right.wast",
|
"spectests/left_to_right.wast",
|
||||||
"spectests/loop_.wast",
|
"spectests/loop_.wast",
|
||||||
"spectests/memory.wast",
|
"spectests/memory.wast",
|
||||||
|
"spectests/memory_grow.wast",
|
||||||
"spectests/memory_redundancy.wast",
|
"spectests/memory_redundancy.wast",
|
||||||
"spectests/nop.wast",
|
"spectests/nop.wast",
|
||||||
"spectests/return_.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 left_to_right;
|
||||||
mod loop_;
|
mod loop_;
|
||||||
mod memory;
|
mod memory;
|
||||||
|
mod memory_grow;
|
||||||
mod memory_redundancy;
|
mod memory_redundancy;
|
||||||
mod nop;
|
mod nop;
|
||||||
mod return_;
|
mod return_;
|
||||||
|
@ -508,13 +508,14 @@ extern "C" fn grow_memory(size: u32, memory_index: u32, instance: &mut Instance)
|
|||||||
let old_mem_size = instance
|
let old_mem_size = instance
|
||||||
.memory_mut(memory_index as usize)
|
.memory_mut(memory_index as usize)
|
||||||
.grow(size)
|
.grow(size)
|
||||||
.unwrap_or(i32::max_value()); // Should be -1 ?
|
.unwrap_or(-1);
|
||||||
|
|
||||||
// Get new memory bytes
|
if old_mem_size != -1 {
|
||||||
let new_mem_bytes = (old_mem_size as usize + size as usize) * LinearMemory::WASM_PAGE_SIZE;
|
// Get new memory bytes
|
||||||
|
let new_mem_bytes = (old_mem_size as usize + size as usize) * LinearMemory::WASM_PAGE_SIZE;
|
||||||
// Update data_pointer
|
// Update data_pointer
|
||||||
instance.data_pointers.memories.get_unchecked_mut(memory_index as usize).len = new_mem_bytes;
|
instance.data_pointers.memories.get_unchecked_mut(memory_index as usize).len = new_mem_bytes;
|
||||||
|
}
|
||||||
|
|
||||||
old_mem_size
|
old_mem_size
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user