Skip to content

Commit

Permalink
Eliminate Topeval.phrase_name entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
dra27 committed Oct 27, 2021
1 parent 7ef6094 commit d564b17
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions toplevel/native/topeval.ml
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,14 @@ let pr_item =
(* Execute a toplevel phrase *)

let phrase_seqid = ref 0
let phrase_name = ref "TOP"

let execute_phrase print_outcome ppf phr =
match phr with
| Ptop_def sstr ->
let oldenv = !toplevel_env in
incr phrase_seqid;
phrase_name := Printf.sprintf "TOP%i" !phrase_seqid;
Compilenv.reset ?packname:None !phrase_name;
let phrase_name = "TOP" ^ string_of_int !phrase_seqid in
Compilenv.reset ?packname:None phrase_name;
Typecore.reset_delayed_checks ();
let sstr, rewritten =
match sstr with
Expand All @@ -148,20 +147,20 @@ let execute_phrase print_outcome ppf phr =
if Config.flambda then
let { Lambda.module_ident; main_module_block_size = size;
required_globals; code = res } =
Translmod.transl_implementation_flambda !phrase_name
Translmod.transl_implementation_flambda phrase_name
(str, Tcoerce_none)
in
remember module_ident 0 sg';
module_ident, close_phrase res, required_globals, size
else
let size, res = Translmod.transl_store_phrases !phrase_name str in
Ident.create_persistent !phrase_name, res, Ident.Set.empty, size
let size, res = Translmod.transl_store_phrases phrase_name str in
Ident.create_persistent phrase_name, res, Ident.Set.empty, size
in
Warnings.check_fatal ();
begin try
toplevel_env := newenv;
let res =
load_lambda ppf ~required_globals ~module_ident !phrase_name res size
load_lambda ppf ~required_globals ~module_ident phrase_name res size
in
let out_phr =
match res with
Expand Down

0 comments on commit d564b17

Please sign in to comment.