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: GCC Garbage Collection


On Nov 13, 2006, at 3:30 PM, Brendon Costa wrote:
I used the idea you showed above and it seems to work (I dont understand enough to know why you say it wont work and thus this email).

It is the difference between all features of gcc working, or just most of the features working. If you want pch to work, you have to think about the issue and do up the appropriate code. However, I bet you don't need pch to work. If you are doing real stuff for a real production compiler, well, I retract that.


If you want it to work, the rules are simple, all data must be allocated and managed by gc and have GTY(()) markers. You can escape the simplicity of this, if you want, but that requires way more thought and more code, slightly beyond the scope of this email.

During PCH writting, all GTY(()) data will be written out to a file (the output of compiling a .h file), and during #include of a PCH file, all that data is read in again.

I dont think I understand the relationship between the PCH files and the garbage collector. I thought that the PCH files were the gt-*.h files which are generated,

Not exactly. PCH files are the result of compiling a header file. The gt-*.h files are used by gc, and the PCH mechanism uses gc to work its magic.


None of my data structures are being managed by the garbage collector, i manually malloc and free them so I figured that I did not need to worry about modifying a PCH writer to cater for them?

You have it backwards, if you use gc (and mark them), you don't have to worry, otherwise, its a lot more code, if you want everything to work.



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