-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from WebAssembly/add-resizing
Add resizing
- Loading branch information
Showing
13 changed files
with
126 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let page_size = 4096 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(module | ||
(memory 4096) | ||
|
||
(export "load" $load) | ||
(func $load (param $i i32) (result i32) (i32.load (get_local $i))) | ||
|
||
(export "store" $store) | ||
(func $store (param $i i32) (param $v i32) (i32.store (get_local $i) (get_local $v))) | ||
|
||
(export "resize" $resize) | ||
(func $resize (param $sz i32) (resize_memory (get_local $sz))) | ||
|
||
(export "size" $size) | ||
(func $size (result i32) (memory_size)) | ||
) | ||
|
||
(assert_eq (invoke "size") (i32.const 4096)) | ||
(invoke "store" (i32.const 0) (i32.const 42)) | ||
(assert_eq (invoke "load" (i32.const 0)) (i32.const 42)) | ||
(assert_fault (invoke "store" (i32.const 4096) (i32.const 42)) "runtime: out of bounds memory access") | ||
(assert_fault (invoke "load" (i32.const 4096)) "runtime: out of bounds memory access") | ||
(invoke "resize" (i32.const 8192)) | ||
(assert_eq (invoke "size") (i32.const 8192)) | ||
(assert_eq (invoke "load" (i32.const 0)) (i32.const 42)) | ||
(assert_eq (invoke "load" (i32.const 4096)) (i32.const 0)) | ||
(invoke "store" (i32.const 4096) (i32.const 43)) | ||
(assert_eq (invoke "load" (i32.const 4096)) (i32.const 43)) | ||
(invoke "resize" (i32.const 4096)) | ||
(assert_eq (invoke "size") (i32.const 4096)) | ||
(assert_eq (invoke "load" (i32.const 0)) (i32.const 42)) | ||
(assert_fault (invoke "store" (i32.const 4096) (i32.const 42)) "runtime: out of bounds memory access") | ||
(assert_fault (invoke "load" (i32.const 4096)) "runtime: out of bounds memory access") |