@@ -156,8 +156,9 @@ type rhs_kind =
156
156
let rec expr_size env = function
157
157
| Uvar id ->
158
158
begin try V. find_same id env with Not_found -> RHS_nonrec end
159
- | Uclosure (fundecls , clos_vars ) ->
160
- RHS_block (fundecls_size fundecls + List. length clos_vars)
159
+ | Uclosure { functions ; not_scanned_slots ; scanned_slots } ->
160
+ RHS_block (fundecls_size functions + List. length not_scanned_slots
161
+ + List. length scanned_slots)
161
162
| Ulet (_str , _kind , id , exp , body ) ->
162
163
expr_size (V. add (VP. var id) (expr_size env exp) env) body
163
164
| Uletrec (bindings , body ) ->
@@ -426,18 +427,18 @@ let rec transl env e =
426
427
end
427
428
| Uconst sc ->
428
429
transl_constant Debuginfo. none sc
429
- | Uclosure ( fundecls , [] ) ->
430
+ | Uclosure { functions ; not_scanned_slots = [] ; scanned_slots = [] } ->
430
431
let sym = Compilenv. new_const_symbol() in
431
- Cmmgen_state. add_constant sym (Const_closure (Local , fundecls , [] ));
432
- List. iter (fun f -> Cmmgen_state. add_function f) fundecls ;
432
+ Cmmgen_state. add_constant sym (Const_closure (Local , functions , [] ));
433
+ List. iter (fun f -> Cmmgen_state. add_function f) functions ;
433
434
let dbg =
434
- match fundecls with
435
+ match functions with
435
436
| [] -> Debuginfo. none
436
437
| fundecl ::_ -> fundecl.dbg
437
438
in
438
439
Cconst_symbol (sym, dbg)
439
- | Uclosure ( fundecls , clos_vars ) ->
440
- let startenv = fundecls_size fundecls in
440
+ | Uclosure { functions ; not_scanned_slots ; scanned_slots } ->
441
+ let startenv = fundecls_size functions + List. length not_scanned_slots in
441
442
let mode =
442
443
Option. get @@
443
444
List. fold_left (fun s { mode; dbg; _ } ->
@@ -447,10 +448,10 @@ let rec transl env e =
447
448
if not (Lambda. eq_mode mode m') then
448
449
Misc. fatal_errorf " Inconsistent modes in let rec at %s"
449
450
(Debuginfo. to_string dbg);
450
- s) None fundecls in
451
+ s) None functions in
451
452
let rec transl_fundecls pos = function
452
453
[] ->
453
- List. map (transl env) clos_vars
454
+ List. map (transl env) (not_scanned_slots @ scanned_slots)
454
455
| f :: rem ->
455
456
let is_last = match rem with [] -> true | _ ::_ -> false in
456
457
Cmmgen_state. add_function f;
@@ -474,11 +475,11 @@ let rec transl env e =
474
475
else alloc_infix_header pos f.dbg :: without_header
475
476
in
476
477
let dbg =
477
- match fundecls with
478
+ match functions with
478
479
| [] -> Debuginfo. none
479
480
| fundecl ::_ -> fundecl.dbg
480
481
in
481
- make_alloc ~mode dbg Obj. closure_tag (transl_fundecls 0 fundecls )
482
+ make_alloc ~mode dbg Obj. closure_tag (transl_fundecls 0 functions )
482
483
| Uoffset (arg , offset ) ->
483
484
(* produces a valid Caml value, pointing just after an infix header *)
484
485
let ptr = transl env arg in
0 commit comments