This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: generalized lvalues


On 18 Nov 2004, at 17.41, Zack Weinberg wrote:

Ziemowit Laski <zlaski@apple.com> writes:

The __builtin_gc_register approach would require that the entire GC
API be redesigned, and of course would be extremely inefficient, since
_every_ assignment in a program would have to go through a
write-barrier which would either do something or nothing depending on
whether __builtin_gc_register and/or __builtin_gc_unregister has been
called.

I think you misunderstood what I meant it to mean - it was intended to be a suggestion for alternative notation producing *exactly the same code generation* as your proposal. In other words, the effect of __builtin_gc_register would be to notify the compiler to generate write barriers for every assignment to ptr from then until a subsequent __builtin_gc_unregister.

Oh, OK. I read __builtin_gc_register like a regular statement
(i.e., affected by control-flow), whereas you're giving it a more #pragma-like flavor.


__builtin_objc_gc_strong(ptr) = object;

How about


__builtin_with_write_barrier (ptr = object);

Actually, a secret admirer gave me an off-list suggestion for


__builtin_with_write_barrier(ptr, object);

which ain't bad. :-) Note that I do need to hand both 'ptr' and 'object' (and not just the
result of the assignment) to the write-barrier.


Tangentially. I am not enthused by the implication that you (Apple)
have implemented write barriers by compiler annotation of pointer
operations.  That's not my idea of state-of-the-art GC technology.

I'm no GC maven, and so can't really argue that one with you. I will say, though, that
the objective here was to introduce GC into Objective-C in a way that was binary compatible
with legacy ObjC programs running against the new runtime. So our theoretical playing field
was not very large here. In a way, this is very similar to our _setjmp()/_longjmp()-based
EH in ObjC and why we could not use the DWARF EH approach.


Actually, I'm not sure what you mean by "compiler annotation of pointer operations" --
the write-barriers (of which there are several flavors!) are all implemented as API calls into
the runtime.


--Zem


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]