Russell Whitaker wrote:
found this at http://gcc.gnu.org/projects/
Miscellaneous ideas:
Chill should use garbage collection.
Convert the Chill front end to use garbage collection instead of obstacks, so that it can work again with current GCC.
Suspect this should apply to gpc as well.
Indeed. That's one of the main issues when moving GPC to gcc-3. Other issues are a numer of changed interfaces, though this will probably mostly be "mechanical" work.
Any guess how much time and effort it would take to make the change?
According to a talk with Peter, it will be on the order of several days to a few weeks. If several people will work on it, it will be easier on everyone, of course. Are you interested in helping?
da Silva, Joe wrote:
IMHO, garbage collection is a kludge to fix memory leakage problems, which are a particularly common affliction with C, with it's particularly heavy reliance on pointers ... <BG>
Excuse me, but I think that's more of a prejudice here. What the compiler does internally relies heavily on tree structures. These require pointers in *any* language -- though some languages hide the fact. Pascal doesn't hide it, so the tree handling code and the resulting memory management problems would be exactly the same if GPC was written in Pascal.
Other typical usages of pointers in C, such as for strings, are relatively few in GCC/GPC, and are not the problem.
The "obstacks" were something like a "half-hearted" garbage collector and cause(d) many problems, so it's good to get rid of them, anyway, even if gcc-3 would not require it.
Of course, there are other alternatives to GC, such as reference counting. But that's not without cost either: it requires traversing all structures to get rid of, which costs runtime and is even a little tricky in the presence of recursive structures. And it costs memory to store the reference counters while GC has no significant memory costs AFAIK (only runtime costs).
So, from the programmer's perspective, GC is probably the easiest to live with, and also at runtime, it might not be worse than the alternatives.
Or am I missing the perfect solution?
Frank