PPC & GC [Was: Re: [gclist] Re: gclist-digest V2 #110]
Eugene Kuznetsov
kuznetso@MIT.EDU
Thu, 22 Jan 1998 15:49:55 EST
>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
Ah, that is a good one! This could definitely be very unpleasant with
preemptive multitasking, since (unlike array iterators and other optimizations)
for that brief moment there is no pointer to anywhere in the object/struct.
I think that if one has control over the code-generation, however, this
problem can be avoided without any additional overhead:
addi r3, r3, 32000 // adds 32000 to r3
lwz r3, 8000(r3) // 32000+8000 = 40000
(For larger structures, one could resume the use of 'addis', since it
would no longer produce an intermediary pointer pointing to the
_outside_ of the object).
Obviously, this does require that the GC deal with pointers to the middle
of objects, but presumably optimized C code would require that already.
Other RISC chips would have the same problem, since they usually cannot
deal with more than 32 or 64 K immediate offsets. I think the problem here
lies in the code generated, though, not in the chip specifically.
-- Eugene
P.S. I suppose the PPC assembly is a bit off-topic... If anyone's interested,
though, I do have a PPC mailing list for such purposes.