Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 23 additions & 0 deletions benchmarks/wasm/count.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(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)
i32.const 1000000 ;; 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)
)
193 changes: 193 additions & 0 deletions benchmarks/wasm/spectest/return_call.bin.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
(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))
(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