RFR: 8336103: Sharper checks for <init> and <clinit> initializers [v2]
David Holmes
dholmes at openjdk.org
Mon Jul 15 05:28:51 UTC 2024
On Fri, 12 Jul 2024 09:14:00 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> src/hotspot/share/classfile/javaClasses.cpp line 3018:
>>
>>> 3016: int flags = (jushort)( m->access_flags().as_short() & JVM_RECOGNIZED_METHOD_MODIFIERS );
>>> 3017: if (m->is_object_initializer()) {
>>> 3018: flags |= java_lang_invoke_MemberName::MN_IS_CONSTRUCTOR;
>>
>> I'm going to assume that `clinit` would already get filtered out at some point otherwise this would be a change in behaviour.
>
> No, it is not filtered, we still have `clinit`-s on this path. In the initial version https://github.com/openjdk/jdk/pull/20120/commits/1a0d18f1333866ab2eceb02b30c0fe363473d4e6#diff-a8ed79cab8961103a78187704b7a14fd00b322da06e75518bcfd888d9b940040R3020 I caught the assert in many tests, mostly in stack traces generation.
>
> Yes, this changes the behavior: `clinit` would now be recorded as "method", instead of "constructor". Tracing back the uses of `get_flags`: it is used for initializing `java.lang.ClassFrameInfo.flags`. There seem to be no readers for this field in VM. Java side for `j.l.CFI` does not seem to check any method/constructor flags. So I would say this change in behavior is not really visible, and there is no need to try and keep the old (odd) behavior.
Okay, such a change in behaviour was unexpected for a "cleanup" PR. I'm looking into it now. Perhaps @mlchung can comment?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20120#discussion_r1677324623
More information about the graal-dev
mailing list