Skip to content

Commit

Permalink
Missing type registrations
Browse files Browse the repository at this point in the history
  • Loading branch information
chambart committed Oct 7, 2024
1 parent 965167f commit dc052cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions wasm/emit_wat.ml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ module Conv = struct
let closure_info = closure_info top_env closure_id in
if not accessor.recursive_set then begin
let typ : Type.Var.t =
State.add_closure_type ~arity:closure_info.arity ~fields:accessor.closure_size;
Closure { arity = closure_info.arity; fields = accessor.closure_size }
in
let closure : Expr.t =
Expand All @@ -244,6 +245,7 @@ module Conv = struct
end
else
let closure_typ : Type.Var.t =
State.add_closure_type ~arity:closure_info.arity ~fields:1;
Closure { arity = closure_info.arity; fields = 1 }
in
let closure : Expr.t =
Expand Down Expand Up @@ -274,6 +276,7 @@ module Conv = struct
Closure_id.Map.find move_to top_env.offsets.function_accessors
in
let closure_typ : Type.Var.t =
State.add_closure_type ~arity:start_from_info.arity ~fields:1;
Closure { arity = start_from_info.arity; fields = 1 }
in
let closure : Expr.t =
Expand Down Expand Up @@ -640,6 +643,7 @@ module Conv = struct
let func_types =
List.fold_left
(fun acc ({ arity; fields } : Wasm_closure_offsets.func) ->
State.add_closure_type ~arity ~fields;
let typ : Type.atom = Rvar (Closure { arity; fields }) in
typ :: acc )
[] set_info.functions
Expand Down
5 changes: 4 additions & 1 deletion wasm/wstate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ module State = struct
let add_block_float_size i = Arity.Set.(block_float_sizes += i)

let add_closure_type ~arity ~fields =
add_arity arity;
Closure_type.Set.(closure_types += { arity; fields })

let add_c_import_func_type typ =
Expand All @@ -144,7 +145,9 @@ module State = struct
let add_global_import description =
Global_import.Set.(global_imports += description)

let add_func_import description = Func_import.Set.(func_imports += description)
let add_func_import description =
add_arity description.Func_import.arity;
Func_import.Set.(func_imports += description)

let add_runtime_import description =
Runtime_import.Set.(runtime_imports += description)
Expand Down

0 comments on commit dc052cd

Please sign in to comment.