Skip to content

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

Merged
merged 1 commit into from
Dec 4, 2019

Conversation

jdconrad
Copy link
Contributor

@jdconrad jdconrad commented Dec 3, 2019

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.

@jdconrad jdconrad added :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >refactoring v8.0.0 v7.6.0 labels Dec 3, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Scripting)

Copy link
Member

@rjernst rjernst left a 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()) {
Copy link
Contributor

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

Copy link
Contributor Author

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();
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@stu-elastic stu-elastic left a 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.

@jdconrad
Copy link
Contributor Author

jdconrad commented Dec 4, 2019

@stu-elastic @rjernst Thanks for the reviews! I will follow up with another small PR for Stu's requested changes.

@jdconrad jdconrad merged commit e174b3f into elastic:master Dec 4, 2019
jdconrad added a commit that referenced this pull request Dec 4, 2019
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.
SivagurunathanV pushed a commit to SivagurunathanV/elasticsearch that referenced this pull request Jan 23, 2020
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >refactoring v7.6.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants