-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turn static void array into ubyte one #778
Conversation
|
I am _very_surprised though to discover that |
My impression is that it should still mark the parent type as containing pointers, even for an imprecise GC, but if nothing else, it would still be worth to use as documentation for developers. Of course using |
Yeah but it will do so even if you use Anyway, I have changed it to use |
So you mean that when you do this:
The memory /Thanks for confirming the |
Turn static void array into ubyte one
Yes, this is how it works according to my knowledge of GC internals. GC simply has not way to figure out that there is |
btw linkedTravis PR job seems to be broken, can't even fetch git stuff |
I always thought that the new'd type would be inspected if it contains any pointers and if yes, the whole block of memory is marked as containing pointers. A precise GC would help for mixed blocks of memory, but a block not containing any pointers shouldn't be a problem to handle.
Yeah, the outcome of the Travis-CI job is pretty random since a while. Sometimes it fails for basic setup stuff and often the compiler gets killed when building one of the examples - seems to be issues of the build machines on which the job runs rather than the job itself. Currently I simply don't have the time to look into it, but my fix would probably be to switch away from Travis and make my own CI results public. |
Check https://github.com/D-Programming-Language/druntime/blob/master/src/gc/gc.d#L419 - problem is that GC only knows My knowledge may be obsolete of course, I don't have courage to check compiler sources right now :) |
How about https://github.com/D-Programming-Language/druntime/blob/master/src/rt/lifetime.d#L1023 - looks like there is a flag stored in the |
Yes, I looked into this as well before. Every typeinfo has a NO_SCAN attribute for the GC when used with |
This wouldn't be scanned, it would see 8 consecutive ubyte elements but no pointer. My understanding is, precise GC is useful to avoid scanning the e.g. With the following structure, you end up mark'ing all the data as if they were pointers because the class has a couple pointers in it: However, further indirections in the struct are admissible to another NO_SCAN flag because they're separate memory allocations. I can see here that a |
I have probably misunderstood original question from @s-ludwig - this is indeed correct. GC has no tools to treat any non-heap member in a special way - so it only will be marked as |
Ah, though I may be wrong here - it is plain function pointer after all, not a closure, so there is not point in scanning it. |
Yes, that would be here: https://github.com/D-Programming-Language/druntime/blob/master/src/object_.d#L695 No flags for functions |
I am surprised this compiles with
dmd
but latest LDC alpha (also 2.065 frontend) reports:Which makes sense.
void
does not have any size and having static array of those is totally undefined.