Skip to content

Commit

Permalink
actually check whether obj is in freelist
Browse files Browse the repository at this point in the history
  • Loading branch information
Diogo Netto committed Jul 13, 2023
1 parent 432157f commit 20c3278
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4073,10 +4073,18 @@ JL_DLLEXPORT jl_value_t *jl_gc_internal_obj_base_ptr(void *p)
// before the freelist pointer was either live during the last
// sweep or has been allocated since.
if (gc_page_data(cell) == gc_page_data(pool->freelist)
&& (char *)cell < (char *)pool->freelist)
&& (char *)cell < (char *)pool->freelist) {
goto valid_object;
else
return NULL;
}
else {
jl_taggedvalue_t *v = pool->freelist;
while (v != NULL) {
if (v == cell) {
return NULL;
}
v = v->next;
}
}
// Not a freelist entry, therefore a valid object.
valid_object:
// We have to treat objects with type `jl_buff_tag` differently,
Expand Down

0 comments on commit 20c3278

Please sign in to comment.