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

Incorrectly inlines non-final variable #27

Closed
julianhyde opened this Issue May 28, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@julianhyde
Owner

julianhyde commented May 28, 2014

Linq4j BlockBuilder incorrectly inlines a variable that might be assigned more than once along a code path. For example, in

long x = 0;
final long y = System.currentTimeMillis();
if (System.nanoTime() > 0L) {
  x = y;
}

it incorrectly inlines x, to yield

if (System.nanoTime() > 0L) {
  System.currentTimeMillis();
}

The fix is to only inline variables that are marked 'final'. The java compiler will ensure that they cannot be assigned more than once (by any code path) and cannot be read before they have been initialized.

This change may break code that relies on Linq4j inlining effectively final (but not explicitly final) variables.

@julianhyde julianhyde changed the title from Variable assigned in 'if' or 'for' incorrectly inlined to Incorrectly inlines non-final variable May 28, 2014

julianhyde added a commit to julianhyde/optiq that referenced this issue May 28, 2014

Fix https://github.com/julianhyde/optiq/issues/294, "Implement DENSE_…
…RANK windowed aggregate function".

Changes to the `AggImplementor` and `WinAggImplementor` interfaces to provide richer context to user code implementing a (windowed) aggregate function.

RelDataType instances created via built-in type strategies are now NOW NULL. Add 'boolean nullable' parameter to RelDataTypeImpl.proto methods.

Upgrade to linq4j-0.4, and add 'final' to code-generator variables, per julianhyde/linq4j#27.

ldming pushed a commit to ldming/mycalcite that referenced this issue Sep 13, 2018

Fix https://github.com/julianhyde/optiq/issues/294, "Implement DENSE_…
…RANK windowed aggregate function".

Changes to the `AggImplementor` and `WinAggImplementor` interfaces to provide richer context to user code implementing a (windowed) aggregate function.

RelDataType instances created via built-in type strategies are now NOW NULL. Add 'boolean nullable' parameter to RelDataTypeImpl.proto methods.

Upgrade to linq4j-0.4, and add 'final' to code-generator variables, per julianhyde/linq4j#27.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment