Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8324433

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • None
    • core-libs
    • 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).

            qamai Quan Anh Mai
            qamai Quan Anh Mai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: