Skip to content

Commit

Permalink
Use GC_HIDE_POINTER() in small_cons_uncollectable() of gctest
Browse files Browse the repository at this point in the history
(refactoring)

Issue #627 (bdwgc).

* tests/gctest.c (small_cons_uncollectable): Use GC_HIDE_POINTER().
* tests/gctest.c (UNCOLLECTABLE_CDR): Use GC_REVEAL_POINTER().
  • Loading branch information
ivmai committed Mar 23, 2024
1 parent dd30b0f commit 58e55d4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/gctest.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@ static sexpr small_cons_uncollectable(sexpr x, sexpr y)
sexpr r = (sexpr)checkOOM(GC_MALLOC_UNCOLLECTABLE(sizeof(struct SEXPR)));

AO_fetch_and_add1(&uncollectable_count);
r -> sexpr_cdr = (sexpr)(~(GC_word)y);
GC_PTR_STORE_AND_DIRTY(&r->sexpr_car, x);
r -> sexpr_cdr = (sexpr)GC_HIDE_POINTER(y);
GC_PTR_STORE_AND_DIRTY(&(r -> sexpr_car), x);
return r;
}

Expand Down Expand Up @@ -579,7 +579,7 @@ static void check_ints(sexpr list, int low, int up)
}
}

# define UNCOLLECTABLE_CDR(x) (sexpr)(~(GC_word)cdr(x))
#define UNCOLLECTABLE_CDR(x) (sexpr)GC_REVEAL_POINTER(cdr(x))

static void check_uncollectable_ints(sexpr list, int low, int up)
{
Expand Down

0 comments on commit 58e55d4

Please sign in to comment.