@@ -740,8 +740,10 @@ let transl_structured_constant cst =
740
740
741
741
(* Translate constant closures *)
742
742
743
+ type is_global = Global | Not_global
744
+
743
745
let constant_closures =
744
- ref ([] : ((string * bool ) * ufunction list * uconstant list ) list )
746
+ ref ([] : ((string * is_global ) * ufunction list * uconstant list ) list )
745
747
746
748
(* Boxed integers *)
747
749
@@ -1423,7 +1425,7 @@ let rec transl env e =
1423
1425
transl_constant sc
1424
1426
| Uclosure (fundecls , [] ) ->
1425
1427
let lbl = Compilenv. new_const_symbol() in
1426
- constant_closures := ((lbl, false ), fundecls, [] ) :: ! constant_closures;
1428
+ constant_closures := ((lbl, Not_global ), fundecls, [] ) :: ! constant_closures;
1427
1429
List. iter (fun f -> Queue. add f functions) fundecls;
1428
1430
Cconst_symbol lbl
1429
1431
| Uclosure (fundecls , clos_vars ) ->
@@ -2427,9 +2429,9 @@ let rec transl_all_functions already_translated cont =
2427
2429
cont, already_translated
2428
2430
2429
2431
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]
2433
2435
2434
2436
(* Emit structured constants *)
2435
2437
@@ -2540,7 +2542,8 @@ let emit_constant_closure symb fundecls clos_vars cont =
2540
2542
let emit_constants cont (constants :Clambda.preallocated_constant list ) =
2541
2543
let c = ref cont in
2542
2544
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
2544
2547
let cst = emit_structured_constant (lbl, global) cst [] in
2545
2548
c:= Cdata (cst):: ! c)
2546
2549
constants;
@@ -2964,7 +2967,7 @@ let reference_symbols namelist =
2964
2967
Cdata (List. map mksym namelist)
2965
2968
2966
2969
let global_data name v =
2967
- Cdata (emit_structured_constant (name, true )
2970
+ Cdata (emit_structured_constant (name, Global )
2968
2971
(Uconst_string (Marshal. to_string v [] )) [] )
2969
2972
2970
2973
let globals_map v = global_data " caml_globals_map" v
@@ -3004,8 +3007,8 @@ let predef_exception i name =
3004
3007
let symname = " caml_exn_" ^ name in
3005
3008
let cst = Uconst_string name in
3006
3009
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 )
3009
3012
(Uconst_block (Obj. object_tag,
3010
3013
[
3011
3014
Uconst_ref (label, Some cst);
0 commit comments