Rework #8542 wrt. deterministic IDs via generateIdWithLoc()#8633
Rework #8542 wrt. deterministic IDs via generateIdWithLoc()#8633dlang-bot merged 1 commit intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @kinke! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#8633" |
9a5b054 to
5c6e203
Compare
|
Custom hashing of Btw, 2.081.1 isn't able to compile master, that's pretty bad (I went back to 2.077). |
|
Some remarks:
|
I can't see this happening, Loc is a critical object used everywhere. Increasing its size is not really an available option. |
Well that's exactly the goal I've been working towards recently... |
I'll just leave this review here: #7821 (comment) |
Isn't BTW, in Clan the corresponding type is only 32 bit large. The documentation says: "Technically, a source location is simply an offset into the manager's view of the input source" [1] https://clang.llvm.org/doxygen/classclang_1_1SourceLocation.html |
It's not how it's passed around, increasing the size of Loc increases the size of every object in the front end. If we want memory consumption to go in any direction, we would want to keep it down.
The same is also true for GCC's location_t. Having a location map might be reasonable to ensure that each location is only allocated once. You could make it more useful however by storing location ranges - start and end of all tokens and expressions. I digress from the topic of this PR however... |
|
If you think modifying ubiquitous |
|
|
||
| /* Checks for equivalence, | ||
| * a) comparing the filename contents (not the pointer), case- | ||
| * insensitively on Windows, and |
There was a problem hiding this comment.
FYI, macOS also has a case insensitive filesystem by default.
There was a problem hiding this comment.
Ah, interesting. The FileName.equals() function used here only has a Windows special case.
| // 2.082+ | ||
| counters.update(Key(loc, prefix), | ||
| () => 1u, // insertion | ||
| (ref uint counter) // update |
There was a problem hiding this comment.
I had to use ref here, although it makes no sense in this case. To be fair, I haven't tried returning void and incrementing the ref directly.
There was a problem hiding this comment.
Btw, thanks @n8sh for this AA.update(), I was looking for it in the docs (didn't want to hash twice for insertion), found it, implemented it, and then figured it's new in 2.082. ;)
|
Rebased + squashed. Can someone remove the WIP label please? |
Done. |
|
@thewilsonator: Please try to push this. It was only supposed to rectify the IMO horrible code introduced with the important fix in #8542; I don't see why it has to rot here for more than half a year now.
That 'offer' still stands and is IMO the only question mark; I'll be on vacation though. |
|
I've got it in the AGM at dconf to make |
No description provided.