RFR: 8336103: Sharper checks for <init> and <clinit> initializers

Andrey Turbanov aturbanov at openjdk.org
Thu Jul 11 08:49:13 UTC 2024


On Wed, 10 Jul 2024 17:15:49 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> All around Hotspot, we have calls to `method->is_initializer()`. That method test for both instance and static initializers. In many cases, the uses imply we actually want to test for constructor (instance initializer), not static initializer. Sometimes we filter explicitly for `!m->is_static()`, sometimes we don't. Often we get lucky by never being exposed to static initializers on particular paths.
> 
> I would like to sharpen this. I went back and forth, and ultimately decided to remove `is_initializer` completely to avoid future confusion, and rewrite the uses appropriately.
> 
> Additional testing:
>  - [x] Linux AArch64 server fastdebug, `all` (includes Fuzzer and CTW tests)

src/hotspot/share/oops/klassVtable.cpp line 1233:

> 1231: 
> 1232: inline bool interface_method_needs_itable_index(Method* m) {
> 1233:   if (m->is_static())           return false;   // e.g., Stream.empty

code alignment is now inconsistent

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20120#discussion_r1673644568


More information about the hotspot-dev mailing list