Re: Unions destructors and GC precision

2012-08-15 Thread Paulo Pinto
On Wednesday, 15 August 2012 at 05:10:02 UTC, Jonathan M Davis wrote: On Wednesday, August 15, 2012 07:02:25 Simen Kjaeraas wrote: On Tue, 14 Aug 2012 22:32:58 +0200, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 8/14/12 3:25 PM, bearophile wrote: D2 doesn't give you that

Re: Unions destructors and GC precision

2012-08-15 Thread Simen Kjaeraas
On Wed, 15 Aug 2012 07:09:40 +0200, Jonathan M Davis jmdavisp...@gmx.com wrote: On Wednesday, August 15, 2012 07:02:25 Simen Kjaeraas wrote: On Tue, 14 Aug 2012 22:32:58 +0200, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 8/14/12 3:25 PM, bearophile wrote: D2 doesn't give

Re: Unions destructors and GC precision

2012-08-15 Thread bearophile
Paulo Pinto: Same thing about unions, as you wouldn't know which pointer/reference is the active one without some kind of tagging. But with a standard method like activeField the tagging doesn't need to be explicit. Bye, bearophile

Unions destructors and GC precision

2012-08-14 Thread bearophile
(); } -- A related problem with unions is the GC precision. We want a more precise GC, but unions reduce the precision. To face this problem time ago I have suggested to add standard method named onMark() that is called at run-time by the GC. It returns the positional number

Re: Unions destructors and GC precision

2012-08-14 Thread Andrei Alexandrescu
On 8/14/12 3:25 PM, bearophile wrote: D2 doesn't give you that restriction, and when an union goes out of scope it calls the destructors of all its fields: That's pretty surprising. Major bug doesn't begin to describe it. Unions should call no constructors and no destructors. Andrei

Re: Unions destructors and GC precision

2012-08-14 Thread bearophile
. But this doesn't address the GC precision problem. Some kind of tagging field (or equivalent information) isn't always available, but in many cases it's available, so in many practical cases I am able to put something useful inside a standard method like activeField(). If this method is available

Re: Unions destructors and GC precision

2012-08-14 Thread Simen Kjaeraas
On Tue, 14 Aug 2012 22:32:58 +0200, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 8/14/12 3:25 PM, bearophile wrote: D2 doesn't give you that restriction, and when an union goes out of scope it calls the destructors of all its fields: That's pretty surprising. Major bug

Re: Unions destructors and GC precision

2012-08-14 Thread Jonathan M Davis
On Wednesday, August 15, 2012 07:02:25 Simen Kjaeraas wrote: On Tue, 14 Aug 2012 22:32:58 +0200, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 8/14/12 3:25 PM, bearophile wrote: D2 doesn't give you that restriction, and when an union goes out of scope it calls the

Re: GC Precision

2009-10-29 Thread bearophile
dsimcha: A moving GC, one that doesn't stop the world on collection, and one that's fully precise including stack would be nice, but they're several orders of magnitude less important and would also have more ripple effects. I agree that here doing something simple now is better than doing

Re: GC Precision

2009-10-29 Thread Jacob Carlborg
On 10/29/09 11:47, bearophile wrote: dsimcha: A moving GC, one that doesn't stop the world on collection, and one that's fully precise including stack would be nice, but they're several orders of magnitude less important and would also have more ripple effects. I agree that here doing

Re: GC Precision

2009-10-29 Thread bearophile
Jacob Carlborg: The current implementation of toHash in Object does that: return cast(hash_t)cast(void*)this; I agree, such things will have to change when D wants a moving GC. Bye, bearophile

Re: GC Precision

2009-10-27 Thread Leandro Lucarella
dsimcha, el 27 de octubre a las 01:34 me escribiste: 2. Some concern has been expressed in the past about the possibility of using 4 bytes per block in overhead to store pointers to bitmasks. IMHO this concern is misplaced because in any program that takes up enough memory for

GC Precision

2009-10-26 Thread dsimcha
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

Re: GC Precision

2009-10-26 Thread Sean Kelly
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

Re: GC Precision

2009-10-26 Thread dsimcha
== Quote from Sean Kelly (s...@invisibleduck.org)'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

Re: GC Precision

2009-10-26 Thread Leandro Lucarella
dsimcha, el 26 de octubre a las 13:08 me escribiste: 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

Re: GC Precision

2009-10-26 Thread Sean Kelly
dsimcha Wrote: == Quote from Sean Kelly (s...@invisibleduck.org)'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

Re: GC Precision

2009-10-26 Thread Andrei Alexandrescu
Sean Kelly wrote: dsimcha Wrote: == Quote from Sean Kelly (s...@invisibleduck.org)'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)

Re: GC Precision

2009-10-26 Thread dsimcha
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article Sean Kelly wrote: dsimcha Wrote: == Quote from Sean Kelly (s...@invisibleduck.org)'s article dsimcha Wrote: I just realized last night that D's templates are probably powerful enough now to generate bit

Re: GC Precision

2009-10-26 Thread Andrei Alexandrescu
dsimcha wrote: == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article Sean Kelly wrote: dsimcha Wrote: == Quote from Sean Kelly (s...@invisibleduck.org)'s article dsimcha Wrote: I just realized last night that D's templates are probably powerful enough now to generate

Re: GC Precision

2009-10-26 Thread dsimcha
I've spent some free brain cycles today thinking about this and here's the scheme I have in mind. If anyone thinks this could be improved in a way that would not have substantial ripple effects throughout the compiler/language (because then it might never actually get implemented) let me know.

Re: GC Precision

2009-10-26 Thread Leandro Lucarella
Andrei Alexandrescu, el 26 de octubre a las 11:01 me escribiste: Sean Kelly wrote: dsimcha Wrote: == Quote from Sean Kelly (s...@invisibleduck.org)'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

Re: GC Precision

2009-10-26 Thread Leandro Lucarella
dsimcha, el 26 de octubre a las 23:05 me escribiste: I've spent some free brain cycles today thinking about this and here's the scheme I have in mind. If anyone thinks this could be improved in a way that would not have substantial ripple effects throughout the compiler/language (because

Re: GC Precision

2009-10-26 Thread dsimcha
== Quote from Leandro Lucarella (llu...@gmail.com)'s article dsimcha, el 26 de octubre a las 23:05 me escribiste: I've spent some free brain cycles today thinking about this and here's the scheme I have in mind. If anyone thinks this could be improved in a way that would not have