Skip to content

Commit

Permalink
Fix global.set too
Browse files Browse the repository at this point in the history
  • Loading branch information
dhil committed Aug 1, 2024
1 parent 99047a7 commit 4991690
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion interpreter/runtime/global.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ let load glob =
let store glob v =
let GlobalT (mut, t) = glob.ty in
if mut <> Var then raise NotMutable;
if not (Match.match_val_type [] (type_of_value v) t) then raise Type;
glob.content <- v
10 changes: 7 additions & 3 deletions test/core/cont.wast
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,10 @@
(global $k (mut (ref null $ct)) (ref.null $ct))
(global $g (ref null $ct) (ref.null $ct))

(func (param $c (ref $ct))
(global.set $k (local.get $c)))
)
(func $f)
(elem declare func $f)

(func (export "set-global")
(global.set $k (cont.new $ct (ref.func $f))))
)
(assert_return (invoke "set-global"))

0 comments on commit 4991690

Please # to comment.