-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Remove extraneous Painless compiler pass #49797
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
Conversation
Pinging @elastic/es-core-infra (:Core/Infra/Scripting) |
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.
LGTM
@Override | ||
void extractVariables(Set<String> variables) { | ||
// Do nothing. | ||
} | ||
|
||
@Override | ||
void analyze(ScriptRoot scriptRoot, Locals locals) { | ||
if (false == settings.areRegexesEnabled()) { |
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.
Can you change this to scriptRoot.getCompilerSettings().areRegexesEnabled() == false
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.
Since this change is nearly mechanical, I would prefer to make this change in a follow up PR.
@@ -128,6 +121,8 @@ void generateSignature(PainlessLookup painlessLookup) { | |||
|
|||
@Override | |||
void analyze(ScriptRoot scriptRoot, Locals locals) { | |||
this.settings = scriptRoot.getCompilerSettings(); |
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.
This is only used for getMaxLoopCounter()
, consider just saving that setting.
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.
Same as the comment above.
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.
Great change, thanks for walking me through it.
@stu-elastic @rjernst Thanks for the reviews! I will follow up with another small PR for Stu's requested changes. |
This removes the storeSettings pass where nodes in the AST could store information they needed out of CompilerSettings for use during later passes. CompilerSettings is part of ScriptRoot which is available during the analysis pass making the storeSettings pass redundant.
This removes the storeSettings pass where nodes in the AST could store information they needed out of CompilerSettings for use during later passes. CompilerSettings is part of ScriptRoot which is available during the analysis pass making the storeSettings pass redundant.
This removes the storeSettings pass where nodes in the AST could store information they needed out of CompilerSettings for use during later passes. CompilerSettings is part of ScriptRoot which is available during the analysis pass making the storeSettings pass redundant.