Re: GSoC 2016 - Precise GC

2016-05-08 Thread thedeemon via Digitalmars-d-announce

On Sunday, 8 May 2016 at 11:16:56 UTC, deadalnix wrote:

Ones that have only pointers are probably OK too. Though I'm 
not sure if a precise scanner takes into account the type of 
the pointer. I would expect it to use embedded typeinfo in 
target block.


-Steve


Because of void* and classes, the GC MUST be able to find out 
what type was actually allocated, or at least its pointer 
bitmask.


Yep, and it does that by looking at metadata of the pointed 
object itself, it doesn't care about the type of pointer to that 
object. I mean if we have object x of class X in heap and 
pointers "X p1", "void* p2" and "Y p3" all having same value  
(pointing to the same address) then GC will have no problem in 
scanning x as long as it can access x's type info knowing the 
address of x in heap. Which means all p1, p2 and p3 might easily 
be just at one position in a union and that would not be a 
problem.


Re: GSoC 2016 - Precise GC

2016-05-08 Thread Pham via Digitalmars-d-announce

On Friday, 6 May 2016 at 09:06:59 UTC, Dmitry Olshansky wrote:

On 06-May-2016 05:37, Jeremy DeHaan wrote:

On Wednesday, 4 May 2016 at 12:42:30 UTC, jmh530 wrote:

On Wednesday, 4 May 2016 at 02:50:08 UTC, Jeremy DeHaan wrote:

You can identify safe functions with
https://dlang.org/phobos/std_traits.html#isSafe
or
https://dlang.org/phobos/std_traits.html#functionAttributes


All I meant was that I don't know enough about what the 
compiler does
with built in types to make this work. It almost sounds like 
we would
need a safe union and unsafe union type and do some extra 
stuff for the

unsafe union, but I'm just starting to learn about this stuff.


I'd note that a union without pointers doesn't hurt precise 
scanner, it's only the ones with pointers that are bad.


Union is an user-defined-kind value and only user codes can tell 
the difference. I believe this will also effect the reference 
count implementation. I suggest that when a type has a union 
member, it should create a function such as gcValues with a 
parameter of output range of record (offset: size_t, type: 
typeid). the function should return that info based on whatever 
the actual value of those pointer types.  If that function is 
missing, use conservative approach as before


Cheers
Pham


Re: GSoC 2016 - Precise GC

2016-05-08 Thread deadalnix via Digitalmars-d-announce

On Friday, 6 May 2016 at 09:31:08 UTC, Steven Schveighoffer wrote:

On 5/6/16 11:06 AM, Dmitry Olshansky wrote:

On 06-May-2016 05:37, Jeremy DeHaan wrote:

On Wednesday, 4 May 2016 at 12:42:30 UTC, jmh530 wrote:
On Wednesday, 4 May 2016 at 02:50:08 UTC, Jeremy DeHaan 
wrote:


I'm not sure, but one would think that @safe code wouldn't 
need any

extra information about the union. I wouldn't know how to
differentiate between them though during runtime. Probably 
someone
with more experience with the compiler would know more 
about that

kind of thing.


You can identify safe functions with
https://dlang.org/phobos/std_traits.html#isSafe
or
https://dlang.org/phobos/std_traits.html#functionAttributes


All I meant was that I don't know enough about what the 
compiler does
with built in types to make this work. It almost sounds like 
we would
need a safe union and unsafe union type and do some extra 
stuff for the

unsafe union, but I'm just starting to learn about this stuff.


I'd note that a union without pointers doesn't hurt precise 
scanner,

it's only the ones with pointers that are bad.



Ones that have only pointers are probably OK too. Though I'm 
not sure if a precise scanner takes into account the type of 
the pointer. I would expect it to use embedded typeinfo in 
target block.


-Steve


Because of void* and classes, the GC MUST be able to find out 
what type was actually allocated, or at least its pointer bitmask.


Re: GSoC 2016 - Precise GC

2016-05-06 Thread Leandro Lucarella via Digitalmars-d-announce

On Tuesday, 3 May 2016 at 18:15:20 UTC, Jeremy DeHaan wrote:
Not sure if it is something I can get to in the course of my 
project though. Scanning only unions conservatively is still 
pretty good.


And the stack, and the CPU registers, but yeah, it should be a 
minority.


Re: GSoC 2016 - Precise GC

2016-05-06 Thread Steven Schveighoffer via Digitalmars-d-announce

On 5/6/16 11:06 AM, Dmitry Olshansky wrote:

