Ensure all structured constants are registered (#9940)
Allocated constants from other compilation units were not registered, resulting in missed opportunities for unboxing FP and boxed-integer constants.master
parent
952281944d
commit
eb342da8a9
4
Changes
4
Changes
|
@ -534,6 +534,10 @@ Working version
|
||||||
- #9927: Restore Cygwin64 support.
|
- #9927: Restore Cygwin64 support.
|
||||||
(David Allsopp, review by Xavier Leroy)
|
(David Allsopp, review by Xavier Leroy)
|
||||||
|
|
||||||
|
- #9940: Fix unboxing of allocated constants from other compilation units
|
||||||
|
(Vincent Laviron, report by Stephen Dolan, review by Xavier Leroy and
|
||||||
|
Stephen Dolan)
|
||||||
|
|
||||||
|
|
||||||
OCaml 4.11.1
|
OCaml 4.11.1
|
||||||
------------
|
------------
|
||||||
|
|
|
@ -178,7 +178,10 @@ let rec expr_size env = function
|
||||||
let transl_constant dbg = function
|
let transl_constant dbg = function
|
||||||
| Uconst_int n ->
|
| Uconst_int n ->
|
||||||
int_const dbg n
|
int_const dbg n
|
||||||
| Uconst_ref (label, _) ->
|
| Uconst_ref (label, def_opt) ->
|
||||||
|
Option.iter
|
||||||
|
(fun def -> Cmmgen_state.add_structured_constant label def)
|
||||||
|
def_opt;
|
||||||
Cconst_symbol (label, dbg)
|
Cconst_symbol (label, dbg)
|
||||||
|
|
||||||
let emit_constant cst cont =
|
let emit_constant cst cont =
|
||||||
|
|
|
@ -76,6 +76,9 @@ let set_structured_constants l =
|
||||||
)
|
)
|
||||||
l
|
l
|
||||||
|
|
||||||
|
let add_structured_constant sym cst =
|
||||||
|
Hashtbl.replace state.structured_constants sym cst
|
||||||
|
|
||||||
let get_structured_constant s =
|
let get_structured_constant s =
|
||||||
Hashtbl.find_opt state.structured_constants s
|
Hashtbl.find_opt state.structured_constants s
|
||||||
|
|
||||||
|
|
|
@ -41,5 +41,7 @@ val no_more_functions : unit -> bool
|
||||||
|
|
||||||
val set_structured_constants : Clambda.preallocated_constant list -> unit
|
val set_structured_constants : Clambda.preallocated_constant list -> unit
|
||||||
|
|
||||||
|
val add_structured_constant : string -> Clambda.ustructured_constant -> unit
|
||||||
|
|
||||||
(* Also looks up using Compilenv.structured_constant_of_symbol *)
|
(* Also looks up using Compilenv.structured_constant_of_symbol *)
|
||||||
val structured_constant_of_sym : string -> Clambda.ustructured_constant option
|
val structured_constant_of_sym : string -> Clambda.ustructured_constant option
|
||||||
|
|
Loading…
Reference in New Issue