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 Jul 30, 2024
1 parent 73b03d3 commit bbefe65
Show file tree
Hide file tree
Showing 4 changed files with 6 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) =
Generate.init ();
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;
Generate.init ();
(match output_file with
| `Stdout, _ -> ()
| `Name name, _ when debug_mem () -> Debug.start_profiling name
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 bbefe65

Please sign in to comment.