Skip to content

Commit 0000ac5

Browse files
committed
turn bool into not_global
1 parent 1e8019e commit 0000ac5

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

asmcomp/cmmgen.ml

+12-9
Original file line numberDiff line numberDiff line change
@@ -740,8 +740,10 @@ let transl_structured_constant cst =
740740

741741
(* Translate constant closures *)
742742

743+
type is_global = Global | Not_global
744+
743745
let constant_closures =
744-
ref ([] : ((string * bool) * ufunction list * uconstant list) list)
746+
ref ([] : ((string * is_global) * ufunction list * uconstant list) list)
745747

746748
(* Boxed integers *)
747749

@@ -1423,7 +1425,7 @@ let rec transl env e =
14231425
transl_constant sc
14241426
| Uclosure(fundecls, []) ->
14251427
let lbl = Compilenv.new_const_symbol() in
1426-
constant_closures := ((lbl, false), fundecls, []) :: !constant_closures;
1428+
constant_closures := ((lbl, Not_global), fundecls, []) :: !constant_closures;
14271429
List.iter (fun f -> Queue.add f functions) fundecls;
14281430
Cconst_symbol lbl
14291431
| Uclosure(fundecls, clos_vars) ->
@@ -2427,9 +2429,9 @@ let rec transl_all_functions already_translated cont =
24272429
cont, already_translated
24282430

24292431
let cdefine_symbol (symb, global) =
2430-
if global
2431-
then [Cglobal_symbol symb; Cdefine_symbol symb]
2432-
else [Cdefine_symbol symb]
2432+
match global with
2433+
| Global -> [Cglobal_symbol symb; Cdefine_symbol symb]
2434+
| Not_global -> [Cdefine_symbol symb]
24332435

24342436
(* Emit structured constants *)
24352437

@@ -2540,7 +2542,8 @@ let emit_constant_closure symb fundecls clos_vars cont =
25402542
let emit_constants cont (constants:Clambda.preallocated_constant list) =
25412543
let c = ref cont in
25422544
List.iter
2543-
(fun { symbol = lbl; exported = global; definition = cst } ->
2545+
(fun { symbol = lbl; exported; definition = cst } ->
2546+
let global = if exported then Global else Not_global in
25442547
let cst = emit_structured_constant (lbl, global) cst [] in
25452548
c:= Cdata(cst):: !c)
25462549
constants;
@@ -2964,7 +2967,7 @@ let reference_symbols namelist =
29642967
Cdata(List.map mksym namelist)
29652968

29662969
let global_data name v =
2967-
Cdata(emit_structured_constant (name, true)
2970+
Cdata(emit_structured_constant (name, Global)
29682971
(Uconst_string (Marshal.to_string v [])) [])
29692972

29702973
let globals_map v = global_data "caml_globals_map" v
@@ -3004,8 +3007,8 @@ let predef_exception i name =
30043007
let symname = "caml_exn_" ^ name in
30053008
let cst = Uconst_string name in
30063009
let label = Compilenv.new_const_symbol () in
3007-
let cont = emit_structured_constant (label, false) cst [] in
3008-
Cdata(emit_structured_constant (symname, true)
3010+
let cont = emit_structured_constant (label, Not_global) cst [] in
3011+
Cdata(emit_structured_constant (symname, Global)
30093012
(Uconst_block(Obj.object_tag,
30103013
[
30113014
Uconst_ref(label, Some cst);

0 commit comments

Comments
 (0)