Usage of refTable in gc / declaration of VALIDREF

Tim Wilkinson tim at tjwassoc.co.uk
Mon Mar 24 03:47:55 PST 1997


Frank,

On Mon, 24 Mar 1997, Frank Mehnert wrote:

> the gc of kaffe uses a refTable to index each object. In function
> scanConservative each object is scanned to find any references to other
> objects. The macro VALIDREF tests if a reference is valid (declared in
> gc-incremental.h):
> 
> #define	VALIDREF(_r)					\
> 		((_r) / REF_MAXW < REF_MAXH &&		\
> 		refTable.width[(_r) / REF_MAXW] != 0)
> 
> But there is NOT a line refTable.width[0]!!! Compare function gc_malloc
> for this:
> 
> 	refTable.nextWidth++;
> 	assert(refTable.nextWidth < REF_MAXH);
> 	refTable.width[refTable.nextWidth] =
> 				checked_calloc(REF_MAXW, sizeof(uintp));
> 
> 
> So let us change the declaration of VALIDREF into
> 
> #define	VALIDREF(_r)						\
> 		(((_r)-REF_MAXH) / REF_MAXW < (REF_MAXH-1) &&	\
> 		refTable.width[(_r) / REF_MAXW] != 0)
> 
> Do you agree with that?

Well while I agree that I should be using the zero'th element of the
table (not sure why I'm not) I don't see anything wrong with the current
implementation per say (although I think some of the REF_MAXW and REF_MAXH
might be the wrong way round - so just as well they're both the same).

What bug is this trying to fix exactly?

Cheers
Tim

--
  Tim Wilkinson                         Tel/Fax: +44 181 440 0658
  T. J. Wilkinson & Associates,         Mobile:  +44 370 621006
  London, UK.                           Email:   tim at tjwassoc.co.uk



More information about the kaffe mailing list