Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
vouillon committed Feb 13, 2025
1 parent b72d349 commit 49e1043
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions runtime/wasm/effect-native.wat
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
(func $caml_wrap_exception (param externref) (result (ref eq))))
(import "stdlib" "caml_main_wrapper"
(global $caml_main_wrapper (mut (ref null $wrapper_func))))
(import "effect" "effect_allowed" (global $effect_allowed (mut i32)))

(type $block (array (mut (ref eq))))
(type $string (array (mut i8)))
Expand Down Expand Up @@ -180,6 +181,10 @@

(func (export "%perform") (param $eff (ref eq)) (result (ref eq))
(local $res (tuple (ref eq) (ref eq)))
(if (i32.eqz (global.get $effect_allowed))
(then
(return_call $raise_unhandled
(local.get $eff) (ref.i31 (i32.const 0)))))
(local.set $res (suspend $effect (local.get $eff)))
(return_call_ref $function_1 (tuple.extract 2 1 (local.get $res))
(tuple.extract 2 0 (local.get $res))
Expand Down
2 changes: 1 addition & 1 deletion runtime/wasm/effect.wat
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
(call $caml_fresh_oo_id (ref.i31 (i32.const 0)))))
(ref.i31 (i32.const 0)))

(global $effect_allowed (mut i32) (i32.const 1))
(global $effect_allowed (export "effect_allowed") (mut i32) (i32.const 1))

(@if (not wasi)
(@then
Expand Down

0 comments on commit 49e1043

Please sign in to comment.