Skip to content

Commit af8a320

Browse files
authored
flambda-backend: Fix merge_infos bug (#2147)
* Test debug-events problem * Don't add events for boxing functions
1 parent fb56287 commit af8a320

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

bytecomp/bytegen.ml

+3-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ let rec is_tailcall = function
111111
let preserve_tailcall_for_prim = function
112112
Popaque _ | Psequor | Psequand
113113
| Pobj_magic _
114-
| Prunstack | Pperform | Presume | Preperform ->
114+
| Prunstack | Pperform | Presume | Preperform
115+
| Pbox_float _ | Punbox_float
116+
| Pbox_int _ | Punbox_int _ ->
115117
true
116118
| Pbytes_to_string | Pbytes_of_string
117119
| Parray_to_iarray | Parray_of_iarray
@@ -127,7 +129,6 @@ let preserve_tailcall_for_prim = function
127129
| Pdivint _ | Pmodint _ | Pandint | Porint | Pxorint | Plslint | Plsrint
128130
| Pasrint | Pintcomp _ | Poffsetint _ | Poffsetref _ | Pintoffloat
129131
| Pfloatofint _ | Pnegfloat _ | Pabsfloat _ | Paddfloat _ | Psubfloat _ | Pmulfloat _
130-
| Punbox_float | Pbox_float _ | Punbox_int _ | Pbox_int _
131132
| Pdivfloat _ | Pfloatcomp _| Punboxed_float_comp _
132133
| Pstringlength | Pstringrefu | Pstringrefs
133134
| Pcompare_ints | Pcompare_floats | Pcompare_bints _

lambda/translprim.ml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,6 @@ let lambda_primitive_needs_event_after = function
10101010
collect the call stack. *)
10111011
| Pduprecord _ | Pccall _ | Pfloatofint _ | Pnegfloat _ | Pabsfloat _
10121012
| Paddfloat _ | Psubfloat _ | Pmulfloat _ | Pdivfloat _ | Pstringrefs | Pbytesrefs
1013-
| Pbox_float _ | Pbox_int _
10141013
| Pbytessets | Pmakearray (Pgenarray, _, _) | Pduparray _
10151014
| Parrayrefu (Pgenarray_ref _ | Pfloatarray_ref _)
10161015
| Parrayrefs _ | Parraysets _ | Pbintofint _ | Pcvtbint _ | Pnegbint _
@@ -1047,7 +1046,10 @@ let lambda_primitive_needs_event_after = function
10471046
| Patomic_exchange | Patomic_cas | Patomic_fetch_add | Patomic_load _
10481047
| Pintofbint _ | Pctconst _ | Pbswap16 | Pint_as_pointer _ | Popaque _
10491048
| Pdls_get
1050-
| Pobj_magic _ | Punbox_float | Punbox_int _ -> false
1049+
| Pobj_magic _ | Punbox_float | Punbox_int _
1050+
(* These don't allocate in bytecode; they're just identity functions: *)
1051+
| Pbox_float _ | Pbox_int _
1052+
-> false
10511053

10521054
(* Determine if a primitive should be surrounded by an "after" debug event *)
10531055
let primitive_needs_event_after = function
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(* TEST
2+
* bytecode
3+
flags = "-g -extension layouts"
4+
*)
5+
6+
let f1 f i = Stdlib__Float_u.to_float (f i)
7+
let f2 f i = Stdlib__Float_u.to_float (f i) +. 0.

0 commit comments

Comments
 (0)