-
-
Notifications
You must be signed in to change notification settings - Fork 416
Provide more TypeInfo for AA allocations #1037
Conversation
- supply more type info to _aaValues, _aaKeys - return normal dynamic array, not "raw" array
@rainers Why do we need to touch the old implementation? >.< |
AFAICT the existing dmd patch only deals with literals, not with insertions. If you have further patches, please make them available somewhere.
Precise scanning needs the typeinfo for allocated objects. I guess these are easily available from a templated solution, though. |
Current patch touch literal and insertions (_aaGetX), but the new implementation has another philosophy with the old. New AA is template and doesn't use typeinfo. It abuses most of old aaXXX api, but size and typeinfo arguments are ignored. |
The main points of the new AA:
It may be easyly implemented, because AA is template. You may add another function to AA vtbl, which returns GC info. |
Sounds good. Please note that the previous try to do this often caused unresolved symbols, because the lowering was only halfway complete, e.g. if you never used an AA literal or insertion, get functions will never have the corresponding template instantiated. Your pseudo-virtual handle might cleverly avoid that problem, though. |
Now it passes dmd, phobos and druntime tests. Looks ike I've caught all the linkage fleas. |
Well the linkage issues usually arised in other libraries, not in druntime or phobos :). |
Auto-merge toggled on |
Provide more TypeInfo for AA allocations
Looks like this causes a problem with shared AA: https://issues.dlang.org/show_bug.cgi?id=14192 If I print
But |
We could fix it by using It seems |
"in" doesn't work any differently for shared AA I don't think. But that's not necessarily going to be true forever. I think that dmd really should be passing the full type info, and letting the runtime deal with peeling the layers off. |
If you make a link to a line reference a commit instead of master, or the link will soon point somewhere else. Github has a handy keyboard shortcut y for this. |
Don't rely on subtleties, it might become possible at some point and it will be much harder to find this implicit assumptions. |
This is needed for precise scanning of heap objects allocated by the AA implementation.
I'm not sure how obsolete this becomes with the new AA implementation, though.