···8484- #9064: Relax the level handling when unifying row fields
8585 (Leo White, review by Jacques Garrigue)
86868787+- #9097: Do not emit references to dead labels introduced by #2321 (spacetime).
8888+ (Greta Yorsh, review by Mark Shinwell)
8989+8790OCaml 4.10.0
8891------------
8992
+22-6
asmcomp/amd64/emit.mlp
···2828open X86_proc
2929open X86_dsl
3030module String = Misc.Stdlib.String
3131+module Int = Numbers.Int
31323233(* [Branch_relaxation] is not used in this file, but is required by
3334 emit.mlp files for certain other targets; the reference here ensures
···171172172173let label s = sym (emit_label s)
173174174174-let def_label s = D.label (emit_label s)
175175+(* For Spacetime, keep track of code labels that have been emitted. *)
176176+let used_labels = ref Int.Set.empty
177177+178178+let mark_used lbl =
179179+ if Config.spacetime && not (Int.Set.mem lbl !used_labels) then begin
180180+ used_labels := Int.Set.add lbl !used_labels
181181+ end
182182+183183+let def_label ?typ s =
184184+ mark_used s;
185185+ D.label ?typ (emit_label s)
175186176187let emit_Llabel fallthrough lbl =
177188 if not fallthrough && !fastcode_flag then D.align 4;
···10021013 reset_imp_table();
10031014 float_constants := [];
10041015 all_functions := [];
10161016+ used_labels := Int.Set.empty;
10051017 if system = S_win64 then begin
10061018 D.extrn "caml_call_gc" NEAR;
10071019 D.extrn "caml_c_call" NEAR;
···10491061 begin match fundecl.fun_spacetime_shape with
10501062 | None -> ()
10511063 | Some shape ->
10521052- let funsym = emit_symbol fundecl.fun_name in
10531053- D.comment ("Shape for " ^ funsym ^ ":");
10541054- D.qword (ConstLabel funsym);
10551055- List.iter (fun (part_of_shape, label) ->
10641064+ (* Instrumentation that refers to dead code may have been eliminated. *)
10651065+ match List.filter (fun (_, l) -> Int.Set.mem l !used_labels) shape with
10661066+ | [] -> ()
10671067+ | shape ->
10681068+ let funsym = emit_symbol fundecl.fun_name in
10691069+ D.comment ("Shape for " ^ funsym ^ ":");
10701070+ D.qword (ConstLabel funsym);
10711071+ List.iter (fun (part_of_shape, label) ->
10561072 let tag =
10571073 match part_of_shape with
10581074 | Direct_call_point _ -> 1
···10671083 | Indirect_call_point -> ()
10681084 | Allocation_point -> ()
10691085 end)
10701070- shape;
10861086+ shape;
10711087 D.qword (Const 0L)
10721088 end)
10731089 !all_functions;
+2
utils/numbers.ml
···31313232 let rec zero_to_n n =
3333 if n < 0 then Set.empty else Set.add n (zero_to_n (n-1))
3434+3535+ let to_string n = Int.to_string n
3436end
35373638module Int8 = struct
+1
utils/numbers.mli
···26262727 (** [zero_to_n n] is the set of numbers \{0, ..., n\} (inclusive). *)
2828 val zero_to_n : int -> Set.t
2929+ val to_string : int -> string
2930end
30313132module Int8 : sig