Implement memory.grow and memory.current (#9)
* Implement. * Clean and doc * Collect base addresses instead of leaking them * Fix code for 1.25. * Simplify $assert * Use AbiParam::special. * Use &mut self in base_addr
This commit is contained in:
committed by
Dan Gohman
parent
5379605737
commit
e7c8d23a42
28
filetests/grow.wat
Normal file
28
filetests/grow.wat
Normal file
@@ -0,0 +1,28 @@
|
||||
(module
|
||||
(memory 1)
|
||||
(func $assert (param i32)
|
||||
(block $ok
|
||||
(br_if $ok
|
||||
(get_local 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(func $main (local i32)
|
||||
(call $assert
|
||||
(i32.eq
|
||||
(grow_memory (i32.const 1))
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(call $assert
|
||||
(i32.eq
|
||||
(current_memory)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(start $main)
|
||||
(data (i32.const 0) "\04\03\02\01")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user