/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991, 1992 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to copy this garbage collector for any purpose, * provided the above notices are retained on all copies. */ # ifndef GC←HEADERS←H # define GC←HEADERS←H typedef struct hblkhdr hdr; # define LOG←TOP←SZ 11 # define LOG←BOTTOM←SZ (WORDSZ - LOG←TOP←SZ - LOG←HBLKSIZE) # define TOP←SZ (1 << LOG←TOP←SZ) # define BOTTOM←SZ (1 << LOG←BOTTOM←SZ) # define MAX←JUMP (HBLKSIZE - 1) extern hdr ** GC←top←index []; # define HDR(p) (GC←top←index \ [(unsigned long)(p) >> (LOG←BOTTOM←SZ + LOG←HBLKSIZE)] \ [((unsigned long)(p) >> LOG←HBLKSIZE) & (BOTTOM←SZ - 1)]) /* Is the result a forwarding address to someplace closer to the */ /* beginning of the block or NIL? */ # define IS←FORWARDING←ADDR←OR←NIL(hhdr) ((unsigned long) (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) - (unsigned long)(hhdr)) # endif /* GC←HEADERS←H */