-
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.
* check in MiniWasmFX * Basic `(module bin ...)` support (#62) * basic .bin.wast working --------- Co-authored-by: butterunderflow <[email protected]> Co-authored-by: Guannan Wei <[email protected]> * refactor value hierarchy * remove duplication * prelim impl of RefFunc and ContNew * callref * refactor to 2cps style * add handler * resumable try-catch * fix for deep handler * mechanize test * add test case * missing file * rename vars in resume, added some comments * comment tests for now --------- Co-authored-by: ahuoguo <[email protected]> Co-authored-by: butterunderflow <[email protected]> Co-authored-by: ahuoguo <[email protected]>
- Loading branch information
1 parent
2eb36f0
commit 9eaad3d
Showing
24 changed files
with
3,597 additions
and
2,643 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(module | ||
(type (;0;) (func (param i32))) | ||
(type (;1;) (func)) | ||
(import "console" "log" (func (;0;) (type 0))) | ||
(func (;1;) (type 1) | ||
(local i32) | ||
try ;; 1 2 3 2 4 4 5 | ||
i32.const 1 | ||
call 0 | ||
i32.const 42 | ||
;; [42] | ||
throw | ||
i32.const 3 | ||
call 0 | ||
i32.const -1 | ||
;; [-1] | ||
throw | ||
catch | ||
;; [42, resume] | ||
i32.const 2 | ||
call 0 | ||
drop | ||
resume0 | ||
i32.const 4 | ||
call 0 | ||
end | ||
i32.const 5 | ||
call 0 | ||
) | ||
(start 1)) |
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,31 @@ | ||
(module | ||
(type (;0;) (func (param i32))) | ||
(type (;1;) (func)) | ||
(import "console" "log" (func (;0;) (type 0))) | ||
(func (;1;) (type 1) | ||
(local i32) | ||
try | ||
i32.const 1 | ||
call 0 | ||
i32.const 42 | ||
;; [42] | ||
throw | ||
i32.const 3 | ||
call 0 | ||
catch | ||
;; [42, resume] | ||
i32.const 2 | ||
call 0 | ||
drop | ||
local.set 0 ;; now we are really abusing the type system ... | ||
local.get 0 | ||
resume0 | ||
i32.const 4 | ||
call 0 | ||
local.get 0 | ||
resume0 | ||
end | ||
i32.const 5 | ||
call 0 | ||
) | ||
(start 1)) |
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,43 @@ | ||
(module | ||
(type (;0;) (func (param i32))) | ||
(type (;1;) (func)) | ||
(import "console" "log" (func (;0;) (type 0))) | ||
(func (;1;) (type 1) | ||
(local i32) | ||
try | ||
i32.const 1 | ||
call 0 | ||
try | ||
i32.const 42 | ||
;; [42] | ||
throw | ||
i32.const 3 | ||
call 0 | ||
catch | ||
;; [42, resume] | ||
i32.const 2 | ||
call 0 | ||
drop ;; [resume] | ||
resume0 | ||
i32.const 4 | ||
call 0 | ||
end | ||
i32.const 5 | ||
call 0 | ||
i32.const -1 | ||
throw | ||
i32.const 7 | ||
call 0 | ||
catch | ||
;; [-1, resume] | ||
drop | ||
i32.const 6 | ||
call 0 | ||
resume0 | ||
i32.const 8 | ||
call 0 | ||
end | ||
i32.const 9 | ||
call 0 | ||
) | ||
(start 1)) |
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,27 @@ | ||
(module | ||
(type (;0;) (func (param i32))) | ||
(type (;1;) (func)) | ||
(import "console" "log" (func (;0;) (type 0))) | ||
(func (;1;) (type 1) | ||
(local i32) | ||
try | ||
i32.const 1 | ||
call 0 | ||
i32.const 42 | ||
;; [42] | ||
throw | ||
i32.const 3 | ||
call 0 | ||
catch | ||
;; [42, resume] | ||
i32.const 2 | ||
call 0 | ||
drop | ||
resume0 | ||
i32.const 4 | ||
call 0 | ||
end | ||
i32.const 5 | ||
call 0 | ||
) | ||
(start 1)) |
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,31 @@ | ||
(module | ||
(type (;0;) (func (param i32))) | ||
(type (;1;) (func)) | ||
(import "console" "log" (func (;0;) (type 0))) | ||
(func (;1;) (type 1) | ||
(local i32) | ||
try | ||
i32.const 1 | ||
call 0 | ||
block | ||
block | ||
i32.const 42 | ||
;; [42] | ||
throw | ||
end | ||
end | ||
i32.const 3 | ||
call 0 | ||
catch | ||
;; [42, resume] | ||
i32.const 2 | ||
call 0 | ||
drop | ||
resume0 | ||
i32.const 4 | ||
call 0 | ||
end | ||
i32.const 5 | ||
call 0 | ||
) | ||
(start 1)) |
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 | ||
(type (;0;) (func (param i32))) | ||
(type (;1;) (func)) | ||
(import "console" "log" (func (;0;) (type 0))) | ||
(func (;1;) (type 1) | ||
(local i32) | ||
block (result i32) | ||
try | ||
i32.const 1 | ||
call 0 | ||
i32.const 42 | ||
;; [42] | ||
throw | ||
i32.const 3 | ||
call 0 | ||
catch | ||
;; [42, resume] | ||
i32.const 2 | ||
call 0 | ||
;;drop | ||
br 0 | ||
resume0 | ||
i32.const 4 | ||
call 0 | ||
end | ||
i32.const 5 | ||
call 0 | ||
end | ||
i32.const 6 | ||
call 0 | ||
) | ||
(start 1)) |
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 | ||
(type (;0;) (func (param i32))) | ||
(type (;1;) (func)) | ||
(import "console" "log" (func (;0;) (type 0))) | ||
(func (;1;) (type 1) | ||
(local i32) | ||
try | ||
i32.const 1 | ||
call 0 | ||
block | ||
i32.const 42 | ||
;; [42] | ||
throw | ||
br 0 | ||
i32.const 3 | ||
call 0 | ||
end | ||
i32.const 6 | ||
call 0 | ||
catch | ||
;; [42, resume] | ||
i32.const 2 | ||
call 0 | ||
drop | ||
resume0 | ||
i32.const 4 | ||
call 0 | ||
end | ||
i32.const 5 | ||
call 0 | ||
) | ||
(start 1)) |
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,25 @@ | ||
(module | ||
(type (;0;) (func (param i32))) | ||
(type (;1;) (func)) | ||
(import "console" "log" (func (;0;) (type 0))) | ||
(func (;1;) (type 1) | ||
(local i32) | ||
try | ||
i32.const 1 | ||
call 0 | ||
i32.const 42 | ||
;; [42] | ||
throw | ||
i32.const 3 | ||
call 0 | ||
catch | ||
;; [42, resume] | ||
call 0 | ||
drop | ||
i32.const 4 | ||
call 0 | ||
end | ||
i32.const 5 | ||
call 0 | ||
) | ||
(start 1)) |
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,24 @@ | ||
(module | ||
(type (;0;) (func (param i32))) | ||
(type (;1;) (func)) | ||
(import "console" "log" (func (;0;) (type 0))) | ||
(func (;1;) (type 1) | ||
(local i32) | ||
try | ||
i32.const 1 | ||
call 0 | ||
i32.const 3 | ||
call 0 | ||
catch | ||
;; [42, resume] | ||
i32.const 2 | ||
call 0 | ||
drop | ||
resume0 | ||
i32.const 4 | ||
call 0 | ||
end | ||
i32.const 5 | ||
call 0 | ||
) | ||
(start 1)) |
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,58 @@ | ||
(module | ||
(type (;0;) (func (param i32))) | ||
(type (;1;) (func (param i32 i32))) | ||
(type (;2;) (func (param (ref 0) (ref 0)))) | ||
(type (;3;) (func)) | ||
(import "spectest" "print_i32" (func (;0;) (type 0))) | ||
(export "_start" (func 6)) | ||
(start 6) | ||
(elem (;0;) declare func 4) | ||
(elem (;1;) declare func 5) | ||
(func (;1;) (type 0) (param i32) | ||
local.get 0 | ||
call 0 | ||
) | ||
(func (;2;) (type 1) (param i32 i32) | ||
(local i32) | ||
local.get 0 | ||
local.set 2 | ||
block ;; label = @1 | ||
loop ;; label = @2 | ||
local.get 2 | ||
local.get 1 | ||
i32.gt_u | ||
br_if 1 (;@1;) | ||
local.get 2 | ||
call 1 | ||
local.get 2 | ||
i32.const 1 | ||
i32.add | ||
local.set 2 | ||
br 0 (;@2;) | ||
end | ||
end | ||
) | ||
(func (;3;) (type 2) (param (ref 0) (ref 0)) | ||
i32.const 10 | ||
local.get 0 | ||
call_ref 0 | ||
i32.const 20 | ||
local.get 1 | ||
call_ref 0 | ||
) | ||
(func (;4;) (type 0) (param i32) | ||
local.get 0 | ||
i32.const 13 | ||
call 2 | ||
) | ||
(func (;5;) (type 0) (param i32) | ||
local.get 0 | ||
i32.const 23 | ||
call 2 | ||
) | ||
(func (;6;) (type 3) | ||
ref.func 4 | ||
ref.func 5 | ||
call 3 | ||
) | ||
) |
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,13 @@ | ||
(module binary | ||
"\00\61\73\6d\01\00\00\00\01\91\80\80\80\00\05\60" | ||
"\00\00\5d\00\60\01\7f\00\5d\02\60\01\7f\01\7f\03" | ||
"\83\80\80\80\00\02\02\04\06\86\80\80\80\00\01\7f" | ||
"\01\41\0b\0b\07\88\80\80\80\00\01\04\6d\61\69\6e" | ||
"\00\01\09\85\80\80\80\00\01\03\00\01\00\0a\a1\80" | ||
"\80\80\00\02\86\80\80\80\00\00\20\00\24\00\0b\90" | ||
"\80\80\80\00\00\20\00\d2\00\e0\03\e1\03\01\e3\01" | ||
"\00\23\00\0b" | ||
) | ||
;; (module instance) | ||
(assert_return (invoke "main" (i32.const 0x16)) (i32.const 0x16)) | ||
(assert_return (invoke "main" (i32.const 0xffff_fe44)) (i32.const 0xffff_fe44)) |
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
Oops, something went wrong.