[gclist] Re: gclist-digest V2 #110

David Chase chase@world.std.com
Thu, 22 Jan 1998 15:11:30 -0500


At 02:21 PM 1/22/98 EST, Eugene Kuznetsov wrote:
>
>>Emacs is widely ported, and some platforms (notably
>>the PPC) have code generation idioms that are not safe for a
>>conservative GC.
>
>Having worked on a few conservative GC's running on PPC chips and
>PPC code generators, I've never observed any GC problems specifically tied to
>the PPC ABI or code generation.  Could you elaborate on how the PowerPC is
>less suitable for conservative collectors?

In C, compile this program:

  struct odd {
     char padding[40000];
     int x;
  }

  int getX(struct odd * o) {
     return o -> x;
  }

you should see something like (using the PPC mnemonics)

  addis r3,r3,1       // adds 1 << 16 = 65536 to r3
  lwz   r3,-25536(r3) // r3+65536-25536=40000

in the generated code.

If this thread of execution is preempted between the
addis and the lwz, r3 does not appear to reference the
structure that it in fact does reference.
If that is the only "reference" to that structure,
then the memory could be recycled.

Obviously this depends upon things being "just so",
and the failures will be extremely rare.

Ah, I just had a bad emacs flashback.  There's a piece of
code in one of their obstack macros that takes the
difference D between pointers P and Q, frees Q, then
reconstitutes P using Q + D.  (When I worked at Centerline
we ran either gnuemacs or xemacs through C++Expert as
a test case, and this was one of the viler pieces of
cruft that we discovered.)

David Chase