Andrei Alexandrescu, el 26 de octubre a las 11:01 me escribiste: > Sean Kelly wrote: > >dsimcha Wrote: > > > >>== Quote from Sean Kelly ([email protected])'s article > >>>dsimcha Wrote: > >>>>I just realized last night that D's templates are probably powerful > >>>>enough now > >>>>to generate bit masks that can be used for precise GC heap scanning. I'm > >>>>halfway (emphasis on halfway) thinking of using this to try to hack the > >>>>GC and > >>>>make heap scanning fully precise except for the corner case of unions. > >>>>However, this ties into several things that others in the D community are > >>>>doing, so I want to gauge people's responses and make sure I'm not wasting > >>>>effort on something that will be useless in 6 months. > >>>> > >>>>1. Sean, Leonardo, whoever else may be working on GC implementations, > >>>>have > >>>>you by any chance broken ground on precise heap scanning already? > >>>I've thought about it, but not done anything about it. The compiler > >>>doesn't > >>provide this information, so precise scanning would require a user-level > >>call. > >>You'll also have to deal with arrays of structs, by the way. > >> > >>Arrays of structs are easy: Generate a bitmask for one element, and keep > >>reusing > >>that bitmask until the end of the block. Am I missing something? > > > >Nope. > > One question is, is there enough information for stack variables? My > understanding from a while ago was that heap data could be > reasonably analyzed, but stack data has no info associated with it.
There is some discussion about precise stack in the thread I cited too. The stack can be also precise adding a shadow stack (like a TypeInfo for the stack) but it's costly and it needs compiler support (LLVM has some mechanisms to generate this stack information AFAIK but I never played with it). The problem with the stack is that you still have to interact with C, which has no stack information, so it's a little more controversial about how much the extra complexity will pay off. I agree with David that it's much more reasonable to make the heap precise first and then see how thing are going from that. -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- hypocrite opportunist don't infect me with your poison