On 06-May-2016 05:37, Jeremy DeHaan wrote:

On Wednesday, 4 May 2016 at 12:42:30 UTC, jmh530 wrote:

On Wednesday, 4 May 2016 at 02:50:08 UTC, Jeremy DeHaan wrote:


I'm not sure, but one would think that @safe code wouldn't need any
extra information about the union. I wouldn't know how to
differentiate between them though during runtime. Probably someone
with more experience with the compiler would know more about that
kind of thing.


You can identify safe functions with
https://dlang.org/phobos/std_traits.html#isSafe
or
https://dlang.org/phobos/std_traits.html#functionAttributes


All I meant was that I don't know enough about what the compiler does
with built in types to make this work. It almost sounds like we would
need a safe union and unsafe union type and do some extra stuff for the
unsafe union, but I'm just starting to learn about this stuff.


I'd note that a union without pointers doesn't hurt precise scanner,
it's only the ones with pointers that are bad.



Ones that have only pointers are probably OK too. Though I'm not sure if 
a precise scanner takes into account the type of the pointer. I would 
expect it to use embedded typeinfo in target block.


-Steve


Re: GSoC 2016 - Precise GC

2016-05-06 Thread Dmitry Olshansky via Digitalmars-d-announce

On 06-May-2016 05:37, Jeremy DeHaan wrote:

On Wednesday, 4 May 2016 at 12:42:30 UTC, jmh530 wrote:

On Wednesday, 4 May 2016 at 02:50:08 UTC, Jeremy DeHaan wrote:


I'm not sure, but one would think that @safe code wouldn't need any
extra information about the union. I wouldn't know how to
differentiate between them though during runtime. Probably someone
with more experience with the compiler would know more about that
kind of thing.


You can identify safe functions with
https://dlang.org/phobos/std_traits.html#isSafe
or
https://dlang.org/phobos/std_traits.html#functionAttributes


All I meant was that I don't know enough about what the compiler does
with built in types to make this work. It almost sounds like we would
need a safe union and unsafe union type and do some extra stuff for the
unsafe union, but I'm just starting to learn about this stuff.


I'd note that a union without pointers doesn't hurt precise scanner, 
it's only the ones with pointers that are bad.


--
Dmitry Olshansky


Re: GSoC 2016 - Precise GC

2016-05-05 Thread Jeremy DeHaan via Digitalmars-d-announce

On Wednesday, 4 May 2016 at 12:42:30 UTC, jmh530 wrote:

On Wednesday, 4 May 2016 at 02:50:08 UTC, Jeremy DeHaan wrote:


I'm not sure, but one would think that @safe code wouldn't 
need any extra information about the union. I wouldn't know 
how to differentiate between them though during runtime. 
Probably someone with more experience with the compiler would 
know more about that kind of thing.


You can identify safe functions with
https://dlang.org/phobos/std_traits.html#isSafe
or
https://dlang.org/phobos/std_traits.html#functionAttributes


All I meant was that I don't know enough about what the compiler 
does with built in types to make this work. It almost sounds like 
we would need a safe union and unsafe union type and do some 
extra stuff for the unsafe union, but I'm just starting to learn 
about this stuff.


Re: GSoC 2016 - Precise GC

2016-05-04 Thread jmh530 via Digitalmars-d-announce

On Wednesday, 4 May 2016 at 02:50:08 UTC, Jeremy DeHaan wrote:


I'm not sure, but one would thing that @safe code wouldn't need 
any extra information about the union. I wouldn't know how to 
differentiate between them though during runtime. Probably 
someone with more experience with the compiler would know more 
about that kind of thing.


You can identify safe functions with
https://dlang.org/phobos/std_traits.html#isSafe
or
https://dlang.org/phobos/std_traits.html#functionAttributes


Re: GSoC 2016 - Precise GC

2016-05-03 Thread Dsby via Digitalmars-d-announce

On Monday, 2 May 2016 at 15:29:15 UTC, Jeremy DeHaan wrote:

Hi everyone!

I'm a little late to the party as far as my announcement goes, 
but I have been busy reading code and doing research for my 
project.


[...]


Great!


Re: GSoC 2016 - Precise GC

2016-05-03 Thread Jeremy DeHaan via Digitalmars-d-announce

On Tuesday, 3 May 2016 at 19:05:22 UTC, jmh530 wrote:

On Tuesday, 3 May 2016 at 18:15:20 UTC, Jeremy DeHaan wrote:


I am reading a paper on how one could use extra information 
about what was last assigned to a union in order to scan them 
precisely. I haven't read the whole thing yet, but it looks 
like it could be done.


