Skip to content

Commit cd2ed2b

Browse files
committed
During major GC, scan the environment part of closures only
Here we start reaping the benefits of the new closure representation. The fields of a closure block that contain the code pointers need not be scanned (in general) and must not be scanned (in no-naked-pointers mode). Here, conservatively, we skip them in no-naked-pointers mode only, but it would be sound to skip them unconditionally.
1 parent 14c96d1 commit cd2ed2b

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

runtime/major_gc.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,7 @@ Caml_inline value* mark_slice_darken(value *gray_vals_ptr,
239239
#ifdef NATIVE_CODE_AND_NO_NAKED_POINTERS
240240
if (Is_block (child)
241241
&& ! Is_young (child)
242-
&& Wosize_val (child) > 0 /* Atoms never need to be marked. */
243-
/* Closure blocks contain code pointers at offsets that cannot
244-
be reliably determined, so we always use the page table when
245-
marking such values. */
246-
&& (!(Tag_val (v) == Closure_tag || Tag_val (v) == Infix_tag) ||
247-
Is_in_heap (child))) {
242+
&& Wosize_val (child) > 0) { /* Atoms never need to be marked. */
248243
#else
249244
if (Is_block (child) && Is_in_heap (child)) {
250245
#endif
@@ -398,6 +393,13 @@ static void mark_slice (intnat work)
398393
CAMLassert (start == 0);
399394
v = *--gray_vals_ptr;
400395
CAMLassert (Is_gray_val (v));
396+
#ifdef NO_NAKED_POINTERS
397+
if (Tag_val(v) == Closure_tag) {
398+
/* Skip the code pointers and integers at beginning of closure;
399+
start scanning at the first word of the environment part. */
400+
start = Start_env_closinfo(Closinfo_val(v));
401+
}
402+
#endif
401403
}
402404
if (v != 0){
403405
hd = Hd_val(v);

0 commit comments

Comments
 (0)