Skip to content

Commit b471067

Browse files
committed
Add assertions for caml_ephe_ref_table in minor_gc
1 parent cbbc86b commit b471067

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

byterun/caml/minor_gc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ static inline void add_to_ephe_ref_table (struct caml_ephe_ref_table *tbl,
8787
ephe_ref = tbl->ptr++;
8888
ephe_ref->ephe = ar;
8989
ephe_ref->offset = offset;
90+
Assert(ephe_ref->offset < Wosize_val(ephe_ref->ephe));
9091
}
9192

9293
#endif /* CAML_MINOR_GC_H */

byterun/minor_gc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ void caml_oldify_one (value v, value *p)
280280
static inline int ephe_check_alive_data(struct caml_ephe_ref_elt *re){
281281
mlsize_t i;
282282
value child;
283-
for (i = 2; i < Wosize_val(re->ephe); i++){
283+
for (i = CAML_EPHE_FIRST_KEY; i < Wosize_val(re->ephe); i++){
284284
child = Field (re->ephe, i);
285285
if(child != caml_ephe_none
286286
&& Is_block (child) && Is_young (child)
@@ -371,6 +371,7 @@ void caml_empty_minor_heap (void)
371371
/* Update the ephemerons */
372372
for (re = caml_ephe_ref_table.base;
373373
re < caml_ephe_ref_table.ptr; re++){
374+
Assert(re->offset < Wosize_val(re->ephe));
374375
value *key = &Field(re->ephe,re->offset);
375376
if (*key != caml_ephe_none && Is_block (*key) && Is_young (*key)){
376377
if (Hd_val (*key) == 0){ /* Value copied to major heap */

0 commit comments

Comments
 (0)