forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 4
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 #163 from near/viktar/memory-test
tests: memory
- Loading branch information
Showing
5 changed files
with
283 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -381,5 +381,6 @@ mod tests { | |
i32_mul_overflows, | ||
i64_mul_overflows, | ||
i64_rem, | ||
memory_i32, | ||
} | ||
} |
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,170 @@ | ||
start: | ||
zkPC + 2 => RR | ||
:JMP(function_1) | ||
:JMP(finalizeExecution) | ||
function_1: | ||
SP + 1 => SP | ||
RR :MSTORE(SP - 1) | ||
SP + 2 => SP | ||
E :MSTORE(SP - 1) | ||
B :MSTORE(SP - 2) | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E) | ||
97n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E) | ||
97n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 1) | ||
98n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 2) | ||
99n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 25) | ||
122n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E) | ||
97n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E) | ||
97n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 1) | ||
98n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 2) | ||
99n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 25) | ||
122n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E) | ||
25185n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E) | ||
25185n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 1) | ||
25442n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 2) | ||
25699n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 25) | ||
122n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E) | ||
25185n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E) | ||
25185n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 1) | ||
25442n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 2) | ||
25699n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 25) | ||
122n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E) | ||
1684234849n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E) | ||
1684234849n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 1) | ||
1701077858n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 2) | ||
1717920867n => B ;; LoadConst32 | ||
B :ASSERT | ||
0n => B ;; LoadConst32 | ||
0 => A ;; LoadExtName(User(userextname0)) | ||
$ => E :ADD | ||
$ => A :MLOAD(MEM:E + 25) | ||
122n => B ;; LoadConst32 | ||
B :ASSERT | ||
$ => E :MLOAD(SP - 1) | ||
$ => B :MLOAD(SP - 2) | ||
SP - 2 => SP | ||
$ => RR :MLOAD(SP - 1) | ||
SP - 1 => SP | ||
:JMP(RR) | ||
finalizeExecution: | ||
${beforeLast()} :JMPN(finalizeExecution) | ||
:JMP(start) | ||
INCLUDE "helpers/2-exp.zkasm" |
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,107 @@ | ||
(module | ||
(import "env" "assert_eq" (func $assert_eq (param i32) (param i32))) | ||
(memory 1) | ||
(data (i32.const 0) "abcdefghijklmnopqrstuvwxyz") | ||
(func $main | ||
i32.const 0 | ||
i32.load8_u offset=0 | ||
i32.const 97 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load8_u align=1 | ||
i32.const 97 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load8_u offset=1 align=1 | ||
i32.const 98 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load8_u offset=2 align=1 | ||
i32.const 99 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load8_u offset=25 align=1 | ||
i32.const 122 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load8_s offset=0 | ||
i32.const 97 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load8_s align=1 | ||
i32.const 97 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load8_s offset=1 align=1 | ||
i32.const 98 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load8_s offset=2 align=1 | ||
i32.const 99 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load8_s offset=25 align=1 | ||
i32.const 122 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load16_u offset=0 | ||
i32.const 25185 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load16_u align=1 | ||
i32.const 25185 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load16_u offset=1 align=1 | ||
i32.const 25442 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load16_u offset=2 align=2 | ||
i32.const 25699 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load16_u offset=25 align=2 | ||
i32.const 122 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load16_s offset=0 | ||
i32.const 25185 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load16_s align=1 | ||
i32.const 25185 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load16_s offset=1 align=1 | ||
i32.const 25442 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load16_s offset=2 align=2 | ||
i32.const 25699 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load16_s offset=25 align=2 | ||
i32.const 122 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load offset=0 | ||
i32.const 1684234849 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load align=1 | ||
i32.const 1684234849 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load offset=1 align=1 | ||
i32.const 1701077858 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load offset=2 align=2 | ||
i32.const 1717920867 | ||
call $assert_eq | ||
i32.const 0 | ||
i32.load offset=25 align=4 | ||
i32.const 122 | ||
call $assert_eq) | ||
(start $main) | ||
) |
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