@@ -745,8 +745,11 @@ let vec128_literals = ref ([] : (Cmm.vec128_bits * L.t) list)
745
745
let add_literal p f =
746
746
try List. assoc f ! p
747
747
with Not_found ->
748
- (* CR sspies: Should the literals really be in the text section? They are
749
- currently emitted at the end of a function in the text section. *)
748
+ (* CR sspies: The [Text] section here is incorrect. We should be in the
749
+ respective section of the literal type (i.e., 16 or 8 bytes). The code
750
+ below uses the [Text] section, because that is the section that we are in
751
+ when we emit literals in the function body. Only macOS currently switches
752
+ to a dedicated section. *)
750
753
let lbl = L. create Text in
751
754
p := (f, lbl) :: ! p;
752
755
lbl
@@ -765,6 +768,8 @@ let emit_literals p align emit_literal =
765
768
~names: [" __TEXT,__literal" ^ Int. to_string align]
766
769
~flags: None
767
770
~args: [Int. to_string align ^ " byte_literals" ];
771
+ (* CR sspies: The following section is incorrect. We are in a data section
772
+ here. Fix this when cleaning up the section mechanism. *)
768
773
D. unsafe_set_interal_section_ref Text );
769
774
D. align ~bytes: align;
770
775
List. iter emit_literal ! p;
@@ -1415,9 +1420,10 @@ let emit_instr i =
1415
1420
DSL. ins I. FMOV
1416
1421
[| DSL. emit_reg i.res.(0 ); DSL. imm_float (Int32. float_of_bits f) |]
1417
1422
else
1418
- (* float32 constants still take up 8 bytes; we load the lower half. *)
1419
- (* CR sspies: Check whether this is 32-bit or 64-bit. There is currently
1420
- ambiguity about this. *)
1423
+ (* float32 constants take up 8 bytes when we emit them with
1424
+ [float_literal] (see the conversion from int32 to int64 below). Thus,
1425
+ we load the lower half. Note that this is different from Cmm 32-bit
1426
+ floats ([Csingle]), which are emitted as 4-byte constants. *)
1421
1427
let lbl = float_literal (Int64. of_int32 f) in
1422
1428
emit_load_literal i.res.(0 ) lbl
1423
1429
| Lop (Const_float f ) ->
@@ -2202,7 +2208,7 @@ let end_assembly () =
2202
2208
(* [efa_16] is [D.uint16 (Numbers.Uint16.of_int_exn n)] in
2203
2209
mshinwell/ocaml#gdb-names-gpr x86 emitter *)
2204
2210
efa_16 = (fun n -> D. uint16 (Numbers.Uint16. of_nonnegative_int_exn n));
2205
- (* [efa_16 ] is [D.uint32 (Numbers.Uint32.of_int32 n)] in
2211
+ (* [efa_32 ] is [D.uint32 (Numbers.Uint32.of_int32 n)] in
2206
2212
mshinwell/ocaml#gdb-names-gpr x86 emitter *)
2207
2213
(* CR sspies: for some reason, we can get negative numbers here *)
2208
2214
efa_32 = (fun n -> D. int32 n);
0 commit comments