Skip to content
Merged

TFP #75

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
dbbeff8
implemet multi tag, found bug at suspend16 for forgetting meta-contin…
ahuoguo Nov 28, 2024
f2c64bb
forgor one test
ahuoguo Nov 28, 2024
57e271d
only the control flow structure for failed suspend16 test
ahuoguo Nov 28, 2024
1f9f250
push wast file
ahuoguo Nov 28, 2024
55f95d4
newMk doesn't work also
ahuoguo Nov 28, 2024
a918024
push wast file
ahuoguo Nov 29, 2024
da67bcb
revert nested resume
ahuoguo Nov 29, 2024
f310fcf
some refactor; add test spec
Dec 1, 2024
7f9b086
revert accidental change
Dec 1, 2024
928c501
use the right remaining stack
Dec 1, 2024
5ad02d4
rebase on Dinghong's version
Dec 1, 2024
885df1c
check point
Dec 1, 2024
be08771
refactoring
Dec 2, 2024
f625623
minor refactor
Dec 2, 2024
6022e7b
handler
Dec 2, 2024
2671a81
refactor eval, taking only single inst
Dec 2, 2024
d934f58
try catch
Dec 3, 2024
b719421
rebase Dinghong's tests
Dec 3, 2024
a7b7315
some clean up
Dec 3, 2024
c6a0e06
unify value repr for cont
Dec 3, 2024
4f65d3e
test case: throw -> resume -> throw -> no resume
butterunderflow Dec 3, 2024
ff5e0d4
initial impl for wasmfx
Dec 4, 2024
fd8890c
unreachable not trap
ahuoguo Dec 6, 2024
d1e5548
rm redundant case
ahuoguo Dec 6, 2024
b7fd82a
fix call ref
Dec 6, 2024
7c57b1c
create tfp only, delete trail, simplify handlers
ahuoguo Jan 11, 2025
cebdab8
simplify contV, comment on handler
ahuoguo Jan 11, 2025
f72ab18
this brnach only runs tfp, not fx
ahuoguo Jan 12, 2025
a83750f
reflect fix of return_call in #76
ahuoguo Jan 12, 2025
0a8e4bf
drafting sem for fused eval
Jan 13, 2025
080483d
rm comment
ahuoguo Jan 19, 2025
a819499
support for loop
ahuoguo Jan 19, 2025
c8e8873
first try with return_call.wast
ahuoguo Jan 22, 2025
4eab5f9
look at return_call.wast failure
ahuoguo Jan 29, 2025
605609e
Merge pull request #79 from Generative-Program-Analysis/spec-test
ahuoguo Jan 29, 2025
a5519c3
even odd had the same problem, ignore ASSERT_INVALID
ahuoguo Jan 29, 2025
f1c8004
Merge pull request #80 from Generative-Program-Analysis/spec-test
ahuoguo Jan 29, 2025
72607b4
forgor
ahuoguo Jan 29, 2025
c6d0889
rm wasmfx conflictst
ahuoguo Jan 29, 2025
1439933
merge with main
ahuoguo Jan 29, 2025
712d61a
both FX and TFP in CI
ahuoguo Jan 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ jobs:
sbt 'testOnly gensym.TestLibrary'
sbt 'testOnly gensym.wasm.TestEval'
sbt 'testOnly gensym.wasm.TestScriptRun'
sbt 'testOnly gensym.wasm.TestFx'

