Converting GC

Stephen Weeks sweeks@intertrust.com
Thu, 13 Jul 2000 17:01:52 -0700 (PDT)


> It would probably be nice
> to keep identical runtime systems for the two codegens.

I would like this if at all possible.

> We can probably
> use the same frameLayouts structure, and just change the accesses to it.
> I only count two that would really need to be changed.  We'd just have to
> replace frameLayout[exp] with frameLayout[getIndex(exp)] where getIndex
> branches on some value which tells whether or not we're using the native
> backend.  If not, just return the value of the expression.  If so, then
> convert the value of the expression (which should be a label address) into
> it's corresponding index, probably via a hash table.  

I vote for a minor variant of this approach.  Something like:

static inline GC_frameLayout* getFrameLayout(GC_state s, word index) {
	if (s->isNative) {
		/* hash table stuff */
	} else {
		return &(s->frameLayouts[index]);
	}
}