-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Canonicalize names of nested functions by keeping a more fine grained counter -- per (module, method name) pair #53719
base: master
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to keep this mostly inside flisp (particularly parsed_method_stack). I also don't think the module name has much value in being mangled into it. Making the name be a combination of the containing method + index into that method name seems somewhat prettier, I also don't see how that canonicalizes names any more than before. I don't really like that this adds more hidden and secret global statefulness to the lowering algorithm as well.
fd607bd
to
5fa2de9
Compare
@vtjnash: to reiterate, our goal here is to improve the consistency of the names generated for these functions. Currently, adding one lambda inside one function can change the generated names of all nested functions across all modules in our application, which means that a number of the This PR essentially makes the generated names/numbers independent of changes to other modules+functions. Do you see any other way for us to accomplish this or does this explanation address your objection(s)? |
Wrong since the counter is already per-module (grep for Still, as mentioned above, the proposed change would ensure that adding a nested function doesn't perturb the name generation in literally every numeric suffixed name in a given module. |
e76200d
to
f053663
Compare
We've tested this change by exercising it through compilation warmup in our application. Without this, we saw roughly 53% warmup effectiveness when upgrading versions. With this, we're seeing 68% warmup effectiveness. Although this comparison is not quite apples-to-apples, there is a notable reduction in |
f053663
to
024678d
Compare
Ran more tests to verify the gains from this and have verified that this is a positive change for us. Any objections to merging @JeffBezanson? |
756775b
to
f7a24bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @vtjnash that I don't like how this creates an implicit state internal to ast.c
that has to be considered together with the program flow through the flisp for correct-ness.
Is it not possible instead to pass a relevant stack of "parent" functions through cl-convert
and then into current-julia-module-counter
, so that all of this is handled explicitly in the flisp?
f7a24bb
to
ab5635a
Compare
5681df7
to
e0474e4
Compare
…elete impossible case of if-cond
…onfn_typename Co-authored-by: Cody Tapscott <84105208+topolarity@users.noreply.github.com>
Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com>
Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com>
ba77b2e
to
bfe5c20
Compare
As mentioned in #53716, we've been noticing that
precompile
statements lists from one version of our codebase often don't apply cleanly in a slightly different version.That's because a lot of nested and anonymous function names have a global numeric suffix which is incremented every time a new name is generated, and these numeric suffixes are not very stable across codebase changes.
To solve this, this PR makes the numeric suffixes a bit more fine grained: every pair of (module, top-level/outermost function name) will have its own counter, which should make nested function names a bit more stable across different versions.
This PR applies @JeffBezanson's idea of making the symbol name changes directly in
current-julia-module-counter
.Here is an example: