Skip to content
Closed
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
38 changes: 38 additions & 0 deletions benchmarks/wasm/trycatch/throw_twice.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
;; kept in delimited continuation example
(module
;; output: 1, 2, 6, 2, 3, 4, 4, 5
(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
i32.const 6
call 0
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))
38 changes: 38 additions & 0 deletions benchmarks/wasm/trycatch/throw_twice2.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
;; pushed to meta continuation example
(module
;; output: 1, 2, 6, 2, 3, 4, 5
(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
i32.const 6
call 0
i32.const 42
;; [42]
throw
end
i32.const 3
call 0
catch
;; [42, resume]
i32.const 2
call 0
drop
resume0
i32.const 4 ;; |---> adk
call 0 ;; |
end
i32.const 5
call 0
)
(start 1))
36 changes: 36 additions & 0 deletions benchmarks/wasm/trycatch/try_catch_br3.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
;; ignored example
(module
;; output: 1, 2, 3, 4, 5
;; 4 is printed, because the delimited continuation is kept when breaking out of the block,
;; it's inside the trail1
(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
br 0
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))
52 changes: 52 additions & 0 deletions benchmarks/wasm/trycatch/try_catch_br4.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
;; pushed to meta continuation example
(module
(type (;0;) (func (param i32)))
(type (;1;) (func))
(import "console" "log" (func (;0;) (type 0)))
(func (;1;) (type 1)
(local i32 i32)
i32.const 0
local.set 1
try
i32.const 1
call 0
block
block
i32.const 42
;; [42]
throw
end
i32.const 6
call 0
i32.const 42
;; [42]
throw
end
i32.const 3
call 0
catch
;; increment local 1
i32.const 1
local.get 1
i32.add
local.set 1
;; [42, resume]
i32.const 2
call 0
drop
local.get 1
i32.const 1
i32.eq
if (param i32 (; input cont actually ;))
resume0
else
i32.const 7
call 0
end
i32.const 4
call 0
end
i32.const 5
call 0
)
(start 1))
39 changes: 39 additions & 0 deletions benchmarks/wasm/trycatch/try_catch_catch_br.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
(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]
drop
local.set 0 ;; abusing the type system
local.get 0 ;;
block (param i32) ;;
i32.const 2
call 0
resume0
br 0
end
i32.const 4
call 0
local.get 0
resume0
end
i32.const 5
call 0
)
(start 1))
Loading