@@ -537,6 +537,9 @@ let rec prepare_letrec (recursive_set : Ident.Set.t)
537
537
| Lregion (body , _ ) ->
538
538
let letrec = prepare_letrec recursive_set current_let body letrec in
539
539
{ letrec with needs_region = true }
540
+ | Ltail _body ->
541
+ (* No tail expected here *)
542
+ assert false
540
543
[@@ ocaml.warning " -fragile-match" ]
541
544
542
545
let dissect_letrec ~bindings ~body =
@@ -573,18 +576,10 @@ let dissect_letrec ~bindings ~body =
573
576
id, Lprim (Pccall desc, [size], Loc_unknown ))
574
577
letrec.blocks
575
578
in
576
- let real_body = body in
577
- let bound_ids_freshening =
578
- List. map (fun (bound_id , _ ) -> bound_id, Ident. rename bound_id) bindings
579
- |> Ident.Map. of_list
580
- in
581
- let cont = next_raise_count () in
582
579
let body =
583
580
if not letrec.needs_region
584
581
then body
585
- else
586
- let args = List. map (fun (bound_id , _ ) -> Lvar bound_id) bindings in
587
- Lstaticraise (cont, args)
582
+ else Ltail body
588
583
in
589
584
let effects_then_body = lsequence (letrec.effects, body) in
590
585
let functions =
@@ -616,18 +611,7 @@ let dissect_letrec ~bindings ~body =
616
611
with_preallocations letrec.consts
617
612
in
618
613
let substituted = Lambda. rename letrec.substitution with_constants in
619
- let body_layout = Lambda. layout_top in
620
- if not letrec.needs_region
621
- then substituted
622
- else
623
- Lstaticcatch
624
- ( Lregion (Lambda. rename bound_ids_freshening substituted, body_layout),
625
- ( cont,
626
- List. map
627
- (fun (bound_id , _ ) -> bound_id, Lambda. layout_letrec)
628
- bindings ),
629
- real_body,
630
- body_layout )
614
+ substituted
631
615
632
616
type dissected =
633
617
| Dissected of Lambda .lambda
0 commit comments