@@ -227,31 +227,72 @@ let equal (x: primitive) (y: primitive) = x = y
227
227
228
228
let result_layout (p : primitive ) =
229
229
match p with
230
- | Punbox_float -> Lambda. Punboxed_float
231
- | Punbox_int bi -> Lambda. Punboxed_int bi
232
- | Pmake_unboxed_product layouts -> Lambda. Punboxed_product layouts
233
- | Punboxed_product_field (field , layouts ) -> List. nth layouts field
234
- | Pccall {prim_native_repr_res = (_ , repr_res ); _} ->
235
- Lambda. layout_of_native_repr repr_res
236
- | Pufloatfield _ -> Lambda. Punboxed_float
237
- | Pread_symbol _ | Pmakeblock _ | Pmakeufloatblock _ | Pfield _
238
- | Pfield_computed | Psetfield _ | Psetfield_computed _ | Pfloatfield _
239
- | Psetfloatfield _ | Psetufloatfield _ | Pduprecord _ | Praise _
240
- | Psequand | Psequor | Pnot | Pnegint | Paddint | Psubint | Pmulint
241
- | Pdivint _ | Pmodint _ | Pandint | Porint | Pxorint | Plslint | Plsrint
242
- | Pasrint | Pintcomp _ | Pcompare_ints | Pcompare_floats | Pcompare_bints _
243
- | Poffsetint _ | Poffsetref _ | Pintoffloat | Pfloatofint _ | Pnegfloat _
244
- | Pabsfloat _ | Paddfloat _ | Psubfloat _ | Pmulfloat _ | Pdivfloat _
245
- | Pfloatcomp _ | Pstringlength | Pstringrefu | Pstringrefs
246
- | Pbyteslength | Pbytesrefu | Pbytessetu | Pbytesrefs | Pbytessets
247
- | Pmakearray _ | Pduparray _ | Parraylength _ | Parrayrefu _ | Parraysetu _
248
- | Parrayrefs _ | Parraysets _ | Pisint | Pisout | Pbintofint _ | Pintofbint _
249
- | Pcvtbint _ | Pnegbint _ | Paddbint _ | Psubbint _ | Pmulbint _ | Pdivbint _
250
- | Pmodbint _ | Pandbint _ | Porbint _ | Pxorbint _ | Plslbint _ | Plsrbint _
251
- | Pasrbint _ | Pbintcomp _ | Pbigarrayref _ | Pbigarrayset _ | Pbigarraydim _
230
+ | Psetfield _ | Psetfield_computed _ | Psetfloatfield _ | Poffsetref _
231
+ | Psetufloatfield _
232
+ | Pbytessetu | Pbytessets | Parraysetu _ | Parraysets _ | Pbigarrayset _
233
+ -> Lambda. layout_unit
234
+ | Pmakeblock _ | Pmakearray _ | Pduprecord _
235
+ | Pmakeufloatblock _
236
+ | Pduparray _ | Pbigarraydim _ -> Lambda. layout_block
237
+ | Pfield _ | Pfield_computed -> Lambda. layout_field
238
+ | Punboxed_product_field (field , layouts ) -> (Array. of_list layouts).(field)
239
+ | Pmake_unboxed_product layouts -> Lambda. layout_unboxed_product layouts
240
+ | Pfloatfield _ | Pfloatofint _ | Pnegfloat _ | Pabsfloat _
241
+ | Paddfloat _ | Psubfloat _ | Pmulfloat _ | Pdivfloat _
242
+ | Pbox_float _ -> Lambda. layout_boxed_float
243
+ | Pufloatfield _ | Punbox_float -> Punboxed_float
244
+ | Pccall { prim_native_repr_res = _ , repr_res } -> Lambda. layout_of_native_repr repr_res
245
+ | Praise _ -> Lambda. layout_bottom
246
+ | Psequor | Psequand | Pnot
247
+ | Pnegint | Paddint | Psubint | Pmulint
248
+ | Pdivint _ | Pmodint _
249
+ | Pandint | Porint | Pxorint
250
+ | Plslint | Plsrint | Pasrint
251
+ | Pintcomp _
252
+ | Pcompare_ints | Pcompare_floats | Pcompare_bints _
253
+ | Poffsetint _ | Pintoffloat | Pfloatcomp _
254
+ | Pstringlength | Pstringrefu | Pstringrefs
255
+ | Pbyteslength | Pbytesrefu | Pbytesrefs
256
+ | Parraylength _ | Pisint | Pisout | Pintofbint _
257
+ | Pbintcomp _
258
+ | Pprobe_is_enabled _ | Pbswap16
259
+ -> Lambda. layout_int
260
+ | Parrayrefu array_ref_kind | Parrayrefs array_ref_kind ->
261
+ Lambda. array_ref_kind_result_layout array_ref_kind
262
+ | Pbintofint (bi, _) | Pcvtbint (_,bi,_)
263
+ | Pnegbint (bi, _) | Paddbint (bi, _) | Psubbint (bi, _)
264
+ | Pmulbint (bi, _) | Pdivbint {size = bi} | Pmodbint {size = bi}
265
+ | Pandbint (bi, _) | Porbint (bi, _) | Pxorbint (bi, _)
266
+ | Plslbint (bi, _) | Plsrbint (bi, _) | Pasrbint (bi, _)
267
+ | Pbbswap (bi , _ ) | Pbox_int (bi , _ ) ->
268
+ Lambda. layout_boxedint bi
269
+ | Punbox_int bi -> Punboxed_int bi
270
+ | Pbigarrayref (_ , _ , kind , _ ) ->
271
+ begin match kind with
272
+ | Pbigarray_unknown -> Lambda. layout_any_value
273
+ | Pbigarray_float32 | Pbigarray_float64 -> Lambda. layout_boxed_float
274
+ | Pbigarray_sint8 | Pbigarray_uint8
275
+ | Pbigarray_sint16 | Pbigarray_uint16
276
+ | Pbigarray_caml_int -> Lambda. layout_int
277
+ | Pbigarray_int32 -> Lambda. layout_boxedint Pint32
278
+ | Pbigarray_int64 -> Lambda. layout_boxedint Pint64
279
+ | Pbigarray_native_int -> Lambda. layout_boxedint Pnativeint
280
+ | Pbigarray_complex32 | Pbigarray_complex64 ->
281
+ Lambda. layout_block
282
+ end
283
+ | Pint_as_pointer _ ->
284
+ (* CR ncourant: use an unboxed int64 here when it exists *)
285
+ Lambda. layout_any_value
286
+ | Pget_header _ -> Lambda. layout_boxedint Pnativeint
287
+ | Prunstack | Presume | Pperform | Preperform ->
288
+ (* CR mshinwell/ncourant: to be thought about later *)
289
+ Misc. fatal_error " Effects-related primitives are not yet supported"
290
+ | Patomic_load { immediate_or_pointer = Immediate } -> Lambda. layout_int
291
+ | Patomic_load { immediate_or_pointer = Pointer } -> Lambda. layout_any_value
292
+ | Patomic_exchange
293
+ | Patomic_cas
294
+ | Patomic_fetch_add
295
+ | Pdls_get
296
+ | Popaque | Pread_symbol _
252
297
| Pstring_load _ | Pbytes_load _ | Pbytes_set _ | Pbigstring_load _
253
- | Pbigstring_set _ | Pbswap16 | Pbbswap _ | Pint_as_pointer _ | Popaque
254
- | Pprobe_is_enabled _ | Pbox_float _ | Pbox_int _ | Pget_header _
255
- | Prunstack | Pperform | Presume | Preperform | Patomic_exchange
256
- | Patomic_cas | Patomic_fetch_add | Pdls_get | Patomic_load _
257
- -> Lambda. layout_any_value
298
+ | Pbigstring_set _ -> Lambda. layout_any_value
0 commit comments