/* Define appropriate out-degrees for each of the two tree levels */ #ifdefined(LARGE_CONFIG) || !defined(SMALL_CONFIG) # define LOG_BOTTOM_SZ 10 #else # define LOG_BOTTOM_SZ 11 /* Keep top index size reasonable with smaller blocks. */ #endif #define BOTTOM_SZ (1 << LOG_BOTTOM_SZ)
/* Set hhdr to the header for p. Analogous to GET_HDR below, */ /* except that in the case of large objects, it gets the header for */ /* the object beginning if GC_all_interior_pointers is set. */ /* Returns zero if p points to somewhere other than the first page */ /* of an object, and it is not a valid pointer to the object. */ #define HC_GET_HDR(p, hhdr, source) \
{ /* cannot use do-while(0) here */ \
hdr_cache_entry * hce = HCE(p); \ if (EXPECT(HCE_VALID_FOR(hce, p), TRUE)) { \
HC_HIT(); \
hhdr = hce -> hce_hdr; \
} else { \
hhdr = HEADER_CACHE_MISS(p, hce, source); \ if (NULL == hhdr) break; /* go to the enclosing loop end */ \
} \
}
typedefstruct bi {
hdr * index[BOTTOM_SZ]; /* *Thebottomlevelindexcontainsoneofthreekindsofvalues: *0meanswe'renotresponsibleforthisblock, *orthisisablockotherthanthefirstoneinafreeblock. *1<(long)X<=MAX_JUMPmeanstheblockstartsatleast *X*HBLKSIZEbytesbeforethecurrentaddress. *Avalidpointerpointstoahdrstructure.(Theabovecan'tbe *validpointersduetotheGET_MEMreturnconvention.)
*/ struct bi * asc_link; /* All indices are linked in */ /* ascending order... */ struct bi * desc_link; /* ... and in descending order. */
word key; /* high order address bits. */ # ifdef HASH_TL struct bi * hash_link; /* Hash chain link. */ # endif
} bottom_index;
/* bottom_index GC_all_nils; - really part of GC_arrays */
/* extern bottom_index * GC_top_index []; - really part of GC_arrays */ /* Each entry points to a bottom_index. */ /* On a 32 bit machine, it points to */ /* the index for a set of high order */ /* bits equal to the index. For longer */ /* addresses, we hash the high order */ /* bits to compute the index in */ /* GC_top_index, and each entry points */ /* to a hash chain. */ /* The last entry in each chain is */ /* GC_all_nils. */
#define MAX_JUMP (HBLKSIZE - 1)
#define HDR_FROM_BI(bi, p) \
((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)]) # define HDR_INNER(p) HDR_FROM_BI(BI(p),p) # ifdef SMALL_CONFIG # define HDR(p) GC_find_header((ptr_t)(p)) # else # define HDR(p) HDR_INNER(p) # endif # define GET_BI(p, bottom_indx) (void)((bottom_indx) = BI(p)) # define GET_HDR(p, hhdr) (void)((hhdr) = HDR(p)) # define SET_HDR(p, hhdr) (void)(HDR_INNER(p) = (hhdr)) # define GET_HDR_ADDR(p, ha) (void)((ha) = &HDR_INNER(p)) #else/* hash */ /* Hash function for tree top level */ # define TL_HASH(hi) ((hi) & (TOP_SZ - 1)) /* Set bottom_indx to point to the bottom index for address p */ # define GET_BI(p, bottom_indx) \ do { \ REGISTER word hi = (word)(p) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE); \ REGISTER bottom_index * _bi = GC_top_index[TL_HASH(hi)]; \ while (_bi -> key != hi && _bi != GC_all_nils) \
_bi = _bi -> hash_link; \
(bottom_indx) = _bi; \
} while (0) # define GET_HDR_ADDR(p, ha) \ do { \ REGISTER bottom_index * bi; \
GET_BI(p, bi); \
(ha) = &HDR_FROM_BI(bi, p); \
} while (0) # define GET_HDR(p, hhdr) \ do { \ REGISTER hdr ** _ha; \
GET_HDR_ADDR(p, _ha); \
(hhdr) = *_ha; \
} while (0) # define SET_HDR(p, hhdr) \ do { \ REGISTER hdr ** _ha; \
GET_HDR_ADDR(p, _ha); \
*_ha = (hhdr); \
} while (0) # define HDR(p) GC_find_header((ptr_t)(p)) #endif
/* Is the result a forwarding address to someplace closer to the */ /* beginning of the block or NULL? */ #define IS_FORWARDING_ADDR_OR_NIL(hhdr) ((size_t) (hhdr) <= MAX_JUMP)
/* Get an HBLKSIZE aligned address closer to the beginning of the block */ /* h. Assumes hhdr == HDR(h) and IS_FORWARDING_ADDR(hhdr). */ #define FORWARDED_ADDR(h, hhdr) ((struct hblk *)(h) - (size_t)(hhdr))
EXTERN_C_END
#endif/* GC_HEADERS_H */
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.12Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-17)
¤