Skip to content

Commit 41c8e59

Browse files
authored
flambda-backend: Skip closure non-scannable environment in oldify_mopup (#2587)
* skip closure non scannable env * edit
1 parent ca99fbd commit 41c8e59

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

runtime/minor_gc.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,16 @@ static void oldify_mopup (struct oldify_state* st, int do_ephemerons)
449449
oldify_one (st, f, Op_val (new_v));
450450
}
451451

452-
for (i = 1; i < scannable_wosize; i++){
452+
i = 1;
453+
454+
if(Tag_val(new_v) == Closure_tag) {
455+
mlsize_t non_scannable = Start_env_closinfo(Closinfo_val(v));
456+
for (; i < non_scannable; i++) {
457+
Field(new_v, i) = Field(v, i);
458+
}
459+
}
460+
461+
for (; i < scannable_wosize; i++){
453462
f = Field(v, i);
454463
CAMLassert (!Is_debug_tag(f));
455464
if (Is_block (f) && Is_young(f)) {

runtime4/minor_gc.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,17 @@ void caml_oldify_mopup (void)
340340
if (Is_block (f) && Is_young (f)){
341341
caml_oldify_one (f, &Field (new_v, 0));
342342
}
343-
for (i = 1; i < scannable_wosize; i++){
343+
344+
i = 1;
345+
346+
if(Tag_val(new_v) == Closure_tag) {
347+
mlsize_t non_scannable = Start_env_closinfo(Closinfo_val(v));
348+
for (; i < non_scannable; i++) {
349+
Field(new_v, i) = Field(v, i);
350+
}
351+
}
352+
353+
for (; i < scannable_wosize; i++){
344354
f = Field (v, i);
345355
if (Is_block (f) && Is_young (f)){
346356
caml_oldify_one (f, &Field (new_v, i));

0 commit comments

Comments
 (0)