Skip to content

Commit

Permalink
Generate: explicit initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
vouillon authored and OlivierNicole committed Aug 1, 2024
1 parent 99e82e0 commit 460cdf4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions compiler/bin-js_of_ocaml/check_runtime.ml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ let print_groups output l =
output_string output (Printf.sprintf "%s\n" name)))

let f (runtime_files, bytecode, target_env) =
Linker.reset ();
let runtime_files, builtin =
List.partition_map runtime_files ~f:(fun name ->
match Builtins.find name with
Expand Down
1 change: 1 addition & 0 deletions compiler/bin-js_of_ocaml/compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ let run
let include_cmis = toplevel && not no_cmis in
let custom_header = common.Jsoo_cmdline.Arg.custom_header in
Jsoo_cmdline.Arg.eval common;
Linker.reset ();
(match output_file with
| `Stdout, _ -> ()
| `Name name, _ when debug_mem () -> Debug.start_profiling name
Expand Down
1 change: 1 addition & 0 deletions compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ let normalize_bytecode code =
Bytes.to_string b

let () =
Linker.reset ();
let global = J.pure_js_expr "globalThis" in
Config.Flag.set "use-js-string" (Jsoo_runtime.Sys.Config.use_js_string ());
Config.Flag.set "effects" (Jsoo_runtime.Sys.Config.effects ());
Expand Down
2 changes: 0 additions & 2 deletions compiler/lib/generate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2056,5 +2056,3 @@ let init () =
Hashtbl.iter
(fun name (k, _) -> Primitive.register name k None None)
internal_primitives

let () = init ()
8 changes: 4 additions & 4 deletions compiler/lib/primitive.ml
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,17 @@ let register p k kargs arity =
(string_of_kind k));
add_external p;
(match arity with
| Some a -> Hashtbl.add arities p a
| Some a -> Hashtbl.replace arities p a
| _ -> ());
(match kargs with
| Some k -> Hashtbl.add kind_args_tbl p k
| Some k -> Hashtbl.replace kind_args_tbl p k
| _ -> ());
Hashtbl.add kinds p k
Hashtbl.replace kinds p k

let alias nm nm' =
add_external nm';
add_external nm;
Hashtbl.add aliases nm nm'
Hashtbl.replace aliases nm nm'

let named_values = ref StringSet.empty

Expand Down

0 comments on commit 460cdf4

Please sign in to comment.