JS: Move getContainer to single rootdef (+fixes)#3403
Merged
Conversation
Contributor
Author
|
Oof. Did not expect these test failures. Maybe hold back on reviews until I've fixed. |
erik-krogh
previously approved these changes
May 5, 2020
Contributor
erik-krogh
left a comment
There was a problem hiding this comment.
We are getting more and more pragma[nomagic] into our code.
But it improves performance, so LGTM 👍
Just a small optional comment about a parameter type.
Contributor
Author
|
Hm, one evaluations based on this one started showing suspicious results on big-apps. I'll need to run a big-apps evaluation of this. |
Contributor
Author
|
XSS on big-apps looks fine. I've rebased and opened an internal PR with the dbscheme hash bump. |
erik-krogh
previously approved these changes
May 6, 2020
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
Contributor
Author
|
@erik-krogh the internal PR is green. Can I get approval to merge both? |
erik-krogh
approved these changes
May 6, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This moves the definition of
getContainerinto a single root-def, avoiding some spuriously materialized negation predicates otherwise needed by the dispatch predicate, and ensuring that the whole relation is cached.I noticed this predicate getting a bit flaky and sometimes very expensive in response to unrelated changes. In particular, magic started pushing "the set of control-flow nodes that belong to a container" as the context, which is a pretty bad context to use anywhere.
I believe the complicated overriding pattern may have been at fault here:
(Ignore, this was just me not paying attention to the class hierarchy.)ControlFlowNode.getContainerexplicitly referred tothis.(Expr).getContainer()even thoughgetContainer()is overridden inExpr, so you'd think the code was dead. Likewise forStmt.Due to multiple inheritance, there were several overrides that exist only to choose arbitrarily between two inherited definitions of
getContainer, which were equivalent but not obviously so.There wasn't a single root-def for
getContainer. For exampleClassOrInterface.getContainerdid not overrideControlFlowNode.getContainer. Not all these root-defs werecached.There are also a few follow-up performance fixes which are independently useful on their own, but needed to make this safe to land.
Evaluations: