-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
explicit ID generation for easier IC #15559
Conversation
This is pretty destructive, though, no? |
If that's what it takes to make it all work out, it's totally acceptable. Arguably it's cleaner this way, dependencies are clearer. |
I like it, it will be also very useful for future multithreading handling. |
You're still planning on adding documentation to the new procs, right? 😉 |
The more I read this, the less I like. Why not just use a uuid? The code breaks mangling in pretty fundamental ways; it even breaks my refactor to "fix" the outstanding mangling problems. In fact, it's not identity generation that is the problem, as far as I can tell. Can you frame the purpose of this PR and how it relates to IC? |
I don't know yet if it simplifies IC all that much, but here is my reasoning: IC is about tracking inter-module dependencies precisely and also about stable interfaces between modules. Both properties are handled well by changing the ID from a simple auto-increment number to a pair of numbers, (moduleId, itemId). FrontendWhen we serialize a module M to disk we want to store everything that belongs to M in a binary file -- that is a simple BackendThe backend works on a set of binary files, the backend is told to produce fresh C code for the modules with IDs x, y, z, it knows exactly which symbols and types are affected and does its job. No need for special logic for generic instantiations etc, it all works because we have a precise serialized graph structure. |
Also notice how close the |
What would handle the requirement well would be a value that represents the interface. Then we can test if the interface is met by the new code. This sounds like a hash tree to me. The problem of serializing the graph is already solved with frosty and the mangling branch already demonstrates finding source modules for generic instantiations. If that can be improved (somehow?) by this code, then that's a win, but so far, it feels like a minor one. Stable IDs don't solve the mangling problem because the[y] are not sufficient to establish equivalence; witness Since IC happens at top-level statements, to me the pain point is cloning the whole graph just to compile one statement. That's the bit I'd like a better solution for. A hash tree would let us skip the graph clone with the realization that no mutation will impact any interface. I was trying to get @Clyybber interested in adding a generic |
If the
instead? |
a few points regarding IC and mangling:
|
Sounds the same as the current scheme to me.
Implementing a compiler server is comparatively trivial, though; I'd prefer to do this as a separate project later. Especially since some recent changes have broken my out-of-compiler compiler (dust).
If I'm reading the article correctly, this buys us just one recompile. I would sooner use symbol versioning, but in neither case is the loss of portability acceptable, so I'd say these cannot be considered.
This seems to be less performant than our current approach, which uses a much smaller scope; single statements means fewer dependencies. One thing that's interesting about the D approach is the idea of naming the libraries according to their interfaces so we can fragment the compiled cache arbitrarily and reuse stuff that isn't even in the cache. I don't think @Araq cares much about C compiler artifacts, though. |
I don't see how; C++ and D use a reversible encoding eg all in all, I'm not convinced that nim's current way is inferior though, and it generates smaller mangled symbols (at expense of requiring a lookup table to demangle/debug), and the question is whether IC can handle it (in particular deduping 2 mangled symbols after a edit-recompilation could be done via lookup table)
|
The question isn’t whether IC can reverse mangling because once you’ve spent any time reading the new mangler output, you no longer care about such concerns. |
Unrelated CI failures, merging now as other PRs depend on it. |
(cherry picked from commit 1996614dc58c5dd9943986329c3edc1900fd7167)
(cherry picked from commit 1996614dc58c5dd9943986329c3edc1900fd7167)
* refactoring: idents don't need inheritance * refactoring: adding an IdGenerator (part 1) * refactoring: adding an IdGenerator (part 2) * refactoring: adding an IdGenerator (part 3) * refactoring: adding an IdGenerator (part 4) * refactoring: adding an IdGenerator (part 5) * refactoring: adding an IdGenerator (part 5) * IdGenerator must be a ref type; hello world works again * make bootstrapping work again * progress: add back the 'exactReplica' ideas * added back the missing exactReplica hacks * make tcompilerapi work again * make important packages green * attempt to fix the build for 32 bit machines (probably need a better solution here)
* refactoring: idents don't need inheritance * refactoring: adding an IdGenerator (part 1) * refactoring: adding an IdGenerator (part 2) * refactoring: adding an IdGenerator (part 3) * refactoring: adding an IdGenerator (part 4) * refactoring: adding an IdGenerator (part 5) * refactoring: adding an IdGenerator (part 5) * IdGenerator must be a ref type; hello world works again * make bootstrapping work again * progress: add back the 'exactReplica' ideas * added back the missing exactReplica hacks * make tcompilerapi work again * make important packages green * attempt to fix the build for 32 bit machines (probably need a better solution here)
* refactoring: idents don't need inheritance * refactoring: adding an IdGenerator (part 1) * refactoring: adding an IdGenerator (part 2) * refactoring: adding an IdGenerator (part 3) * refactoring: adding an IdGenerator (part 4) * refactoring: adding an IdGenerator (part 5) * refactoring: adding an IdGenerator (part 5) * IdGenerator must be a ref type; hello world works again * make bootstrapping work again * progress: add back the 'exactReplica' ideas * added back the missing exactReplica hacks * make tcompilerapi work again * make important packages green * attempt to fix the build for 32 bit machines (probably need a better solution here)
Changing the ID generation mechanism for an easier IC-implementation.