RFR: 8324433: Introduce a way to determine if an expression is evaluated as a constant by the Jit compiler

Quan Anh Mai qamai at openjdk.org
Tue Jan 23 08:18:41 UTC 2024


Hi,

This patch introduces `JitCompiler::isConstantExpression` which can be used to statically determine whether an expression has been constant-folded by the Jit compiler, leading to more constant-folding opportunities. For example, it can be used in `MemorySessionImpl::checkValidStateRaw` to eliminate the lifetime check on global sessions without imposing additional branches on other non-global sessions. This is inspired by `std::is_constant_evaluated` in C++.

Please kindly give your opinion as well as your reviews, thanks very much.

-------------

Commit messages:
 - bug number
 - add isConstantExpression

Changes: https://git.openjdk.org/jdk/pull/17527/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17527&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8324433
  Stats: 162 lines in 6 files changed: 158 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/17527.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17527/head:pull/17527

PR: https://git.openjdk.org/jdk/pull/17527


More information about the core-libs-dev mailing list