@@ -131,8 +131,9 @@ type rhs_kind =
131
131
let rec expr_size env = function
132
132
| Uvar id ->
133
133
begin try V. find_same id env with Not_found -> RHS_nonrec end
134
- | Uclosure (fundecls , clos_vars ) ->
135
- RHS_block (fundecls_size fundecls + List. length clos_vars)
134
+ | Uclosure { functions ; not_scanned_slots ; scanned_slots } ->
135
+ RHS_block (fundecls_size functions + List. length not_scanned_slots
136
+ + List. length scanned_slots)
136
137
| Ulet (_str , _kind , id , exp , body ) ->
137
138
expr_size (V. add (VP. var id) (expr_size env exp) env) body
138
139
| Uletrec (bindings , body ) ->
@@ -369,18 +370,18 @@ let rec transl env e =
369
370
end
370
371
| Uconst sc ->
371
372
transl_constant Debuginfo. none sc
372
- | Uclosure ( fundecls , [] ) ->
373
+ | Uclosure { functions ; not_scanned_slots = [] ; scanned_slots = [] } ->
373
374
let sym = Compilenv. new_const_symbol() in
374
- Cmmgen_state. add_constant sym (Const_closure (Local , fundecls , [] ));
375
- List. iter (fun f -> Cmmgen_state. add_function f) fundecls ;
375
+ Cmmgen_state. add_constant sym (Const_closure (Local , functions , [] ));
376
+ List. iter (fun f -> Cmmgen_state. add_function f) functions ;
376
377
let dbg =
377
- match fundecls with
378
+ match functions with
378
379
| [] -> Debuginfo. none
379
380
| fundecl ::_ -> fundecl.dbg
380
381
in
381
382
Cconst_symbol (sym, dbg)
382
- | Uclosure ( fundecls , clos_vars ) ->
383
- let startenv = fundecls_size fundecls in
383
+ | Uclosure { functions ; not_scanned_slots ; scanned_slots } ->
384
+ let startenv = fundecls_size functions + List. length not_scanned_slots in
384
385
let mode =
385
386
Option. get @@
386
387
List. fold_left (fun s { mode; dbg; _ } ->
@@ -390,10 +391,10 @@ let rec transl env e =
390
391
if not (Lambda. eq_mode mode m') then
391
392
Misc. fatal_errorf " Inconsistent modes in let rec at %s"
392
393
(Debuginfo. to_string dbg);
393
- s) None fundecls in
394
+ s) None functions in
394
395
let rec transl_fundecls pos = function
395
396
[] ->
396
- List. map (transl env) clos_vars
397
+ List. map (transl env) (not_scanned_slots @ scanned_slots)
397
398
| f :: rem ->
398
399
let is_last = match rem with [] -> true | _ ::_ -> false in
399
400
Cmmgen_state. add_function f;
@@ -417,11 +418,11 @@ let rec transl env e =
417
418
else alloc_infix_header pos f.dbg :: without_header
418
419
in
419
420
let dbg =
420
- match fundecls with
421
+ match functions with
421
422
| [] -> Debuginfo. none
422
423
| fundecl ::_ -> fundecl.dbg
423
424
in
424
- make_alloc ~mode dbg Obj. closure_tag (transl_fundecls 0 fundecls )
425
+ make_alloc ~mode dbg Obj. closure_tag (transl_fundecls 0 functions )
425
426
| Uoffset (arg , offset ) ->
426
427
(* produces a valid Caml value, pointing just after an infix header *)
427
428
let ptr = transl env arg in
0 commit comments