Basile Starynkevitch wrote, On Friday 16 November 2012 03:36 PM:
To be more specific, I call garbage collection a scheme where (small newbie) GCC contributors can contribute easily some code to GCC without having to understand when, and how precisely, some data will be freed. If a user adds a pass (or a builtin) which adds e.g. some Gimple,
Couldn't agree with you more! Imagine my frustration when GDFA (generic data flow analyzer, http://www.cse.iitb.ac.in/grc/index.php?page=gdfa) that was working fine with GCC-4.3.0 suddenly started seg faulting in current version. The first few passes (eg. available expressions analysis, live variables analysis, partially available expressions analysis) work fine but the later pass of partial redundancy elimination seg faults. It took us some time to figure out that the data flow information computed in earlier passes is no longer available in the later passes.
Memory liveness is a global non-modular property of data. Whatever is done in GCC should be helpful to newbie GCC contributors. The current situation is quite bad : only a few (perhaps a dozen or two) GCC gurus have in their brain a clear enough picture of GCC memory to be able to assess it reliably. And in the current scheme, a pass (e.g. added by a plugin) may have to manage its memory manually.
Can someone point me to a document (or may be comments in some file) that describe the overall memory management strategy? Which data created by a pass can be expected to live outside of the pass, which data cannot be expected to live outside of the pass?
I believe that we should state what are the objectives with the memory allocation part. My opinion is one of the strongest objective should be to ease the contribution of GCC newbies; they should not need to read a lot of code or documentation related to memory management before understanding how to add their own work, in a reliable way, to GCC.
Completely agree. It is very important to avoid surprises and unimaginable side effects. Uday Khedker.