RFR: 8350097: Make Compilation::current() and Compile::current() safer
Dean Long
dlong at openjdk.org
Sat Feb 15 01:52:18 UTC 2025
On Fri, 14 Feb 2025 14:48:34 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> Somewhat trivial.
>
> I recently hunted a bug for an hour until I realized that I had accessed ciEnv::compiler_data() as C2 `Compile` when, in fact, it was C1 `Compilation`. Stupid mistake, but an assert is easy to do and saves time.
If we derive C2 Compile and C1 Compilation from a common superclass, then ciEnv::compiler_data() could return that superclass and self-identify using a type field or virtual function. When looking into how we handle failure messages and how complicated it is, I thought moving some fields into a common superclass would be useful. Eventually we could even look into making ciEnv the common superclass, because the lifetimes are almost identical.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23635#issuecomment-2660623476
More information about the hotspot-compiler-dev
mailing list