-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
None
-
None
A lot of times, it is beneficial to know if we do have extra information about a variable without an extra check (and additional code size) in cases where there is not. As a result, we can introduce a method that will always return a constant which will tell us if the Jit compiler knows that a particular variable is a constant.
E.g. 1: MemorySessionImpl always checks the lifetime bit, even if the session is a global one. There are attempts made to eliminate this check but it is likely to introduce additional complexities, or additional runtime checks for other non-global sessions. As a result, a check to see if we are able to statically determine that the session is a global one would solve this issue without other drawbacks.
E.g 2: Normally, an array load or a hashmap look-up is the optimal way to find a value corresponding to a key. However, if the look-up table and the key are constants, an if-else chain may be compiled into more optimal code. (e.g converting integers to string).
E.g. 1: MemorySessionImpl always checks the lifetime bit, even if the session is a global one. There are attempts made to eliminate this check but it is likely to introduce additional complexities, or additional runtime checks for other non-global sessions. As a result, a check to see if we are able to statically determine that the session is a global one would solve this issue without other drawbacks.
E.g 2: Normally, an array load or a hashmap look-up is the optimal way to find a value corresponding to a key. However, if the look-up table and the key are constants, an if-else chain may be compiled into more optimal code. (e.g converting integers to string).
- links to
-
Review openjdk/jdk/17527