RFR: 8324433: Introduce a way to determine if an expression is evaluated as a constant by the Jit compiler [v3]
Quan Anh Mai
qamai at openjdk.org
Tue Jan 23 11:26:26 UTC 2024
On Tue, 23 Jan 2024 11:18:43 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> 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.
>
> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>
> add more overloads
I get your idea. I have added overloads for all types. They will all invoke `inlint_isCompileConstant`. Given that there are now 7 methods I think a separate class is more justified.
Another issue is the duplication of `isConstantExpression(Object)`, but I think a separate issue to deduplicate it would be easier.
Thanks a lot.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17527#issuecomment-1905836929
More information about the core-libs-dev
mailing list