-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Script: track this pointer capture from blocks within lambdas #82228
Script: track this pointer capture from blocks within lambdas #82228
Conversation
If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, Propagating `this` pointer capture in the case of nested lambdas. Fixes: elastic#82224
Pinging @elastic/es-core-infra (Team:Core/Infra) |
Hi @stu-elastic, I've created a changelog YAML for you. |
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! Thanks for the fast fix. I would suggest updating the comment for setUsesInstanceMethod as part of the base Scope class as well since BlockScope is also changed now.
Comment is updated. |
…c#82228) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: elastic#82224
…c#82228) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: elastic#82224
…c#82228) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: elastic#82224
#82235) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: #82224
…82228) (#82237) * Script: track this pointer capture from blocks within lambdas (#82228) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: #82224 * org.elasticsearch.core.Map.of
…82228) (#82236) * Script: track this pointer capture from blocks within lambdas (#82228) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: #82224 * org.elasticsearch.core.Map.of
…c#82228) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: elastic#82224
…c#82228) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: elastic#82224
If a lambda contains a block that calls into a user function,
the painless compiler was not tracking that the lambda needs
to capture the
this
pointer.Scripts that attempted to use a lambda that calls a user
function from inside a block would trigger an
illegal_state_exception
:BlockScope
now forwardssetUsesInstanceMethod
calls toit's parent, which may be a
LambdaScope
.LambdaScope
will also forwardsetUsesInstanceMethod
toit's parent after setting it's own
usesInstanceMethod
flag,propagating
this
pointer capture in the case of nested lambdas.Fixes: #82224