diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2021-12-02 08:13:01 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2021-12-02 11:13:41 +0300 |
commit | 1f1e0df060adeaa13c21ad387c38eed61006c221 (patch) | |
tree | 9152631fe76d49232682a6ba9f16e42f74a7eeb1 | |
parent | 8c5cc147c893f42d531707afb1aa838c11459445 (diff) | |
download | bdwgc-1f1e0df060adeaa13c21ad387c38eed61006c221.tar.gz |
Assert SET_HDR does not write to GC_all_nils
Issue #237 (bdwgc).
* include/private/gc_hdrs.h (HDR_FROM_BI): Delete outer parentheses.
* include/private/gc_hdrs.h [HASH_TL] (SET_HDR): Expand GET_HDR_ADDR();
add assertion that bi is not GC_all_nils.
-rw-r--r-- | include/private/gc_hdrs.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/private/gc_hdrs.h b/include/private/gc_hdrs.h index a6e7037a..f5bd62f6 100644 --- a/include/private/gc_hdrs.h +++ b/include/private/gc_hdrs.h @@ -155,7 +155,7 @@ typedef struct bi { #define MAX_JUMP (HBLKSIZE - 1) #define HDR_FROM_BI(bi, p) \ - ((bi)->index[((word)(p) >> LOG_HBLKSIZE) & (BOTTOM_SZ - 1)]) + (bi)->index[((word)(p) >> LOG_HBLKSIZE) & (BOTTOM_SZ - 1)] #ifndef HASH_TL # define BI(p) (GC_top_index \ [(word)(p) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE)]) @@ -195,9 +195,10 @@ typedef struct bi { } while (0) # define SET_HDR(p, hhdr) \ do { \ - REGISTER hdr ** _ha; \ - GET_HDR_ADDR(p, _ha); \ - *_ha = (hhdr); \ + REGISTER bottom_index * bi; \ + GET_BI(p, bi); \ + GC_ASSERT(bi != GC_all_nils); \ + HDR_FROM_BI(bi, p) = (hhdr); \ } while (0) # define HDR(p) GC_find_header((ptr_t)(p)) #endif |