Buscar a Kyle y sean_k en #d o #d.tango ======================================= Charla sobre GC de D: ===================== 2007-01-03: sean_k, my name is Leandro Lucarella, I'm starting my grade thesis on garbage collection and I'm planning to do it in the context of D, so I was asking what's the relation between Tango and D GC I'm in an early stage of research, so any (basic) information about how D is doing GC is welcome Tango is effectively a replacement for Phobos, so it contains language runtime code and a garbage collector, equivalent to what's in phobos/internal and phobos/internal/gc. Tango, however, splits the functionality out into separate components, so you can swap in a different GC implementation at application link-time. The defult Tango GC is a modified version of the one in Phobos. so the GC of D lives in phobos and it's completely implemented in D? yes The D GC was written by Walter. It's a mark/sweep garbage collector. Basically, if new called and the GC doesn't have any memory available then it runs a collection and checkts its pool again. If there still isn't enough memory for the operation then it will allocate a new page from the OS via mmap (Posix) or VirtualAlloc (Windows). great so there's is no support from the compiler (I mean, the GC just uses the regular compiler features, there are no compiler "hooks" for the GC)? Not really, no. The only compiler "hooks" are simply the calls that forward "new" and "delete" to internal functions. good Is there any good source about the D runtime? I mean, what is done until you get to the D main()? Like who and when the GC is started There's no documentation for that, but in Phobos the startup code is in internal/dmain2.d. Before D main is entered, all static module ctors in the app will be run, and unit tests as well if -unittest was specified at the command-line. Other than that, the garbage collector and thread code is initialized. The GC is initialized via a call to gc_init(), and it in turn initializes the thread code via thread_init() (I think). The GC is required to initialize the thread code because it relies on the thread code for portions of its collection phase. First, it suspends all running threads, then it scans each of their stacks, then it resumes the threads. The thread code is responsible for suspending and resuming threads and for telling the GC where each stack is. GCC Internals: ============== >Ok, I'll search the net. May I ask how did you learn how to hack gcc to >add D support? > > I started reading the internals guide (http://gcc.gnu.org/onlinedocs/gccint/), but that was very incomplete/misleading/out of date. My other major source was the GNU Pascal compiler sources. Beyond that, it was mostly analyzing the GCC source and trail-and-error. Quejas sobre el GC de D: ======================== The problem with the D GC: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=46407 Full Reflection Gets You Smarter GC: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=44607 shootout.binarytrees when implemented with gc is 10x slower than C# on .NET 2.0: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=43991 Is a moving GC really needed?: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=42557 GC, the simple solution (propuesta de reference counting, son sus problemas): http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=38689 GC implementation (problemas de seguridad de GC conservativo): http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=35364 How does RTTI help gc?: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=29291 thread and gc.fullCollect (bug en GC?): http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=5821 Transitioning to a type aware Garbage Collector: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.announce&article_id=6842 http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=5821 Programas que rompen (rompían) el GC: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=46407 http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.announce&article_id=6978 http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=54084 http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=56261 Compile-time compiler: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=49164 Más problemas de performance del GC de D (comparado con java6 en el shootout): http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=62369