sbt 'testOnly gensym.wasm.TestTFP'
sbt 'testOnly gensym.wasm.TestFX'
24 changes: 24 additions & 0 deletions benchmarks/wasm/count.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(module
(type (;0;) (func (param i32) (result i32)))
(type (;1;) (func))
(func (;0;) (type 0) (param i32) (result i32)
local.get 0
i32.eqz
if (result i32) ;; label = @1
local.get 0
else
local.get 0
i32.const 1
i32.sub
return_call 0
end
)
(func (;1;) (type 1)
;; TODO: now setting it to 100K will result in stack overflow
i32.const 10000 ;; it will not terminate when it's 1mil
;; TODO: this doesn't seem like an error in our semantics
;; but something about sbt. But why?
call 0
)
(start 1)
)
40 changes: 40 additions & 0 deletions benchmarks/wasm/for_loop.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
(module
(func $for_loop (result i32)
(local i32)
(local i32)

for
(
;; init
i32.const 0
local.set 0
i32.const 0
local.set 1
|
;; cond
local.get 1
i32.const 10
i32.gt_s
i32.eqz
|
;; post
local.get 1
i32.const 1
i32.add
local.set 1
)

;; es
local.get 0
local.get 1
i32.add
local.set 0

local.get 0


)

(export "for_loop" (func 0))

)
33 changes: 33 additions & 0 deletions benchmarks/wasm/return_call.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
(module
(type (;0;) (func (param i64) (result i32)))
(type (;1;) (func))
(func (;0;) (type 0) (param i64) (result i32)
local.get 0
i64.eqz
if (result i32) ;; label = @1
i32.const 44
else
local.get 0
i64.const 1
i64.sub
return_call 1
end
)
(func (;1;) (type 0) (param i64) (result i32)
local.get 0
i64.eqz
if (result i32) ;; label = @1
i32.const 99
else
local.get 0
i64.const 1
i64.sub
return_call 0
end
)
(func (;2;) (type 1)
i64.const 100000
call 0
)
(start 2)
)
194 changes: 194 additions & 0 deletions benchmarks/wasm/spectest/return_call.bin.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
(module definition binary
"\00\61\73\6d\01\00\00\00\01\c8\80\80\80\00\0e\60"
"\00\01\7f\60\00\01\7e\60\00\01\7d\60\00\01\7c\60"
"\01\7f\01\7f\60\01\7e\01\7e\60\01\7d\01\7d\60\01"
"\7c\01\7c\60\02\7d\7f\01\7f\60\02\7f\7e\01\7e\60"
"\02\7c\7d\01\7d\60\02\7e\7c\01\7c\60\02\7e\7e\01"
"\7e\60\01\7e\01\7f\03\9d\80\80\80\00\1c\00\01\02"
"\03\04\05\06\07\08\09\0a\0b\00\01\02\03\00\01\02"
"\03\00\01\02\03\0c\05\0d\0d\07\d8\81\80\80\00\10"
"\08\74\79\70\65\2d\69\33\32\00\0c\08\74\79\70\65"
"\2d\69\36\34\00\0d\08\74\79\70\65\2d\66\33\32\00"
"\0e\08\74\79\70\65\2d\66\36\34\00\0f\0e\74\79\70"
"\65\2d\66\69\72\73\74\2d\69\33\32\00\10\0e\74\79"
"\70\65\2d\66\69\72\73\74\2d\69\36\34\00\11\0e\74"
"\79\70\65\2d\66\69\72\73\74\2d\66\33\32\00\12\0e"
"\74\79\70\65\2d\66\69\72\73\74\2d\66\36\34\00\13"
"\0f\74\79\70\65\2d\73\65\63\6f\6e\64\2d\69\33\32"
"\00\14\0f\74\79\70\65\2d\73\65\63\6f\6e\64\2d\69"
"\36\34\00\15\0f\74\79\70\65\2d\73\65\63\6f\6e\64"
"\2d\66\33\32\00\16\0f\74\79\70\65\2d\73\65\63\6f"
"\6e\64\2d\66\36\34\00\17\07\66\61\63\2d\61\63\63"
"\00\18\05\63\6f\75\6e\74\00\19\04\65\76\65\6e\00"
"\1a\03\6f\64\64\00\1b\0a\80\83\80\80\00\1c\85\80"
"\80\80\00\00\41\b2\02\0b\85\80\80\80\00\00\42\e4"
"\02\0b\87\80\80\80\00\00\43\00\20\73\45\0b\8b\80"
"\80\80\00\00\44\00\00\00\00\00\c8\ae\40\0b\84\80"
"\80\80\00\00\20\00\0b\84\80\80\80\00\00\20\00\0b"
"\84\80\80\80\00\00\20\00\0b\84\80\80\80\00\00\20"
"\00\0b\84\80\80\80\00\00\20\01\0b\84\80\80\80\00"
"\00\20\01\0b\84\80\80\80\00\00\20\01\0b\84\80\80"
"\80\00\00\20\01\0b\84\80\80\80\00\00\12\00\0b\84"
"\80\80\80\00\00\12\01\0b\84\80\80\80\00\00\12\02"
"\0b\84\80\80\80\00\00\12\03\0b\86\80\80\80\00\00"
"\41\20\12\04\0b\87\80\80\80\00\00\42\c0\00\12\05"
"\0b\89\80\80\80\00\00\43\c3\f5\a8\3f\12\06\0b\8d"
"\80\80\80\00\00\44\3d\0a\d7\a3\70\3d\fa\3f\12\07"
"\0b\8b\80\80\80\00\00\43\66\66\00\42\41\20\12\08"
"\0b\89\80\80\80\00\00\41\20\42\c0\00\12\09\0b\92"
"\80\80\80\00\00\44\00\00\00\00\00\00\50\40\43\00"
"\00\00\42\12\0a\0b\90\80\80\80\00\00\42\c0\00\44"
"\66\66\66\66\66\06\50\40\12\0b\0b\97\80\80\80\00"
"\00\20\00\50\04\7e\20\01\05\20\00\42\01\7d\20\00"
"\20\01\7e\12\18\0b\0b\92\80\80\80\00\00\20\00\50"
"\04\7e\20\00\05\20\00\42\01\7d\12\19\0b\0b\92\80"
"\80\80\00\00\20\00\50\04\7f\41\2c\05\20\00\42\01"
"\7d\12\1b\0b\0b\93\80\80\80\00\00\20\00\50\04\7f"
"\41\e3\00\05\20\00\42\01\7d\12\1a\0b\0b"
)
(module instance)
(assert_return (invoke "type-i32") (i32.const 0x132))
(assert_return (invoke "type-i64") (i64.const 0x164))
;; (assert_return (invoke "type-f32") (f32.const 0x1.e64p+11))
;; (assert_return (invoke "type-f64") (f64.const 0x1.ec8p+11))
(assert_return (invoke "type-first-i32") (i32.const 0x20))
(assert_return (invoke "type-first-i64") (i64.const 0x40))
;; (assert_return (invoke "type-first-f32") (f32.const 0x1.51eb_86p+0))
;; (assert_return (invoke "type-first-f64") (f64.const 0x1.a3d7_0a3d_70a3_dp+0))
(assert_return (invoke "type-second-i32") (i32.const 0x20))
(assert_return (invoke "type-second-i64") (i64.const 0x40))
(assert_return (invoke "type-second-f32") (f32.const 0x1p+5))
;; (assert_return (invoke "type-second-f64") (f64.const 0x1.0066_6666_6666_6p+6))
(assert_return
(invoke "fac-acc" (i64.const 0x0) (i64.const 0x1))
(i64.const 0x1)
)
(assert_return
(invoke "fac-acc" (i64.const 0x1) (i64.const 0x1))
(i64.const 0x1)
)
(assert_return
(invoke "fac-acc" (i64.const 0x5) (i64.const 0x1))
(i64.const 0x78)
)
(assert_return (invoke "count" (i64.const 0x0)) (i64.const 0x0))
(assert_return (invoke "count" (i64.const 0x3e8)) (i64.const 0x0))
;; See `count.wat` for why this is commented out
;; (assert_return (invoke "count" (i64.const 0xf_4240)) (i64.const 0x0))
(assert_return (invoke "even" (i64.const 0x0)) (i32.const 0x2c))
(assert_return (invoke "even" (i64.const 0x1)) (i32.const 0x63))
(assert_return (invoke "even" (i64.const 0x64)) (i32.const 0x2c))
(assert_return (invoke "even" (i64.const 0x4d)) (i32.const 0x63))
;; See `return_call.wat` for why these are commented out
;; (assert_return (invoke "even" (i64.const 0xf_4240)) (i32.const 0x2c))
;; (assert_return (invoke "even" (i64.const 0xf_4241)) (i32.const 0x63))
(assert_return (invoke "odd" (i64.const 0x0)) (i32.const 0x63))
(assert_return (invoke "odd" (i64.const 0x1)) (i32.const 0x2c))
(assert_return (invoke "odd" (i64.const 0xc8)) (i32.const 0x63))
(assert_return (invoke "odd" (i64.const 0x4d)) (i32.const 0x2c))
;; (assert_return (invoke "odd" (i64.const 0xf_4240)) (i32.const 0x63))
;; (assert_return (invoke "odd" (i64.const 0xf_423f)) (i32.const 0x2c))
(assert_invalid
(module binary
"\00\61\73\6d\01\00\00\00\01\88\80\80\80\00\02\60"
"\00\01\7f\60\00\00\03\83\80\80\80\00\02\00\01\0a"
"\93\80\80\80\00\02\86\80\80\80\00\00\12\01\41\00"
"\0b\82\80\80\80\00\00\0b"
)
"type mismatch"
)
(assert_invalid
(module binary
"\00\61\73\6d\01\00\00\00\01\89\80\80\80\00\02\60"
"\00\01\7f\60\00\01\7e\03\83\80\80\80\00\02\00\01"
"\0a\95\80\80\80\00\02\86\80\80\80\00\00\12\01\41"
"\00\0b\84\80\80\80\00\00\42\01\0b"
)
"type mismatch"
)
(assert_invalid
(module binary
"\00\61\73\6d\01\00\00\00\01\88\80\80\80\00\02\60"
"\00\00\60\01\7f\00\03\83\80\80\80\00\02\00\01\0a"
"\91\80\80\80\00\02\84\80\80\80\00\00\12\01\0b\82"
"\80\80\80\00\00\0b"
)
"type mismatch"
)
(assert_invalid
(module binary
"\00\61\73\6d\01\00\00\00\01\89\80\80\80\00\02\60"
"\00\00\60\02\7c\7f\00\03\83\80\80\80\00\02\00\01"
"\0a\91\80\80\80\00\02\84\80\80\80\00\00\12\01\0b"
"\82\80\80\80\00\00\0b"
)
"type mismatch"
)
(module definition binary
"\00\61\73\6d\01\00\00\00\01\84\80\80\80\00\01\60"
"\00\00\03\83\80\80\80\00\02\00\00\0a\93\80\80\80"
"\00\02\86\80\80\80\00\00\41\01\12\01\0b\82\80\80"
"\80\00\00\0b"
)
(module instance)
(module definition binary
"\00\61\73\6d\01\00\00\00\01\84\80\80\80\00\01\60"
"\00\00\03\83\80\80\80\00\02\00\00\0a\9c\80\80\80"
"\00\02\8f\80\80\80\00\00\44\00\00\00\00\00\00\00"
"\40\41\01\12\01\0b\82\80\80\80\00\00\0b"
)
(module instance)
(assert_invalid
(module binary
"\00\61\73\6d\01\00\00\00\01\89\80\80\80\00\02\60"
"\00\00\60\02\7f\7f\00\03\83\80\80\80\00\02\00\01"
"\0a\94\80\80\80\00\02\87\80\80\80\00\00\01\41\01"
"\12\01\0b\82\80\80\80\00\00\0b"
)
"type mismatch"
)
(assert_invalid
(module binary
"\00\61\73\6d\01\00\00\00\01\89\80\80\80\00\02\60"
"\00\00\60\02\7f\7f\00\03\83\80\80\80\00\02\00\01"
"\0a\94\80\80\80\00\02\87\80\80\80\00\00\41\01\01"
"\12\01\0b\82\80\80\80\00\00\0b"
)
"type mismatch"
)
(assert_invalid
(module binary
"\00\61\73\6d\01\00\00\00\01\89\80\80\80\00\02\60"
"\00\00\60\02\7f\7c\00\03\83\80\80\80\00\02\00\01"
"\0a\9c\80\80\80\00\02\8f\80\80\80\00\00\44\00\00"
"\00\00\00\00\f0\3f\41\01\12\01\0b\82\80\80\80\00"
"\00\0b"
)
"type mismatch"
)
(assert_invalid
(module binary
"\00\61\73\6d\01\00\00\00\01\89\80\80\80\00\02\60"
"\00\00\60\02\7c\7f\00\03\83\80\80\80\00\02\00\01"
"\0a\9c\80\80\80\00\02\8f\80\80\80\00\00\41\01\44"
"\00\00\00\00\00\00\f0\3f\12\01\0b\82\80\80\80\00"
"\00\0b"
)
"type mismatch"
)
(assert_invalid
(module binary
"\00\61\73\6d\01\00\00\00\01\84\80\80\80\00\01\60"
"\00\00\03\82\80\80\80\00\01\00\0a\8a\80\80\80\00"
"\01\84\80\80\80\00\00\12\01\0b"
)
"unknown function"
)
(assert_invalid
(module binary
"\00\61\73\6d\01\00\00\00\01\84\80\80\80\00\01\60"
"\00\00\03\82\80\80\80\00\01\00\0a\8e\80\80\80\00"
"\01\88\80\80\80\00\00\12\94\98\db\e2\03\0b"
)
"unknown function"
)
Loading