Replace idgen with CTFE implementation#6837
Conversation
9b606e1 to
5a2bf3b
Compare
|
|
|
@jacob-carlborg I am sorry to dismiss your work but honestly, this does not add significant value. |
Do you need this for the C++ backend? Or would this just mean that you need to upgrade your code base?
I think this is great work as this hugely simplifies the build process and building DMD with dub (or any other build tool for that matter)! |
Upgrade our codebase to what exactly? It is used by the C++ glue code to match some magic identifiers. Edit: I suppose we could manually maintain a pair of |
There was a problem hiding this comment.
Even better than all this: Replace idgen completely by an id!"foo" template that initialises a member variable from IdPool using a static constructor.
Something like:
template id(string name) {
__gshared Identifier id; // __gshared as the frontend is single-threaded anyway.
shared static this() {
id = Identifier.idPool(name);
}
}and replace Id.foo by id!"foo".
I'd rather not replace a crutch by another crutch.
|
I don't see why we'd have to get rid of idgen. |
Even back in the 80s, IDEs and magic modern |
That pretty much kills this PR. I guarantee that manually maintaining those files will be overlooked and then some poor sap will expend hours trying to figure out the breakage. The whole point of Until |
|
@klickverbot How many uses of |
But isn't |
I don't see any issue with using our own cache where required. |
It seems to still be extra work for ldc and gdc. ping @ibuclaw |
|
I was asked by @yebblies to do this here #6771 (comment). |
|
@klickverbot If that's the whole list, then that's 54. Out of those only 19 exist in the DMD source code. |
It's certainly a very manageable amount of effort. Much less than incorporating the undocumented AST changes occurring from release to release anyway. |
|
I still want @ibuclaw 's buyin on this before pulling it. |
|
Reopening as discussion has resumed. I'm confident that this isn't going to be an issue for GDC either, but while waiting for @ibuclaw's response, we could discuss the actual change at hand. (The implementation seems unnecessarily clunky; see my above review.) |
@klickverbot is that the best idea, introducing a lost of static constructors. Also that approach would require quite a few other places to be updated to use the template instead. |
|
I'm OK with this in principle. Compilers should really use their own local identifier caches for symbols specific to themselves. |
|
So, is there a preference how to do this? The current implementation or what David suggested #6837 (review). |
|
If a C++ header is still needed it could also be generated by some +1 for updating the Visual Studio projects, too. |
|
FWIW the recent DAutotest was caused by the auto-generated |
5a2bf3b to
1385c72
Compare
|
Rebased. |
|
Why are all tests failing? I don't see the same problem with any other PRs. |
Well, maybe because this PR, as it is now, is introducing a regression? :) |
I was surprised that it manged to get as far up the chain as to druntime. If anything it would have expected the compiler not to compile. |
|
I'd like this to get in, always good to remove a dependency. I just ran into dealing with this file when cross-compiling ldc for Android/ARM and rather than pull in another dependency- I'd need a D compiler to compile to linux/x64 in addition to the ldc cross-compiler I'm using- I just generated these two files and added them to a patch, seen at termux/termux-packages#1078. |
1385c72 to
f6ef72f
Compare
|
The tests are green now. I'm pretty sure that the vibe.d failures are unrelated since other PRs have the same issue.. |
Yep it's a regression introduced in dlang/phobos#5427 |
|
Ok, everyone seems to be ok with moving forward, the only open question is:
|
|
Can someone please comment on what @klickverbot suggested #6837 (review). I want to know if anyone else agree with what David suggested. I would like to move on with this. |
|
I don't think I can argue against the change as it is, since it doesn't change the interface to |
|
The problem with |
Since id.h is not necessary anymore in DMD it's just as easy to implement the same functionality using CTFE. This will also simplify the build process because one extra build step is removed. `extern(C++)` is removed as well because it will only be called from within D code in DMD. Other compilers should keep their own cache if they want to.
f6ef72f to
326e097
Compare
|
Thanks for your pull request, @jacob-carlborg! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Some tips to help speed things up:
Bear in mind that large or tricky changes may require multiple rounds of review and revision. Please see CONTRIBUTING.md for more information. 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. |
|
What's the status of this? Can we get this merged or are any changes required? |
wilzbach
left a comment
There was a problem hiding this comment.
This change seems worth pulling with the current design.
I agree - this change is immensely useful for build tools down the road. Thanks a lot for pushing this!
I don't feel comfortable yet with signing off non-trivial PRs at DMD, but it seems that we have a consensus for going in this direction. So maybe @andralex or @WalterBright could help this PR to reach the finish line?
|
@WalterBright and I are in favor of this big time. From the comments our understanding is the gdc and ldc responsibles are on board. I think there's good value in this suggestion by @klickverbot:
There's liability too, so that work would be exploratory and does not need to come with this PR. I'll mark this as approved and leave it to @jacob-carlborg to work out the tests. Coverage can be overridden (obviously) but I want to make sure jenkins has no problem. |
In case someone is wondering, the bot merged this because only DAutoTest and auto-tester are required at the dmd repo. For more details: However, the failure at the project tester is an unrelated spurious failure. |
|
This broke dlang.org auto-deploy. I think I know why (Digger uses idgen.d to identify D versions that need a host D compiler), but it shouldn't have passed DAutoTest then. Looking into it :) |
|
Thanks. |
Since id.h is not necessary anymore it's just as easy to implement the same functionality using CTFE. This will also simplify the build process because one extra build step is removed.
extern(C++)is removed as well because it will only be called from within D code.This is required for #6771.