Skip to content

Commit 49e1043

Browse files
committed
WIP
1 parent b72d349 commit 49e1043

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

runtime/wasm/effect-native.wat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
(func $caml_wrap_exception (param externref) (result (ref eq))))
1818
(import "stdlib" "caml_main_wrapper"
1919
(global $caml_main_wrapper (mut (ref null $wrapper_func))))
20+
(import "effect" "effect_allowed" (global $effect_allowed (mut i32)))
2021

2122
(type $block (array (mut (ref eq))))
2223
(type $string (array (mut i8)))
@@ -180,6 +181,10 @@
180181

181182
(func (export "%perform") (param $eff (ref eq)) (result (ref eq))
182183
(local $res (tuple (ref eq) (ref eq)))
184+
(if (i32.eqz (global.get $effect_allowed))
185+
(then
186+
(return_call $raise_unhandled
187+
(local.get $eff) (ref.i31 (i32.const 0)))))
183188
(local.set $res (suspend $effect (local.get $eff)))
184189
(return_call_ref $function_1 (tuple.extract 2 1 (local.get $res))
185190
(tuple.extract 2 0 (local.get $res))

runtime/wasm/effect.wat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
(call $caml_fresh_oo_id (ref.i31 (i32.const 0)))))
8181
(ref.i31 (i32.const 0)))
8282

83-
(global $effect_allowed (mut i32) (i32.const 1))
83+
(global $effect_allowed (export "effect_allowed") (mut i32) (i32.const 1))
8484

8585
(@if (not wasi)
8686
(@then

0 commit comments

Comments
 (0)