Enhancement: add trait getPointerBitmap to help precise scanning#4192
Enhancement: add trait getPointerBitmap to help precise scanning#41921 commit merged intodlang:masterfrom
Conversation
src/traits.c
Outdated
There was a problem hiding this comment.
As usual with ugly code, it was wrong ;-)
|
Could you add a description either in the commit or the PR what exactly this does? A dlang.org pull will be needed documenting this trait as well (maybe just do that instead of documenting it in the commit). |
deaff10 to
abcbf09
Compare
I've added a comment to the code. I'll follow up with a documentation PR if this appears to have a chance of getting accepted. |
|
I have to admit that it's a bit obscure. But if you believe it will help in implementing a precise GC, I'm all for it. There's no way to implement this in the library instead, right? |
|
This trait is a direct translation of the RTInfo in the precise GC: https://github.com/rainers/druntime/blob/gc_precise_nov14/src/gc/rtinfo.d The problem with the library implementation is that it adds considerably to the compilation time (more than 20% for some projects). Having the proper RTInfo always available should have minimal impact on build time, especially in case you don't use the precise GC. |
|
Ok, you got me convinced. Will auto-merge soon, and hoping for that dlang pull as well. ;) |
|
|
Auto-merge toggled on |
Enhancement: add trait getPointerBitmap to help precise scanning
|
Thanks! |
|
Make sense to have this as a compiler intrinsic. |
There was a problem hiding this comment.
Just move that into main please, no other dmd test uses unittest.
There was a problem hiding this comment.
I have copied that from another test, but I shouldn't have used traits_getUnittests.d for that :-)
The bad thing about main() and building without -unittest is that asserts are a noop for all the -release builds.
|
Have you tested this with nested classes and structs? |
TBH not with this trait. I'll add some test cases. |
See #4196 |
|
Wow, we (mihails :P) just removed code using using a very similar approach in an old patch from @dsimcha in the draft of the port of the concurrent GC. Maybe it can be added right back :) |
|
Why this PR is merged without @WalterBright 's approval? |
|
Because it's an enhancement that doesn't change the language, it only introduces a trait (there are no stolen keywords). And it seems important enough to have as a trait, especially since @rainers is one of the few people who actually know a thing or two about working on GCs. Also, I'm not in the mood to wait for Walter to respond 5 months later for what is an uncontroversial feature. |
|
@andralex OK, I understand. |
|
I mean I may have shotgun-pulled this, but GC is a high point of focus right now, we need to get this stuff moving. :) |
This helps the precise GC (dlang/druntime#1022) to generate the required data without adding to the compile time.