Not sure if it is something I can get to in the course of my 
project though. Scanning only unions conservatively is still 
pretty good.


Does it matter that @safe code does not allow unions of 
pointers and non-pointers?


I'm not sure, but one would thing that @safe code wouldn't need 
any extra information about the union. I wouldn't know how to 
differentiate between them though during runtime. Probably 
someone with more experience with the compiler would know more 
about that kind of thing.


Re: GSoC 2016 - Precise GC

2016-05-03 Thread jmh530 via Digitalmars-d-announce

On Tuesday, 3 May 2016 at 18:15:20 UTC, Jeremy DeHaan wrote:


I am reading a paper on how one could use extra information 
about what was last assigned to a union in order to scan them 
precisely. I haven't read the whole thing yet, but it looks 
like it could be done.


Not sure if it is something I can get to in the course of my 
project though. Scanning only unions conservatively is still 
pretty good.


Does it matter that @safe code does not allow unions of pointers 
and non-pointers?


Re: GSoC 2016 - Precise GC

2016-05-03 Thread Jeremy DeHaan via Digitalmars-d-announce

On Tuesday, 3 May 2016 at 16:44:32 UTC, Jack Stouffer wrote:

On Tuesday, 3 May 2016 at 16:15:27 UTC, Jeremy DeHaan wrote:
I agree, but a precise heap scan should be the easiest part of 
this project. Rainer Schuetze has already implemented this and 
presented it at a dconf a few years ago(2013?). My plan is to 
use that since I know it works, and that frees up my time to 
focus on pretty much everything else.


I don't remember all the details, but I'm pretty sure that 
Rainer, or maybe someone else, was talking about how a precise 
GC is not completely possible in D because D has unions.


I am reading a paper on how one could use extra information about 
what was last assigned to a union in order to scan them 
precisely. I haven't read the whole thing yet, but it looks like 
it could be done.


Not sure if it is something I can get to in the course of my 
project though. Scanning only unions conservatively is still 
pretty good.


Re: GSoC 2016 - Precise GC

2016-05-03 Thread jmh530 via Digitalmars-d-announce

On Tuesday, 3 May 2016 at 16:44:32 UTC, Jack Stouffer wrote:


I don't remember all the details, but I'm pretty sure that 
Rainer, or maybe someone else, was talking about how a precise 
GC is not completely possible in D because D has unions.


Discussed in this thread (among others)
http://forum.dlang.org/thread/bzcatcalqsxqvptxl...@forum.dlang.org


Re: GSoC 2016 - Precise GC

2016-05-03 Thread Jack Stouffer via Digitalmars-d-announce

On Tuesday, 3 May 2016 at 16:15:27 UTC, Jeremy DeHaan wrote:
I agree, but a precise heap scan should be the easiest part of 
this project. Rainer Schuetze has already implemented this and 
presented it at a dconf a few years ago(2013?). My plan is to 
use that since I know it works, and that frees up my time to 
focus on pretty much everything else.


I don't remember all the details, but I'm pretty sure that 
Rainer, or maybe someone else, was talking about how a precise GC 
is not completely possible in D because D has unions.


Re: GSoC 2016 - Precise GC

2016-05-03 Thread Jeremy DeHaan via Digitalmars-d-announce

On Tuesday, 3 May 2016 at 06:23:51 UTC, Yura Sokolov wrote:

On Monday, 2 May 2016 at 15:29:15 UTC, Jeremy DeHaan wrote:

Hi everyone!

I'm a little late to the party as far as my announcement goes, 
but I have been busy reading code and doing research for my 
project.


[...]


Great! That is what should have been done long time ago.

I'm pretty sure, if you implement just precise heap scan (and 
lock removal), it will be already huge win.


I agree, but a precise heap scan should be the easiest part of 
this project. Rainer Schuetze has already implemented this and 
presented it at a dconf a few years ago(2013?). My plan is to use 
that since I know it works, and that frees up my time to focus on 
pretty much everything else.


Re: GSoC 2016 - Precise GC

2016-05-03 Thread Yura Sokolov via Digitalmars-d-announce

On Monday, 2 May 2016 at 15:29:15 UTC, Jeremy DeHaan wrote:

Hi everyone!

I'm a little late to the party as far as my announcement goes, 
but I have been busy reading code and doing research for my 
project.


[...]


Great! That is what should have been done long time ago.

I'm pretty sure, if you implement just precise heap scan (and 
lock removal), it will be already huge win.