Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate: explicit initialization #1662

Merged
merged 2 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/bin-js_of_ocaml/link.ml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ let f
; toplevel
} =
Jsoo_cmdline.Arg.eval common;
Linker.reset ();
let with_output f =
match output_file with
| None -> f stdout
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 @@ -29,6 +29,7 @@ let () =
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 ());
Linker.reset ();
(* this needs to stay synchronized with toplevel.js *)
let toplevel_compile (s : string) (debug : Instruct.debug_event list array) :
unit -> J.t =
Expand Down
2 changes: 0 additions & 2 deletions compiler/lib/generate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2054,5 +2054,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
Loading