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.
Add correct ISLE rules for memory operations
This is an intermediate step that makes ISLE rules support generating memory loads and stores. The test file `memory.wat` still fails because we actually need to implement ZK ASM instruction generation correctly.
- Loading branch information
Showing
8 changed files
with
170 additions
and
100 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 |
---|---|---|
|
@@ -321,6 +321,7 @@ mod tests { | |
add, | ||
locals, | ||
locals_simple, | ||
memory, | ||
counter, | ||
add_func, | ||
mul, | ||
|
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,45 @@ | ||
start: | ||
zkPC + 2 => RR | ||
:JMP(function_1) | ||
:JMP(finalizeExecution) | ||
function_1: | ||
SP + 1 => SP | ||
RR :MSTORE(SP - 1) | ||
SP + 4 => SP | ||
D :MSTORE(SP - 1) | ||
E :MSTORE(SP - 2) | ||
B :MSTORE(SP - 3) | ||
0n => B | ||
8589934592n => D | ||
$ => A :MLOAD(CTX) | ||
$ => E :ADD | ||
D :MSTORE(E) | ||
34359738368n => B | ||
12884901888n => E | ||
$ => A :MLOAD(CTX) | ||
$ => A :ADD | ||
E :MSTORE(A) | ||
0n => B | ||
$ => A :MLOAD(CTX) | ||
$ => A :ADD | ||
$ => A :MLOAD(A) | ||
A => E | ||
34359738368n => B | ||
$ => A :MLOAD(CTX) | ||
$ => A :ADD | ||
$ => B :MLOAD(A) | ||
E => A | ||
$ => A :ADD | ||
21474836480n => B | ||
B :ASSERT | ||
$ => D :MLOAD(SP - 1) | ||
$ => E :MLOAD(SP - 2) | ||
$ => B :MLOAD(SP - 3) | ||
SP - 4 => 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,12 @@ | ||
(module | ||
(import "env" "assert_eq" (func $assert_eq (param i32) (param i32))) | ||
(memory (export "memory") 100) | ||
(func $main | ||
(i32.store (i32.const 0) (i32.const 2)) | ||
(i32.store (i32.const 8) (i32.const 3)) | ||
(i32.load (i32.const 0)) | ||
(i32.load (i32.const 8)) | ||
i32.add | ||
i32.const 5 | ||
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