From dholmes at openjdk.org Mon Sep 1 00:59:46 2025 From: dholmes at openjdk.org (David Holmes) Date: Mon, 1 Sep 2025 00:59:46 GMT Subject: RFR: 8366024: Remove unnecessary InstanceKlass::cast() [v2] In-Reply-To: References: <7QAphYNlPFcXmHo86DFEuVPnjjOwjoYMsksNtXFnsl0=.aa09352d-087e-4e23-805b-c05e38bb658d@github.com> Message-ID: <26NJ6xwmV3vbZdHpM320sGwZHiJ8Mn7d3gtJ--Ygz2U=.551378e5-35ff-4162-8984-ec0b5b585984@github.com> On Wed, 27 Aug 2025 18:11:33 GMT, Ioi Lam wrote: >> We have a lot of `InstanceKlass::cast(k)` calls where `k` is statically known to be an `InstanceKlass`. I fixed many instances of this pattern: >> >> >> InstanceKlass* x = ....; >> Klass* s = x->super(); // should call java_super() >> InstanceKlass::cast(s)->xyz(); >> >> >> The `super()` method has a very confusing API. It has the return type of `Klass*` because for for an `ObjArrayKlass` like `[Ljava/lang/String;`: >> >> - `super()` returns `[Ljava/lang/Object;` >> - `java_super()` returns `Ljava/lang/Object;` >> >> However, for `[Ljava/lang/Object;`, all `TypeArrayKlasses` and all `InstanceKlasses`, `super()` and `java_super()` return an identical value of that always have the actual type of `InstanceKlass*`. >> >> See here about the difference between `super()` and `java_super()`: https://github.com/openjdk/jdk/blob/7b9969dc8f20989497ff617abb45543d182b684d/src/hotspot/share/oops/klass.hpp#L218-L221 >> >> Unfortunately, we have a lot of code that incorrectly uses `super()` instead of `java_super()`, which leads to ` InstanceKlass::cast()` calls. I tried to fixed a bunch of easy ones in this PR, although there are a few more to go. >> >> I also fixed some calls to `local_interafaces()->at()` that widens the return type for `InstanceKlass*` to `Klass*`, which may lead to unnecessary ` InstanceKlass::cast()` calls. >> >> I also removed the `Klass::superklass()` API. This was used only in a few places and all of them can be safely replaced with `Klass::java_super()`. >> >> To avoid confusion, I think we should rename `super()` to something more obvious, but let's do that in a future PR. > > Ioi Lam has updated the pull request incrementally with one additional commit since the last revision: > > @adinn comment - remove InstanceKlass::cast() in edgeUtils.cpp This seems fine though I will also comment that `java_super` seems completely mis-named in relation to `super` as there is nothing more `Java` about it. The implementation of `java_super` for arrays is quite odd - I'm not sure when we don't care about the actual superclass and want to go straight to object. Thanks ------------- Marked as reviewed by dholmes (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26908#pullrequestreview-3171880405 From iklam at openjdk.org Mon Sep 1 01:01:35 2025 From: iklam at openjdk.org (Ioi Lam) Date: Mon, 1 Sep 2025 01:01:35 GMT Subject: RFR: 8317269: Store old classes in linked state in AOT cache [v6] In-Reply-To: References: Message-ID: <6PEn-0OmUy07dFkwXP2h1ytoJFpt7ax4Q3KYOY6NEwk=.d56bf938-c47b-4be3-8e39-00f16ff6393f@github.com> > During the assembly phase of the AOT cache, we link and verify all classes that were loaded during the training run. When verifying a class like this: > > > class X { > A getA() { return new B(); } // Verifier requires B to be a subtype of A. > } > > > We remember `A` and `B` as the "verification dependencies" of `X`. A class will be excluded from the AOT cache if any of its verification dependencies are excluded. For example, `X` will be excluded if > > - `A` fails verification > - `B` is a signed class, which is always excluded from the AOT cache > > Conversely, if both `A` and `B` are included in the AOT cache, in the production run, they will be unconditionally loaded during VM bootstrap. Therefore, we can guarantee that the verification result computed for `X` will remain valid during the production run. > > Notes for reviewers: > > - The checks for verification dependencies are done inside `SystemDictionaryShared::check_exclusion_for_self_and_dependencies()`. These checks are done for both old and new classes. Since the dependencies can form a cyclic graph, the checks cannot be implemented with a simple recursion. See "Algorithm notes" in this function for details. > - The verification dependencies for "new" classes are already stored in `DumpTimeClassInfo::_verifier_constraints`. > - This PR adds code to record the verification dependencies for "old" classes into `DumpTimeClassInfo::_old_verifier_dependencies`, by intercepting `JVM_FindClassFromCaller()`. > - This new functionality (store old classes in linked state) is available only when using the AOT cache. For simplicity, this functionality is not available with the old CDS workflows. See comments in `CDSConfig::is_preserving_verification_dependencies()`. Ioi Lam has updated the pull request incrementally with one additional commit since the last revision: updated comments ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26754/files - new: https://git.openjdk.org/jdk/pull/26754/files/fc9e29c8..b5bd8123 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26754&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26754&range=04-05 Stats: 5 lines in 1 file changed: 3 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/26754.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26754/head:pull/26754 PR: https://git.openjdk.org/jdk/pull/26754 From iklam at openjdk.org Mon Sep 1 01:01:38 2025 From: iklam at openjdk.org (Ioi Lam) Date: Mon, 1 Sep 2025 01:01:38 GMT Subject: RFR: 8317269: Store old classes in linked state in AOT cache [v4] In-Reply-To: References: Message-ID: <1y0xCycdMMkto_A7zYSbGYKJY_2AjnMv_uwyFya0kAg=.016425b2-06e3-48af-834d-0768d377121b@github.com> On Fri, 29 Aug 2025 18:57:23 GMT, Coleen Phillimore wrote: >> Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision: >> >> - Merge branch 'master' into 8317269-store-old-classes-in-linked-state-in-aot-cache >> - @coleenp comments >> - More bug fixes from JCK testing >> - Fixed bugs found in JCK testing >> - 8317269: Store old classes in linked state in AOT cache > > src/hotspot/share/cds/runTimeClassInfo.hpp line 204: > >> 202: u4* old_verifier_dependencies() { >> 203: assert(_num_old_verifier_dependencies > 0, "sanity"); >> 204: return (u4*)(address(this) + old_verifier_dependencies_offset()); > > This seems like it should have a checked_cast<> around it rather than a plain cast. `checked_cast<>` only checks size difference of the source and target types, but here both are pointer types so they have the same size. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26754#discussion_r2312711414 From iklam at openjdk.org Mon Sep 1 01:01:41 2025 From: iklam at openjdk.org (Ioi Lam) Date: Mon, 1 Sep 2025 01:01:41 GMT Subject: RFR: 8317269: Store old classes in linked state in AOT cache [v5] In-Reply-To: <92PKx4jRrCfYgf-jdR3WG6Npmo6Sao4mtt2tAQdrv5U=.aeef13b1-2ab5-4fd7-af0d-6c9eab9a204d@github.com> References: <92PKx4jRrCfYgf-jdR3WG6Npmo6Sao4mtt2tAQdrv5U=.aeef13b1-2ab5-4fd7-af0d-6c9eab9a204d@github.com> Message-ID: <1WzJLDW8mkbrCvucRTvQCTHNzqcs_43-ay8XWS2PiC0=.da2d6fa8-c8da-41ec-98b3-8317ee0cec39@github.com> On Fri, 29 Aug 2025 21:48:54 GMT, Coleen Phillimore wrote: >> Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains nine additional commits since the last revision: >> >> - Merge branch 'master' into 8317269-store-old-classes-in-linked-state-in-aot-cache >> - @matias9927 comments: fixed typos >> - clean up; removed unrelated change >> - Cleaned up iterate_verification_dependency_names so a return value of false from means early termination (similar to HashTable::iterate()) >> - Merge branch 'master' into 8317269-store-old-classes-in-linked-state-in-aot-cache >> - @coleenp comments >> - More bug fixes from JCK testing >> - Fixed bugs found in JCK testing >> - 8317269: Store old classes in linked state in AOT cache > > src/hotspot/share/classfile/systemDictionaryShared.cpp line 469: > >> 467: >> 468: // Returns true if the DumpTimeClassInfo::is_excluded() is true for at least one of k's exclusion dependencies. >> 469: bool SystemDictionaryShared::check_dependencies_exclusion(InstanceKlass* k, DumpTimeClassInfo* info) { > > So this checks one level of InstanceKlass* k's dependencies, and the table above collects one level of k or k's subclass's dependencies and calls this for those. > > class K : extends B implements I, J verifies C {} - the above hashtable has B, I and J and C. > > This function takes B - so checks B class. > > class B : extends A implements intf verifies C again, why not {} > > So it'd check A and intf and C again. But when do we check A's super? > > It seems like the hashtable should be created for all levels of the hierarchy, so only one bit of code should walk the hierarchy, not two. The ExclusionCheckCandidates table contains all (recursive) supertypes -- E.g., its `add_candidate(k)` method calls `add_candidate(k->java_super())`. > src/hotspot/share/classfile/systemDictionaryShared.cpp line 542: > >> 540: } >> 541: >> 542: Klass* SystemDictionaryShared::find_verification_dependency_bottom_class(InstanceKlass* k, Symbol* dependency_class_name) { > > Why don't you have this return InstanceKlasss so that the callers don't have to check the same thing. What you want is the bottom InstanceKlass so for [Lfoo; - you want foo. Since class foo is the thing you care about. Maybe the comment about why you return nullptr from check_verification_dependency_exclusion() could be here instead. > > These names are a bit repetative, can you just call this find_bottom_instance_klass() and maybe it could be used for other things too. The problem is if `k` is the ObjArrayKlass of `[[I`, then `k->bottom_klass()` is `[I`, which is not an InstanceKlass. If we change the return type to `InstanceKlass*`, then we would have to return `nullptr`. However, that would make it more difficult to explain the following case (I've updated the comments): bool SystemDictionaryShared::check_verification_dependency_exclusion(InstanceKlass* k, Symbol* dependency_class_name) { Klass* dependency_bottom_class = find_verification_dependency_bottom_class(k, dependency_class_name); if (dependency_bottom_class == nullptr) { // Dependency_class_name has not yet been loaded. This happens when the new verifier was checking // if dependency_class_name is assignable to an interface, and found the answer without resolving // dependency_class_name. // // Since this class is not even loaded, it surely cannot be excluded. return false; } ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26754#discussion_r2312711042 PR Review Comment: https://git.openjdk.org/jdk/pull/26754#discussion_r2312711119 From iklam at openjdk.org Mon Sep 1 01:01:42 2025 From: iklam at openjdk.org (Ioi Lam) Date: Mon, 1 Sep 2025 01:01:42 GMT Subject: RFR: 8317269: Store old classes in linked state in AOT cache [v5] In-Reply-To: References: <92PKx4jRrCfYgf-jdR3WG6Npmo6Sao4mtt2tAQdrv5U=.aeef13b1-2ab5-4fd7-af0d-6c9eab9a204d@github.com> Message-ID: On Fri, 29 Aug 2025 20:56:25 GMT, Coleen Phillimore wrote: >> src/hotspot/share/classfile/systemDictionaryShared.cpp line 1036: >> >>> 1034: DumpTimeClassInfo* info = get_info(ik); >>> 1035: Handle loader(current, ik->class_loader()); >>> 1036: Klass* k = SystemDictionary::find_instance_or_array_klass(current, name, loader); >> >> The caller just did this, didn't it? So, you should just be able to pass in from_class (unless it's null). > > I would kind of prefer old_verifier_dependency rather than old_verification - the latter seems to say that we had some verification that is no longer valid. old_verifier makes it clearer it's for old classfiles and the old verifier. Also 'verification' is used for the regular verifier so it's less of a same name. > The caller just did this, didn't it? There is a different caller (SystemDictionaryShared::copy_verification_info_from_preimage) which has only the class name. > I would kind of prefer old_verifier_dependency The current code is kind of messy. For example, we have _verifier_constraints in DumpTimeClassInfo, but other places use "verification_constraints". Maybe I should rename all old and new cases of verification_xxx to verifier_xxx? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26754#discussion_r2312711164 From iklam at openjdk.org Mon Sep 1 01:01:43 2025 From: iklam at openjdk.org (Ioi Lam) Date: Mon, 1 Sep 2025 01:01:43 GMT Subject: RFR: 8317269: Store old classes in linked state in AOT cache [v4] In-Reply-To: References: Message-ID: <5NQG0QYNv1XT5_JuE_BGf5k4qWGSjErXxkR8a0bnrHI=.e9593639-d70c-4dc5-a0d9-730376fa4166@github.com> On Fri, 29 Aug 2025 21:51:45 GMT, Coleen Phillimore wrote: >> src/hotspot/share/prims/jvm.cpp line 854: >> >>> 852: >>> 853: #if INCLUDE_CDS >>> 854: if (CDSConfig::is_preserving_verification_dependencies() && from_class->is_instance_klass()) { >> >> It looks like from_class can be null so you have to check for null here. >> Which doesn't make sense because the logging doesn't have null checks. > > This looks like something that should be cleaned up apart from this change. "from" can never be null. I created [JDK-8366488](https://bugs.openjdk.org/browse/JDK-8366488) - "JVM_FindClassFromClass should assert that from class is never null" ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26754#discussion_r2312711385 From iklam at openjdk.org Mon Sep 1 01:05:41 2025 From: iklam at openjdk.org (Ioi Lam) Date: Mon, 1 Sep 2025 01:05:41 GMT Subject: RFR: 8317269: Store old classes in linked state in AOT cache [v2] In-Reply-To: <4CuIk4X6i570N7wUdCfCdiwla8tAKyyn9iHkj-fIR-A=.680f53c2-7d13-460f-82e6-7eb46453ef9e@github.com> References: <5PF9YneXIfGjkmxmIY51Zr28yk9fA23dMPAEXcD-9Cc=.86bee7bf-ee81-4196-83e5-cd2b2b4c1ad6@github.com> <4CuIk4X6i570N7wUdCfCdiwla8tAKyyn9iHkj-fIR-A=.680f53c2-7d13-460f-82e6-7eb46453ef9e@github.com> Message-ID: On Fri, 29 Aug 2025 21:49:48 GMT, Coleen Phillimore wrote: >> We need to know if are are at the CDS safepoint, not any safepoint. > > I don't think we share safepoints anymore (?) This code is used by places like this in methodData.cpp: static bool is_excluded(Klass* k) { #if INCLUDE_CDS if (CDSConfig::is_at_cds_safepoint()) { // Check for CDS exclusion only at CDS safe point. if (k->is_instance_klass() && !InstanceKlass::cast(k)->is_loaded()) { log_debug(aot, training)("Purged %s from MDO: unloaded class", k->name()->as_C_string()); return true; } else { bool excluded = SystemDictionaryShared::should_be_excluded(k); if (excluded) { log_debug(aot, training)("Purged %s from MDO: excluded class", k->name()->as_C_string()); } return excluded; } } #endif return false; } This function is usually called with GC safepoints (for class unloading, etc). If that's the case, we must not call `SystemDictionaryShared::should_be_excluded(k)`, because the exclusion check is not yet complete. So we need to distinguish whether the current safepoint is CDS or not. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26754#discussion_r2312714685 From iklam at openjdk.org Mon Sep 1 01:27:24 2025 From: iklam at openjdk.org (Ioi Lam) Date: Mon, 1 Sep 2025 01:27:24 GMT Subject: RFR: 8317269: Store old classes in linked state in AOT cache [v7] In-Reply-To: References: Message-ID: > During the assembly phase of the AOT cache, we link and verify all classes that were loaded during the training run. When verifying a class like this: > > > class X { > A getA() { return new B(); } // Verifier requires B to be a subtype of A. > } > > > We remember `A` and `B` as the "verification dependencies" of `X`. A class will be excluded from the AOT cache if any of its verification dependencies are excluded. For example, `X` will be excluded if > > - `A` fails verification > - `B` is a signed class, which is always excluded from the AOT cache > > Conversely, if both `A` and `B` are included in the AOT cache, in the production run, they will be unconditionally loaded during VM bootstrap. Therefore, we can guarantee that the verification result computed for `X` will remain valid during the production run. > > Notes for reviewers: > > - The checks for verification dependencies are done inside `SystemDictionaryShared::check_exclusion_for_self_and_dependencies()`. These checks are done for both old and new classes. Since the dependencies can form a cyclic graph, the checks cannot be implemented with a simple recursion. See "Algorithm notes" in this function for details. > - The verification dependencies for "new" classes are already stored in `DumpTimeClassInfo::_verifier_constraints`. > - This PR adds code to record the verification dependencies for "old" classes into `DumpTimeClassInfo::_old_verifier_dependencies`, by intercepting `JVM_FindClassFromCaller()`. > - This new functionality (store old classes in linked state) is available only when using the AOT cache. For simplicity, this functionality is not available with the old CDS workflows. See comments in `CDSConfig::is_preserving_verification_dependencies()`. Ioi Lam has updated the pull request incrementally with one additional commit since the last revision: Added assert that SystemDictionaryShared::should_be_excluded() can only be called within CDS safepoint ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26754/files - new: https://git.openjdk.org/jdk/pull/26754/files/b5bd8123..db57b101 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26754&range=06 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26754&range=05-06 Stats: 15 lines in 2 files changed: 15 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/26754.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26754/head:pull/26754 PR: https://git.openjdk.org/jdk/pull/26754 From iklam at openjdk.org Mon Sep 1 01:27:24 2025 From: iklam at openjdk.org (Ioi Lam) Date: Mon, 1 Sep 2025 01:27:24 GMT Subject: RFR: 8317269: Store old classes in linked state in AOT cache [v2] In-Reply-To: References: <5PF9YneXIfGjkmxmIY51Zr28yk9fA23dMPAEXcD-9Cc=.86bee7bf-ee81-4196-83e5-cd2b2b4c1ad6@github.com> <4CuIk4X6i570N7wUdCfCdiwla8tAKyyn9iHkj-fIR-A=.680f53c2-7d13-460f-82e6-7eb46453ef9e@github.com> Message-ID: <_zPVmdQfMPNXvWuhzq8QS5A02yKQdWPa9xrb3xyaflo=.5122ff52-e60e-4e6a-a627-90df1c90715c@github.com> On Mon, 1 Sep 2025 01:03:17 GMT, Ioi Lam wrote: >> I don't think we share safepoints anymore (?) > > This code is used by places like this in methodData.cpp: > > > static bool is_excluded(Klass* k) { > #if INCLUDE_CDS > if (CDSConfig::is_at_cds_safepoint()) { > // Check for CDS exclusion only at CDS safe point. > if (k->is_instance_klass() && !InstanceKlass::cast(k)->is_loaded()) { > log_debug(aot, training)("Purged %s from MDO: unloaded class", k->name()->as_C_string()); > return true; > } else { > bool excluded = SystemDictionaryShared::should_be_excluded(k); > if (excluded) { > log_debug(aot, training)("Purged %s from MDO: excluded class", k->name()->as_C_string()); > } > return excluded; > } > } > #endif > return false; > } > > > This function is usually called with GC safepoints (for class unloading, etc). If that's the case, we must not call `SystemDictionaryShared::should_be_excluded(k)`, because the exclusion check is not yet complete. > > So we need to distinguish whether the current safepoint is CDS or not. I added an assert for this. See commit db57b101267f407535ffdc1f3cb685738d898f80 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26754#discussion_r2312729461 From iklam at openjdk.org Mon Sep 1 04:06:49 2025 From: iklam at openjdk.org (Ioi Lam) Date: Mon, 1 Sep 2025 04:06:49 GMT Subject: RFR: 8366024: Remove unnecessary InstanceKlass::cast() In-Reply-To: References: <7QAphYNlPFcXmHo86DFEuVPnjjOwjoYMsksNtXFnsl0=.aa09352d-087e-4e23-805b-c05e38bb658d@github.com> Message-ID: On Wed, 27 Aug 2025 09:17:31 GMT, Andrew Dinn wrote: >> We have a lot of `InstanceKlass::cast(k)` calls where `k` is statically known to be an `InstanceKlass`. I fixed many instances of this pattern: >> >> >> InstanceKlass* x = ....; >> Klass* s = x->super(); // should call java_super() >> InstanceKlass::cast(s)->xyz(); >> >> >> The `super()` method has a very confusing API. It has the return type of `Klass*` because for for an `ObjArrayKlass` like `[Ljava/lang/String;`: >> >> - `super()` returns `[Ljava/lang/Object;` >> - `java_super()` returns `Ljava/lang/Object;` >> >> However, for `[Ljava/lang/Object;`, all `TypeArrayKlasses` and all `InstanceKlasses`, `super()` and `java_super()` return an identical value of that always have the actual type of `InstanceKlass*`. >> >> See here about the difference between `super()` and `java_super()`: https://github.com/openjdk/jdk/blob/7b9969dc8f20989497ff617abb45543d182b684d/src/hotspot/share/oops/klass.hpp#L218-L221 >> >> Unfortunately, we have a lot of code that incorrectly uses `super()` instead of `java_super()`, which leads to ` InstanceKlass::cast()` calls. I tried to fixed a bunch of easy ones in this PR, although there are a few more to go. >> >> I also fixed some calls to `local_interafaces()->at()` that widens the return type for `InstanceKlass*` to `Klass*`, which may lead to unnecessary ` InstanceKlass::cast()` calls. >> >> I also removed the `Klass::superklass()` API. This was used only in a few places and all of them can be safely replaced with `Klass::java_super()`. >> >> To avoid confusion, I think we should rename `super()` to something more obvious, but let's do that in a future PR. > > I found two more occurrences of casting super() to InstanceKlass: > > src/hotspot/share/jfr/leakprofiler/chains/edgeUtils.cpp:79 > > ik = (const InstanceKlass*)ik->super(); > > src/hotspot/share/prims/jni.cpp:209 > > Klass* field_klass = k; > Klass* super_klass = field_klass->super(); > // With compressed oops the most super class with nonstatic fields would > // be the owner of fields embedded in the header. > while (InstanceKlass::cast(super_klass)->has_nonstatic_fields() && > InstanceKlass::cast(super_klass)->contains_field_offset(offset)) { > field_klass = super_klass; // super contains the field also > super_klass = field_klass->super(); > } > > The first one ought perhaps to be using InstanceKlass::superklass()? Thanks @adinn @dholmes-ora @coleenp for the review ------------- PR Comment: https://git.openjdk.org/jdk/pull/26908#issuecomment-3240791556 From iklam at openjdk.org Mon Sep 1 04:06:49 2025 From: iklam at openjdk.org (Ioi Lam) Date: Mon, 1 Sep 2025 04:06:49 GMT Subject: RFR: 8366024: Remove unnecessary InstanceKlass::cast() [v2] In-Reply-To: <26NJ6xwmV3vbZdHpM320sGwZHiJ8Mn7d3gtJ--Ygz2U=.551378e5-35ff-4162-8984-ec0b5b585984@github.com> References: <7QAphYNlPFcXmHo86DFEuVPnjjOwjoYMsksNtXFnsl0=.aa09352d-087e-4e23-805b-c05e38bb658d@github.com> <26NJ6xwmV3vbZdHpM320sGwZHiJ8Mn7d3gtJ--Ygz2U=.551378e5-35ff-4162-8984-ec0b5b585984@github.com> Message-ID: <9PsU6uvER6LcD__iFv6n23heIOuIAD3kxgkhAq-rA8A=.398b2031-0c5b-4444-b1e1-8dd32bcac4bc@github.com> On Mon, 1 Sep 2025 00:56:43 GMT, David Holmes wrote: > This seems fine though I will also comment that `java_super` seems completely mis-named in relation to `super` as there is nothing more `Java` about it. The implementation of `java_super` for arrays is quite odd - I'm not sure when we don't care about the actual superclass and want to go straight to object. As we discussed offline, I will try to add a new `InstanceKlass* InstanceKlass::super()` method. Then in most case people can just call `ik->super()` and it will do "the right thing". ------------- PR Comment: https://git.openjdk.org/jdk/pull/26908#issuecomment-3240793456 From iklam at openjdk.org Mon Sep 1 04:06:50 2025 From: iklam at openjdk.org (Ioi Lam) Date: Mon, 1 Sep 2025 04:06:50 GMT Subject: Integrated: 8366024: Remove unnecessary InstanceKlass::cast() In-Reply-To: <7QAphYNlPFcXmHo86DFEuVPnjjOwjoYMsksNtXFnsl0=.aa09352d-087e-4e23-805b-c05e38bb658d@github.com> References: <7QAphYNlPFcXmHo86DFEuVPnjjOwjoYMsksNtXFnsl0=.aa09352d-087e-4e23-805b-c05e38bb658d@github.com> Message-ID: <-_Xcpc5liL09SoygjhPedFMbo5EPoBsVlxm4LhEX1Co=.d6515314-7994-4867-848b-5eb43dab2d72@github.com> On Fri, 22 Aug 2025 23:45:41 GMT, Ioi Lam wrote: > We have a lot of `InstanceKlass::cast(k)` calls where `k` is statically known to be an `InstanceKlass`. I fixed many instances of this pattern: > > > InstanceKlass* x = ....; > Klass* s = x->super(); // should call java_super() > InstanceKlass::cast(s)->xyz(); > > > The `super()` method has a very confusing API. It has the return type of `Klass*` because for for an `ObjArrayKlass` like `[Ljava/lang/String;`: > > - `super()` returns `[Ljava/lang/Object;` > - `java_super()` returns `Ljava/lang/Object;` > > However, for `[Ljava/lang/Object;`, all `TypeArrayKlasses` and all `InstanceKlasses`, `super()` and `java_super()` return an identical value of that always have the actual type of `InstanceKlass*`. > > See here about the difference between `super()` and `java_super()`: https://github.com/openjdk/jdk/blob/7b9969dc8f20989497ff617abb45543d182b684d/src/hotspot/share/oops/klass.hpp#L218-L221 > > Unfortunately, we have a lot of code that incorrectly uses `super()` instead of `java_super()`, which leads to ` InstanceKlass::cast()` calls. I tried to fixed a bunch of easy ones in this PR, although there are a few more to go. > > I also fixed some calls to `local_interafaces()->at()` that widens the return type for `InstanceKlass*` to `Klass*`, which may lead to unnecessary ` InstanceKlass::cast()` calls. > > I also removed the `Klass::superklass()` API. This was used only in a few places and all of them can be safely replaced with `Klass::java_super()`. > > To avoid confusion, I think we should rename `super()` to something more obvious, but let's do that in a future PR. This pull request has now been integrated. Changeset: 2427c901 Author: Ioi Lam URL: https://git.openjdk.org/jdk/commit/2427c901b31dbdccc6f8f39404875a0140460479 Stats: 99 lines in 16 files changed: 0 ins; 16 del; 83 mod 8366024: Remove unnecessary InstanceKlass::cast() Reviewed-by: coleenp, dholmes ------------- PR: https://git.openjdk.org/jdk/pull/26908 From dholmes at openjdk.org Mon Sep 1 05:13:45 2025 From: dholmes at openjdk.org (David Holmes) Date: Mon, 1 Sep 2025 05:13:45 GMT Subject: RFR: 8365937: post_method_exit might incorrectly set was_popped_by_exception and value in the middle of stack unwinding [v4] In-Reply-To: <2SqwKSSfcLR6krBk2CYQZ8Q5X2T1eK4gaM4D6Hte2WA=.f4e906aa-4ffe-4d50-ba59-0ef12fb2f790@github.com> References: <2SqwKSSfcLR6krBk2CYQZ8Q5X2T1eK4gaM4D6Hte2WA=.f4e906aa-4ffe-4d50-ba59-0ef12fb2f790@github.com> Message-ID: On Fri, 29 Aug 2025 06:54:13 GMT, Leonid Mesnik wrote: >> But we are only in this method because the Java method has completed normally so there cannot be a pending exception at this point. ??? > > There is might be exception if current method has been called after exception has been thrown. It is quite rare case, but I've seem when add `assert(!exception_exit, "")`. It might happens if exception thrown and there were other upcals in the same thread before exception has been caught. I think I've seen it during classloading or some method bootstrapping. > > The test `TestMethodExitWithPendingException` simulates the same issue by calling method in the MethodExit event call back. > For method `upCall` the `exception_exit` would be true, because the method is called while exception is pending. However, the method `upCall` exits normally and is not unwinded. So this method `post_method_exit` is called. > > Here is the example of such stack in the on of the tests were assertion has been hit. The VM tries to load classes when exception is throwing. > > V [libjvm.so+0x1415d6c] JvmtiExport::post_method_exit(JavaThread*, Method*, frame)+0x29c (jvmtiExport.cpp:1847) > V [libjvm.so+0x1066b86] InterpreterRuntime::post_method_exit(JavaThread*)+0xe6 (interpreterRuntime.cpp:1278) > j java.lang.Object.()V+0 java.base at 26-internal > j java.lang.Throwable.(Ljava/lang/String;)V+1 java.base at 26-internal > j java.lang.Error.(Ljava/lang/String;)V+2 java.base at 26-internal > j java.lang.LinkageError.(Ljava/lang/String;)V+2 java.base at 26-internal > j java.lang.NoClassDefFoundError.(Ljava/lang/String;)V+2 java.base at 26-internal > v ~StubRoutines::Stub Generator call_stub_stub 0x00007f81b7c876fd > V [libjvm.so+0x1089117] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x4f7 (javaCalls.cpp:415) > V [libjvm.so+0x108ab3f] JavaCalls::call_special(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, JavaThread*)+0x18f (javaCalls.cpp:323) > V [libjvm.so+0x108b3c6] JavaCalls::construct_new_instance(InstanceKlass*, Symbol*, JavaCallArguments*, JavaThread*)+0x116 (javaCalls.cpp:289) > V [libjvm.so+0xd74f4b] Exceptions::new_exception(JavaThread*, Symbol*, Symbol*, JavaCallArguments*, Handle)+0x1db (exceptions.cpp:320) > V [libjvm.so+0xd7517f] Exceptions::new_exception(JavaThread*, Symbol*, Symbol*, JavaCallArguments*, Handle, Handle)+0x2f (exceptions.cpp:341) > V [libjvm.so+0xd7609f] Exceptions::new_exception(JavaThread*, Symbol*, char const*, Handle, Handle, Exceptions::ExceptionMsgToUtf8Mode)+0x3bf (exceptions.cpp:424) > V [libjvm.so+0xd7b9a0] Exceptions::_throw_msg_cause(JavaThread*, char const*, int, Symbol*, char co... Sorry I still can't see this. Method A throws an exception. The callback for the method-exit event for method A then invokes Java method B. Method B also has a callback enabled and so we are processing the method-exit for B. Method B has completed normally, but the exception from method A is still listed as pending? I can't see how that would come about as we must (temporarily) clear the pending exception to do the upcall else the upcall method would immediately throw that pending exception. But if we have cleared it then the upcall method's method-exit event shouldn't be able to see it. Similarly we must save/restore the JvmtiThreadState else we would be processing the normal exit as if it were an exception one. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26886#discussion_r2312899717 From dholmes at openjdk.org Mon Sep 1 05:22:53 2025 From: dholmes at openjdk.org (David Holmes) Date: Mon, 1 Sep 2025 05:22:53 GMT Subject: RFR: 8365937: post_method_exit might incorrectly set was_popped_by_exception and value in the middle of stack unwinding [v4] In-Reply-To: References: <2SqwKSSfcLR6krBk2CYQZ8Q5X2T1eK4gaM4D6Hte2WA=.f4e906aa-4ffe-4d50-ba59-0ef12fb2f790@github.com> Message-ID: <1n0gbxAE37Nf7SHwUFLwCr1fJ2W4EuPh88kxMyO8un0=.5e803b50-f08f-4887-8d4c-3eb37156a754@github.com> On Mon, 1 Sep 2025 05:11:32 GMT, David Holmes wrote: >> There is might be exception if current method has been called after exception has been thrown. It is quite rare case, but I've seem when add `assert(!exception_exit, "")`. It might happens if exception thrown and there were other upcals in the same thread before exception has been caught. I think I've seen it during classloading or some method bootstrapping. >> >> The test `TestMethodExitWithPendingException` simulates the same issue by calling method in the MethodExit event call back. >> For method `upCall` the `exception_exit` would be true, because the method is called while exception is pending. However, the method `upCall` exits normally and is not unwinded. So this method `post_method_exit` is called. >> >> Here is the example of such stack in the on of the tests were assertion has been hit. The VM tries to load classes when exception is throwing. >> >> V [libjvm.so+0x1415d6c] JvmtiExport::post_method_exit(JavaThread*, Method*, frame)+0x29c (jvmtiExport.cpp:1847) >> V [libjvm.so+0x1066b86] InterpreterRuntime::post_method_exit(JavaThread*)+0xe6 (interpreterRuntime.cpp:1278) >> j java.lang.Object.()V+0 java.base at 26-internal >> j java.lang.Throwable.(Ljava/lang/String;)V+1 java.base at 26-internal >> j java.lang.Error.(Ljava/lang/String;)V+2 java.base at 26-internal >> j java.lang.LinkageError.(Ljava/lang/String;)V+2 java.base at 26-internal >> j java.lang.NoClassDefFoundError.(Ljava/lang/String;)V+2 java.base at 26-internal >> v ~StubRoutines::Stub Generator call_stub_stub 0x00007f81b7c876fd >> V [libjvm.so+0x1089117] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x4f7 (javaCalls.cpp:415) >> V [libjvm.so+0x108ab3f] JavaCalls::call_special(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, JavaThread*)+0x18f (javaCalls.cpp:323) >> V [libjvm.so+0x108b3c6] JavaCalls::construct_new_instance(InstanceKlass*, Symbol*, JavaCallArguments*, JavaThread*)+0x116 (javaCalls.cpp:289) >> V [libjvm.so+0xd74f4b] Exceptions::new_exception(JavaThread*, Symbol*, Symbol*, JavaCallArguments*, Handle)+0x1db (exceptions.cpp:320) >> V [libjvm.so+0xd7517f] Exceptions::new_exception(JavaThread*, Symbol*, Symbol*, JavaCallArguments*, Handle, Handle)+0x2f (exceptions.cpp:341) >> V [libjvm.so+0xd7609f] Exceptions::new_exception(JavaThread*, Symbol*, char const*, Handle, Handle, Exceptions::ExceptionMsgToUtf8Mode)+0x3bf (exceptions.cpp:424) >> V [libjvm.so+0xd7b9a0] Exceptions::_throw_msg_cause(Jav... > > Sorry I still can't see this. Method A throws an exception. The callback for the method-exit event for method A then invokes Java method B. Method B also has a callback enabled and so we are processing the method-exit for B. Method B has completed normally, but the exception from method A is still listed as pending? I can't see how that would come about as we must (temporarily) clear the pending exception to do the upcall else the upcall method would immediately throw that pending exception. But if we have cleared it then the upcall method's method-exit event shouldn't be able to see it. Similarly we must save/restore the JvmtiThreadState else we would be processing the normal exit as if it were an exception one. Or mabye I do get it. The actual pending exception (on the ThreadShadow) must be saved, cleared and later restored, else we can't execute the Java upcall. But because we have separate paths for normal and exceptional method-exit processing, maybe we don't have to save/restore the JvmtiThreadState exception fields? But in that case are those fields even useful? To be honest I can't see how the two fields interact: there is either no exception being thrown, or there is - so only one field needed. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26886#discussion_r2312908009 From duke at openjdk.org Mon Sep 1 06:30:50 2025 From: duke at openjdk.org (Francesco Andreuzzi) Date: Mon, 1 Sep 2025 06:30:50 GMT Subject: Integrated: 8366331: Sort share/prims includes In-Reply-To: <3GeZOb9TuI9DDfsnncjo522fS-dh6k8UXfE8bDy7PDc=.bf40e61a-6edc-4cf6-acab-53457dbc574d@github.com> References: <3GeZOb9TuI9DDfsnncjo522fS-dh6k8UXfE8bDy7PDc=.bf40e61a-6edc-4cf6-acab-53457dbc574d@github.com> Message-ID: On Thu, 28 Aug 2025 09:04:04 GMT, Francesco Andreuzzi wrote: > This PR sorts the includes in `hotspot/share/prims` using `SortIncludes.java`, and removes some unnecessary ones. I'm also adding the directory to `TestIncludesAreSorted`. > > Passes `tier1`. This pull request has now been integrated. Changeset: 12dc568b Author: Francesco Andreuzzi Committer: Aleksey Shipilev URL: https://git.openjdk.org/jdk/commit/12dc568b3d270e4ab6dcd07e1bcddbb024ad724a Stats: 71 lines in 26 files changed: 30 ins; 39 del; 2 mod 8366331: Sort share/prims includes Reviewed-by: shade, lmesnik ------------- PR: https://git.openjdk.org/jdk/pull/26980 From dholmes at openjdk.org Mon Sep 1 07:00:45 2025 From: dholmes at openjdk.org (David Holmes) Date: Mon, 1 Sep 2025 07:00:45 GMT Subject: RFR: 8366474: Rename MetaspaceObj::is_shared() to MetaspaceObj::in_aot_cache() [v2] In-Reply-To: References: Message-ID: On Sat, 30 Aug 2025 17:34:38 GMT, Ioi Lam wrote: >> This PR is one (of many) steps in [JDK-8366473](https://bugs.openjdk.org/browse/JDK-8366473) (Refactor CDS source code with new AOT terminology): >> >> Rename `is_shared()` in `Metaspace` (and various other classes) to `in_aot_cache()` to reflect its true meaning: >> - tests if an object is inside the AOT cache's metaspace region. >> >> Also various forms of "shared metaspace" are updated to "aot metaspace" >> >> Please start your review with allocations.hpp > > Ioi Lam has updated the pull request incrementally with one additional commit since the last revision: > > Removed MetaspaceShared -> AOTMetaspace changes that are intended for https://github.com/openjdk/jdk/pull/27017 Maybe the JBS title should be a bit more generic as you seem to be renaming many occurrences of "shared" not just the one listed. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27016#issuecomment-3241088446 From duke at openjdk.org Mon Sep 1 07:19:55 2025 From: duke at openjdk.org (Anton Artemov) Date: Mon, 1 Sep 2025 07:19:55 GMT Subject: RFR: 8357086: os::xxx functions returning memory size should return size_t [v36] In-Reply-To: References: Message-ID: On Tue, 26 Aug 2025 08:41:03 GMT, Anton Artemov wrote: >> Hi, >> >> in this PR the output value types for functions which return memory are changed, namely: >> >> >> static julong available_memory(); --> static bool available_memory(size_t& value); >> static julong used_memory(); --> static bool used_memory(size_t& value); >> static julong free_memory(); --> static bool free_memory(size_t& value); >> static jlong total_swap_space(); --> static bool total_swap_space(size_t& value); >> static jlong free_swap_space(); --> static bool free_swap_space(size_t& value); >> static julong physical_memory(); --> static size_t physical_memory(size_t& value); >> >> >> The return boolean value, where available, indicates success, whereas the actual value is assigned to the input argument. The following recommended usage pattern is introduced: where applicable, an unsuccessful call is logged. >> >> Tested in GHA and Tiers 1-5. > > Anton Artemov has updated the pull request incrementally with two additional commits since the last revision: > > - 8357086: Removed extra empty line. > - 8357086: Removed placeholder for nodiscard attribute. I assume that those who wanted to express opinion about this PR have already done that, let's ------------- PR Comment: https://git.openjdk.org/jdk/pull/25450#issuecomment-3241136696 From duke at openjdk.org Mon Sep 1 07:19:55 2025 From: duke at openjdk.org (duke) Date: Mon, 1 Sep 2025 07:19:55 GMT Subject: RFR: 8357086: os::xxx functions returning memory size should return size_t [v36] In-Reply-To: References: Message-ID: On Tue, 26 Aug 2025 08:41:03 GMT, Anton Artemov wrote: >> Hi, >> >> in this PR the output value types for functions which return memory are changed, namely: >> >> >> static julong available_memory(); --> static bool available_memory(size_t& value); >> static julong used_memory(); --> static bool used_memory(size_t& value); >> static julong free_memory(); --> static bool free_memory(size_t& value); >> static jlong total_swap_space(); --> static bool total_swap_space(size_t& value); >> static jlong free_swap_space(); --> static bool free_swap_space(size_t& value); >> static julong physical_memory(); --> static size_t physical_memory(size_t& value); >> >> >> The return boolean value, where available, indicates success, whereas the actual value is assigned to the input argument. The following recommended usage pattern is introduced: where applicable, an unsuccessful call is logged. >> >> Tested in GHA and Tiers 1-5. > > Anton Artemov has updated the pull request incrementally with two additional commits since the last revision: > > - 8357086: Removed extra empty line. > - 8357086: Removed placeholder for nodiscard attribute. @toxaart Your change (at version 6ac6840024e719c96faee099205f7a967bc4af47) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25450#issuecomment-3241141060 From duke at openjdk.org Mon Sep 1 07:46:01 2025 From: duke at openjdk.org (Anton Artemov) Date: Mon, 1 Sep 2025 07:46:01 GMT Subject: Integrated: 8357086: os::xxx functions returning memory size should return size_t In-Reply-To: References: Message-ID: On Mon, 26 May 2025 12:56:26 GMT, Anton Artemov wrote: > Hi, > > in this PR the output value types for functions which return memory are changed, namely: > > > static julong available_memory(); --> static bool available_memory(size_t& value); > static julong used_memory(); --> static bool used_memory(size_t& value); > static julong free_memory(); --> static bool free_memory(size_t& value); > static jlong total_swap_space(); --> static bool total_swap_space(size_t& value); > static jlong free_swap_space(); --> static bool free_swap_space(size_t& value); > static julong physical_memory(); --> static size_t physical_memory(size_t& value); > > > The return boolean value, where available, indicates success, whereas the actual value is assigned to the input argument. The following recommended usage pattern is introduced: where applicable, an unsuccessful call is logged. > > Tested in GHA and Tiers 1-5. This pull request has now been integrated. Changeset: d5d94db1 Author: Anton Artemov Committer: David Holmes URL: https://git.openjdk.org/jdk/commit/d5d94db12a6d82a6fe9da18b5f8ce3733a6ee7e7 Stats: 256 lines in 22 files changed: 94 ins; 2 del; 160 mod 8357086: os::xxx functions returning memory size should return size_t Reviewed-by: stefank, dholmes ------------- PR: https://git.openjdk.org/jdk/pull/25450 From lkorinth at openjdk.org Mon Sep 1 08:07:48 2025 From: lkorinth at openjdk.org (Leo Korinth) Date: Mon, 1 Sep 2025 08:07:48 GMT Subject: RFR: 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 [v8] In-Reply-To: References: Message-ID: <1SVkL88-a7Es6cosezvIjvZ63F4nv-2Kut2oKG27Eo8=.f2e2a083-b51d-4df9-ab6e-ec324467ebb9@github.com> > This changes the timeout factor from 4 to 1. Most of the changes add timeouts to individual test cases so that I am able to run them with a timeout factor of 0.7 (some margin to the checked in factor of one) > > In addition to changing the timeout factor, I am also using a library call to parse the timeout factor from the Java properties (I cannot use the library function everywhere as jtreg does not allow me to add @library notations to non test case files). > > My approach has been to run all tests, and afterwards updating those that fail due to the timeout factor. The amount of updated test cases is huge, and my strategy has been to quadruple the timeout if I could not directly see that less was needed. In a few places, I have added a bit more timeout so that it will work with the 0.7 timeout factor. > > These fixes have been created when I have ploughed through test cases: > JDK-8352719: Add an equals sign to the modules statement > JDK-8352709: Remove bad timing annotations from WhileOpTest.java > JDK-8352074: Test MemoryLeak.java seems not to test what it is supposed to test > CODETOOLS-7903937: JTREG uses timeout factor on socket timeout but not on KEEPALIVE > CODETOOLS-7903961: Make default timeout configurable > > After the review, I will update the copyrights. > > I have run testing tier1-8. The last time with a timeout factor of 1 instead of 0.7. > > I got 4 timing related faults: > 1) runtime/Thread/TestThreadDumpMonitorContention.java > This is probably: https://bugs.openjdk.org/browse/JDK-8361370 > 2) sun/tools/jhsdb/BasicLauncherTest.java > I am unsure about this one, it has not failed on my runs before, even with a timeout factor of 0.7, maybe I was unlucky. > 3) gc/stress/TestReclaimStringsLeaksMemory.java > I updated this to 480 seconds, I finish this fairly fast (~14s) on my not very fast computer, but the Macs that fail are old x86-based ones. > 4) sun/security/ssl/X509KeyManager/CertChecking.java > This is a new test that I got on last rebase. I have added a timeout of 480 to it. > > In addition to these four tests, I have another one "java/lang/ThreadLocal/MemoryLeak.java" that earlier failed with a timeout factor of 0.7 but did not fail in the last run. I will *not* update that test case, because the extra time spent is strange and should be looked at. I have created JDK-8352074 on that test case, and I will probably create another bug describing the timeout I got. > > From the review of the cancelled "8356171: Increase timeout for test cases as preparation for change of... Leo Korinth has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 10 additional commits since the last revision: - new timeouts - Merge branch '_master_jdk' into _8260555 - update copyright - revert added timeout, it is not needed - feedback from Mark Sheppard - update testing.md, remove makefile link, fix bad text - after suggestion from Daniel - added extra timeout for: jdk/internal/vm/Continuation/BasicExt.java#COMP_WINDOW_LENGTH_{1-3}-GC_AFTER_YIELD - After suggestions from Erik and Andrey - 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26749/files - new: https://git.openjdk.org/jdk/pull/26749/files/4b33904a..7ca719c8 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26749&range=07 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26749&range=06-07 Stats: 37788 lines in 1054 files changed: 23834 ins; 9562 del; 4392 mod Patch: https://git.openjdk.org/jdk/pull/26749.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26749/head:pull/26749 PR: https://git.openjdk.org/jdk/pull/26749 From jsjolen at openjdk.org Mon Sep 1 08:16:24 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Mon, 1 Sep 2025 08:16:24 GMT Subject: RFR: 8366456: Allow AllocFailStrategy for RBTree Message-ID: Right now the RBTree forces you to use the intrusive tree if you want fine-grained control of the out-of-memory strategy of the node allocations. We can change this to be a bit more flexible. One of the tests were incorrectly indented, so I fixed that. I also changed from `typedef` to `using`, turns out that `typedef` can give strange errors when the template instantiation is incorrect[0]. [0] For my particular gcc ------------- Commit messages: - Fix - ? - Allow OOM strategy for RBTree Changes: https://git.openjdk.org/jdk/pull/27011/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27011&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8366456 Stats: 46 lines in 2 files changed: 21 ins; 0 del; 25 mod Patch: https://git.openjdk.org/jdk/pull/27011.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27011/head:pull/27011 PR: https://git.openjdk.org/jdk/pull/27011 From cnorrbin at openjdk.org Mon Sep 1 08:45:41 2025 From: cnorrbin at openjdk.org (Casper Norrbin) Date: Mon, 1 Sep 2025 08:45:41 GMT Subject: RFR: 8366456: Allow AllocFailStrategy for RBTree In-Reply-To: References: Message-ID: <0fUdaBBBBygInmHUhN8Ll91L_kn8KhoCPqABkJtCJug=.029535eb-108b-4bcd-8047-b40236c20d80@github.com> On Fri, 29 Aug 2025 19:17:58 GMT, Johan Sj?len wrote: > Right now the RBTree forces you to use the intrusive tree if you want fine-grained control of the out-of-memory strategy of the node allocations. We can change this to be a bit more flexible. > > One of the tests were incorrectly indented, so I fixed that. I also changed from `typedef` to `using`, turns out that `typedef` can give strange errors when the template instantiation is incorrect[0]. > > [0] For my particular gcc Thank you for this. Would make the tree more flexible to use. This comment at the top needs to be edited/removed since we can now handle allocations failing. Looks good otherwise! https://github.com/openjdk/jdk/blob/fe4c7a0429a2cf9ef47701d68d0852ce44e1a9ab/src/hotspot/share/utilities/rbTree.hpp#L64 ------------- PR Review: https://git.openjdk.org/jdk/pull/27011#pullrequestreview-3172706368 From jsjolen at openjdk.org Mon Sep 1 08:57:30 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Mon, 1 Sep 2025 08:57:30 GMT Subject: RFR: 8366456: Allow AllocFailStrategy for RBTree [v2] In-Reply-To: References: Message-ID: > Right now the RBTree forces you to use the intrusive tree if you want fine-grained control of the out-of-memory strategy of the node allocations. We can change this to be a bit more flexible. > > One of the tests were incorrectly indented, so I fixed that. I also changed from `typedef` to `using`, turns out that `typedef` can give strange errors when the template instantiation is incorrect[0]. > > [0] For my particular gcc Johan Sj?len has updated the pull request incrementally with one additional commit since the last revision: Remove ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27011/files - new: https://git.openjdk.org/jdk/pull/27011/files/8af9afc7..997e9592 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27011&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27011&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/27011.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27011/head:pull/27011 PR: https://git.openjdk.org/jdk/pull/27011 From jsjolen at openjdk.org Mon Sep 1 08:57:30 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Mon, 1 Sep 2025 08:57:30 GMT Subject: RFR: 8366456: Allow AllocFailStrategy for RBTree [v2] In-Reply-To: <0fUdaBBBBygInmHUhN8Ll91L_kn8KhoCPqABkJtCJug=.029535eb-108b-4bcd-8047-b40236c20d80@github.com> References: <0fUdaBBBBygInmHUhN8Ll91L_kn8KhoCPqABkJtCJug=.029535eb-108b-4bcd-8047-b40236c20d80@github.com> Message-ID: On Mon, 1 Sep 2025 08:43:05 GMT, Casper Norrbin wrote: > Thank you for this. Would make the tree more flexible to use. > > This comment at the top needs to be edited/removed since we can now handle allocations failing. Looks good otherwise! > > https://github.com/openjdk/jdk/blob/fe4c7a0429a2cf9ef47701d68d0852ce44e1a9ab/src/hotspot/share/utilities/rbTree.hpp#L64 I decided to just remove the comment. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27011#issuecomment-3241486886 From cnorrbin at openjdk.org Mon Sep 1 09:09:42 2025 From: cnorrbin at openjdk.org (Casper Norrbin) Date: Mon, 1 Sep 2025 09:09:42 GMT Subject: RFR: 8366456: Allow AllocFailStrategy for RBTree [v2] In-Reply-To: References: Message-ID: <7O_rR7ovfMNoc5ybXvhENhWdY1YMlUv-AWSX7e7e9Uc=.11b3e382-d89f-428c-8518-bc63bc168012@github.com> On Mon, 1 Sep 2025 08:57:30 GMT, Johan Sj?len wrote: >> Right now the RBTree forces you to use the intrusive tree if you want fine-grained control of the out-of-memory strategy of the node allocations. We can change this to be a bit more flexible. >> >> One of the tests were incorrectly indented, so I fixed that. I also changed from `typedef` to `using`, turns out that `typedef` can give strange errors when the template instantiation is incorrect[0]. >> >> [0] For my particular gcc > > Johan Sj?len has updated the pull request incrementally with one additional commit since the last revision: > > Remove Marked as reviewed by cnorrbin (Committer). ------------- PR Review: https://git.openjdk.org/jdk/pull/27011#pullrequestreview-3172798497 From jsjolen at openjdk.org Mon Sep 1 09:16:43 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Mon, 1 Sep 2025 09:16:43 GMT Subject: RFR: 8366238: Improve RBTree API with stricter comparator semantics and pluggable validation/printing hooks. [v3] In-Reply-To: <9p4A1E9arftDmwBvVfAMxnqbvBUZ9heQ4jbYXeEowrw=.76647921-46a2-4be2-9c7a-f19b167a71e9@github.com> References: <9p4A1E9arftDmwBvVfAMxnqbvBUZ9heQ4jbYXeEowrw=.76647921-46a2-4be2-9c7a-f19b167a71e9@github.com> Message-ID: On Thu, 28 Aug 2025 11:21:00 GMT, Casper Norrbin wrote: >> Hi everyone, >> >> The current red-black tree can be made safer, and its inspection capabilities improved. >> >> As briefly discussed in #26904, `COMPARATOR::cmp` could be made clearer and more robust. In particular, its `int` return type invites unsafe `return a ? b` arithmetic, and the boolean validation function also named `cmp` is misleading. >> >> To address this, I?ve introduced the `RBTreeOrdering` enum, inspired by C++20?s `<=>`, which makes incorrect arithmetic impossible. The return type of `COMPARATOR::cmp` is now this enum, forcing users to write an explicit and safe comparison. From the discussion in that PR, I have also renamed the boolean `cmp` to `less`, making its purpose obvious and preventing confusion between the two functions. >> >> Inspection has also been improved, especially for intrusive trees. Previously, `verify_self` only verified core RB-tree properties, yet intrusive nodes often hold additional data with their own separate invariants. Users had to perform those checks in a second traversal, and if an error occurs `print_on` produced little diagnostic value by only printing node addresses. >> >> To solve this, the tree now accepts user-supplied verification and printing callables. This lets users validate their custom node data during the same walk and print richer information when errors occur. >> >> Everything is implemented via template parameters with set defaults, so existing code remains unchanged while new code can opt in to the expanded functionality. >> >> Testing: >> - Oracle tiers 1-3 > > Casper Norrbin has updated the pull request incrementally with one additional commit since the last revision: > > albert feedback src/hotspot/share/utilities/rbTree.hpp line 65: > 63: // Nodes are address stable and will not change during its lifetime. > 64: > 65: enum class RBTreeOrdering : int { less = -1, equal = 0, greater = 1 }; Is assigning the elements to specific values necessary? src/hotspot/share/utilities/rbTree.hpp line 133: > 131: size_t& tree_depth, bool expect_visited, NodeVerifier verifier, > 132: const USER_VERIFIER& extra_verifier) const; > 133: `NodeType` is unused. Here we have two different naming standards for the template name. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26981#discussion_r2313349689 PR Review Comment: https://git.openjdk.org/jdk/pull/26981#discussion_r2313358762 From jsjolen at openjdk.org Mon Sep 1 09:16:44 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Mon, 1 Sep 2025 09:16:44 GMT Subject: RFR: 8366238: Improve RBTree API with stricter comparator semantics and pluggable validation/printing hooks. [v3] In-Reply-To: References: <9p4A1E9arftDmwBvVfAMxnqbvBUZ9heQ4jbYXeEowrw=.76647921-46a2-4be2-9c7a-f19b167a71e9@github.com> Message-ID: On Mon, 1 Sep 2025 09:04:17 GMT, Johan Sj?len wrote: >> Casper Norrbin has updated the pull request incrementally with one additional commit since the last revision: >> >> albert feedback > > src/hotspot/share/utilities/rbTree.hpp line 65: > >> 63: // Nodes are address stable and will not change during its lifetime. >> 64: >> 65: enum class RBTreeOrdering : int { less = -1, equal = 0, greater = 1 }; > > Is assigning the elements to specific values necessary? Personally, I'd prefer LT, EQ, GT to be the enum members. I'd like to see a `TotalOrdering` enum class in the future, to replace this. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26981#discussion_r2313370588 From duke at openjdk.org Mon Sep 1 09:20:42 2025 From: duke at openjdk.org (Francesco Andreuzzi) Date: Mon, 1 Sep 2025 09:20:42 GMT Subject: RFR: 8366155: Serial: Obsolete PretenureSizeThreshold In-Reply-To: References: Message-ID: On Tue, 26 Aug 2025 11:44:35 GMT, Albert Mingkun Yang wrote: > Remove obj-size checking before young/old-gen allocation -- an allocation succeeds iff there is enough free space. > > This simplifies the allocation logic: > 1. before attempting gc: `mem_allocate_work` does young-gen allocation then old-gen-no-expansion allocation > 2. after gc (still inside gc safepoint): `satisfy_failed_allocation` does young-gen allocation old-gen-with-expansion allocation > > Test: tier1-3 Marked as reviewed by fandreuz at github.com (no known OpenJDK username). ------------- PR Review: https://git.openjdk.org/jdk/pull/26941#pullrequestreview-3172831747 From jsjolen at openjdk.org Mon Sep 1 09:27:52 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Mon, 1 Sep 2025 09:27:52 GMT Subject: RFR: 8366456: Allow AllocFailStrategy for RBTree [v2] In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 08:57:30 GMT, Johan Sj?len wrote: >> Right now the RBTree forces you to use the intrusive tree if you want fine-grained control of the out-of-memory strategy of the node allocations. We can change this to be a bit more flexible. >> >> One of the tests were incorrectly indented, so I fixed that. I also changed from `typedef` to `using`, turns out that `typedef` can give strange errors when the template instantiation is incorrect[0]. >> >> [0] For my particular gcc > > Johan Sj?len has updated the pull request incrementally with one additional commit since the last revision: > > Remove Thanks. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27011#issuecomment-3241582575 From aboldtch at openjdk.org Mon Sep 1 09:27:51 2025 From: aboldtch at openjdk.org (Axel Boldt-Christmas) Date: Mon, 1 Sep 2025 09:27:51 GMT Subject: RFR: 8366456: Allow AllocFailStrategy for RBTree [v2] In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 08:57:30 GMT, Johan Sj?len wrote: >> Right now the RBTree forces you to use the intrusive tree if you want fine-grained control of the out-of-memory strategy of the node allocations. We can change this to be a bit more flexible. >> >> One of the tests were incorrectly indented, so I fixed that. I also changed from `typedef` to `using`, turns out that `typedef` can give strange errors when the template instantiation is incorrect[0]. >> >> [0] For my particular gcc > > Johan Sj?len has updated the pull request incrementally with one additional commit since the last revision: > > Remove lgtm. ------------- Marked as reviewed by aboldtch (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27011#pullrequestreview-3172844423 From jsjolen at openjdk.org Mon Sep 1 09:27:52 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Mon, 1 Sep 2025 09:27:52 GMT Subject: Integrated: 8366456: Allow AllocFailStrategy for RBTree In-Reply-To: References: Message-ID: On Fri, 29 Aug 2025 19:17:58 GMT, Johan Sj?len wrote: > Right now the RBTree forces you to use the intrusive tree if you want fine-grained control of the out-of-memory strategy of the node allocations. We can change this to be a bit more flexible. > > One of the tests were incorrectly indented, so I fixed that. I also changed from `typedef` to `using`, turns out that `typedef` can give strange errors when the template instantiation is incorrect[0]. > > [0] For my particular gcc This pull request has now been integrated. Changeset: 98af1892 Author: Johan Sj?len URL: https://git.openjdk.org/jdk/commit/98af18921aa3c274ef7ece03005337b58df3da96 Stats: 47 lines in 2 files changed: 21 ins; 1 del; 25 mod 8366456: Allow AllocFailStrategy for RBTree Reviewed-by: cnorrbin, aboldtch ------------- PR: https://git.openjdk.org/jdk/pull/27011 From adinn at openjdk.org Mon Sep 1 09:54:45 2025 From: adinn at openjdk.org (Andrew Dinn) Date: Mon, 1 Sep 2025 09:54:45 GMT Subject: RFR: 8365047: Remove exception handler stub code in C2 [v2] In-Reply-To: References: <4R-933Vw15ku03kFonQY4msXdmzkNVnawVWFB7Uu4k0=.1653f2ec-79d1-4076-aa03-4bae566d74c2@github.com> Message-ID: On Thu, 28 Aug 2025 22:25:24 GMT, Dean Long wrote: >> Ruben has updated the pull request incrementally with one additional commit since the last revision: >> >> Address review comments > > If we end up adding a nop or illegal instruction, then we can also undo the work-around that we did in JDK-8172844 for a similar problem. @dean-long I think there is an alternative fix for this that we should consider. The problem here arises because a return address for a legitimate call from the body may alias the nmethod's deopt_handler start. However, that aliasing is solely down to how we are recording and comparing addresses and I think we can easily and safely avoid it. The nmethod's deopt handler offset is set to identify the start of the deopt handler code generated into the stubs area. We need to be able to identify that stub's first instruction because we have to patch it into the stack or link register as a return address and then return to it in order to initiate a deopt. Removing the exception handler means it is now possible for it to directly follow the main code and alias the return address of a trailing call. We actually work hard to ensure that this same start address is recorded on the stack when we enter the deopt blob. The generated handler code always uses a jump to enter the deopt blob. However, it makes that jump look like a call by patching in a return address that equals the stub start. On Intel we make a fake call in order to push a return address and then carefully decrement the pushed address to refer to the stub start rather than the pushed address (i.e. the one that follows the fake call). On aarch64 it requires less work. The stub start is loaded into lr before jumping effectively simulating a call that just preceded the start address. Doing all this fiddling of the return pc is what makes the frame code test for a deopt caller frame both *simple* -- just compare the pc to the nmethod's deopt address -- and *ambiguous* -- oops it could have been a trailing call in the main code. However, we can easily avoid the ambiguity. We can switch to an actual call in the generated code and adjust the deopt_pc test in the frame code to look for the nmethod's deopt address *plus* some arch-specific constant offset. The offset's size is determined by whatever instructions we need to plant in order to get to and make the call. We can make this safe against code changes by binding a label after the call and asserting that the difference between the label address and stub start address equals the relevant constant. That will give correct results if we traverse the frame stack inside or below the deopt blob code. But what about when we fiddle the return stack to force a return into the deopt stub? i.e. when the return address is the nmethod's deopt stub address? I don't believe we will ever traverse the stack while it is in that state because it only happens transiently when we are returning into the deopt handler. WDYT? ------------- PR Comment: https://git.openjdk.org/jdk/pull/26678#issuecomment-3241676272 From aph at openjdk.org Mon Sep 1 10:14:42 2025 From: aph at openjdk.org (Andrew Haley) Date: Mon, 1 Sep 2025 10:14:42 GMT Subject: RFR: 8365991: AArch64: Ignore BlockZeroingLowLimit when UseBlockZeroing is false [v2] In-Reply-To: <79QlFmmh7CAbxtU89RNVbf8sRBE_u8TbDLA90FqWyEM=.4e8b48ac-21b5-4881-9ca0-29bc87bfe032@github.com> References: <79QlFmmh7CAbxtU89RNVbf8sRBE_u8TbDLA90FqWyEM=.4e8b48ac-21b5-4881-9ca0-29bc87bfe032@github.com> Message-ID: On Fri, 29 Aug 2025 11:34:26 GMT, Patrick Zhang wrote: >> In AArch64 port, `UseBlockZeroing` is by default set to true and `BlockZeroingLowLimit` is initialized to 256. If `DC ZVA` is supported, `BlockZeroingLowLimit` is later updated to `4 * VM_Version::zva_length()`. When `UseBlockZeroing` is set to false, all related conditional checks should ignore `BlockZeroingLowLimit`. However, the function `MacroAssembler::zero_words(Register base, uint64_t cnt)` still evaluates the lower limit and bases its code generation logic on it, which appears to be an incomplete conditional check. >> >> This PR, >> 1. In `MacroAssembler::zero_words(Register base, uint64_t cnt)`, added the checking of `UseBlockZeroing` to the if-cond `cnt > (uint64_t)BlockZeroingLowLimit / BytesPerWord`, strengthened the condition. >> 2. In `MacroAssembler::zero_words(Register ptr, Register cnt)`, check `UseBlockZeroing` before checking the conditions of calling the stub function `zero_blocks`, which wraps the `DC ZVA` related instructions and works as the inner part of `zero_words`. Refined code and comments. >> 3. For `generate_zero_blocks()`, removed the `UseBlockZeroing` checking and added an assertion, moved unrolled `STP` code-gen out to the caller side >> 4. Added a warning message for if UseBlockZeroing is false and BlockZeroingLowLimit gets manually configured. >> 5. Added more testing sizes to test/micro/org/openjdk/bench/vm/gc/RawAllocationRate.java >> >> These changes improved the if-conds in `zero_words` functions around `BlockZeroingLowLimit`, ignore it if `UseBlockZeroing` is false. Performance tests are done on the bundled JMH `vm.compiler.ClearMemory`, and `vm.gc.RawAllocationRate` including `arrayTest` and `instanceTest`. >> >> Tests include, >> 1. The wall time of `zero_words_reg_imm` got significantly improved under a particularly designed test case: `-XX:-UseBlockZeroing -XX:BlockZeroingLowLimit=8`, `size=32` (`arrayTest` and `instanceTest`), the average wall time per call dropped from 309 ns (baseline) to 65 ns (patched), about -80%. The average call count also decreased from 335 to 202, in a 30s run. For example, `jdk/bin/java -jar images/test/micro/benchmarks.jar RawAllocationRate.arrayTest_C1 -bm thrpt -gc false -wi 0 -w 30 -i 1 -r 30 -t 1 -f 1 -tu s -jvmArgs "-XX:-UseBlockZeroing -XX:BlockZeroingLowLimit=8" -p size=32`. >> 2. `JMH RawAllocationRate` shows no obvious regression results. In details, patched vs baseline shows average ~70% positive impact, but ratios are minor around +0.5%, since the generated instruction sequences g... > > Patrick Zhang has updated the pull request incrementally with one additional commit since the last revision: > > Roll back main changes on zero_words_reg_reg and generate_zero_blocks > > Signed-off-by: Patrick Zhang It's difficult for anyone to predict all the possibilities of `-XX` command-line arguments that users might try, despite them not making any sense. To begin with, please add this short patch, then see if any of this PR provides an advantage. diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp index 9321dd0542e..14a584c5106 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp @@ -446,6 +446,11 @@ void VM_Version::initialize() { FLAG_SET_DEFAULT(UseBlockZeroing, false); } + if (!UseBlockZeroing && !FLAG_IS_DEFAULT(BlockZeroingLowLimit)) { + warning("BlockZeroingLowLimit has been ignored because UseBlockZeroing is disabled"); + FLAG_SET_DEFAULT(BlockZeroingLowLimit, 4 * VM_Version::zva_length()); + } + if (VM_Version::supports_sve2()) { if (FLAG_IS_DEFAULT(UseSVE)) { FLAG_SET_DEFAULT(UseSVE, 2); ------------- PR Comment: https://git.openjdk.org/jdk/pull/26917#issuecomment-3241755892 From aph-open at littlepinkcloud.com Mon Sep 1 10:19:13 2025 From: aph-open at littlepinkcloud.com (Andrew Haley) Date: Mon, 1 Sep 2025 11:19:13 +0100 Subject: RFR: 8365991: AArch64: Ignore BlockZeroingLowLimit when UseBlockZeroing is false In-Reply-To: References: Message-ID: <66bf3e97-eeb6-4af3-8d30-89cd8d4367ec@littlepinkcloud.com> On 29/08/2025 12:10, Patrick Zhang wrote: > Regarding the impact to code caches, I measured JMH That's not going to tell you anything. The zeroing code is expanded many times during a compilation, and code cache size is limited. Every time we needlessly expand intrinsics inline we kick user's code out. -- Andrew Haley (he/him) Java Platform Lead Engineer https://keybase.io/andrewhaley EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From aph-open at littlepinkcloud.com Mon Sep 1 10:20:18 2025 From: aph-open at littlepinkcloud.com (Andrew Haley) Date: Mon, 1 Sep 2025 11:20:18 +0100 Subject: Random crashes/failures on Linux Aarch64 In-Reply-To: References: Message-ID: <9c47ee52-fddc-42b8-8f31-680e6d1ca676@littlepinkcloud.com> On 25/08/2025 00:03, David Holmes wrote: > Still collecting data and trying to see the pattern(s) here, but was > wondering if other CI's have also been seeing any issues? I'm not aware of any. Do you know when this started happening? -- Andrew Haley (he/him) Java Platform Lead Engineer https://keybase.io/andrewhaley EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From aboldtch at openjdk.org Mon Sep 1 10:22:44 2025 From: aboldtch at openjdk.org (Axel Boldt-Christmas) Date: Mon, 1 Sep 2025 10:22:44 GMT Subject: RFR: 8351334: [ubsan] memoryReserver.cpp:552:60: runtime error: applying non-zero offset 1073741824 to null pointer In-Reply-To: References: <3p8Po-zqSc7uti36zwqJbCeyBA-OqKDV7GfROVzvB9U=.7dfb19fc-946f-4039-90a5-8d63ee421318@github.com> <-Ct2yCIbRn7bSazmFKxlMPMeP85zAZk3kUfP9ele4so=.78e5ec0f-2d17-45e6-a68d-9fff149577c1@github.com> Message-ID: On Fri, 29 Aug 2025 10:14:22 GMT, Afshin Zafari wrote: > To answer 'when/how does this happen?', this issue can be reproduced by running `runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java`, in which invalid values of options will be tested, particularly here `0` for `HeapBaseMinAddress`. Yeah I as I mentioned I figured that part out, it occurs when `MaxHeapSize` is not default set. I am not sure that `0` is an invalid value for `HeapBaseMinAddress` nor that it is what the test is testing. It tests both valid and invalid values. As mentioned when manually checking extreme values in `HeapBaseMinAddress` I could provoke an arithmetic overflow cause crash. `TestOptionsWithRanges.java` fails to capture this because of limitations in our `PrintFlagsRanges` option, which does not capture constraints. It prints: size_t HeapBaseMinAddress [ 0 ... 18446744073709551615 ] But on my machine (running with G1) the actual upper limit is `18446744072635809792` And running `./images/jdk/bin/java -XX:HeapBaseMinAddress=18446744072635809792 -Xmx1g --version` results in: # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (src/hotspot/share/utilities/globalDefinitions.hpp:440), pid=1726885, tid=1726886 # assert(left >= right) failed: avoid underflow - left: 0x00000000c0000000 right: 0xffffffffc0000000 ------------- PR Comment: https://git.openjdk.org/jdk/pull/26955#issuecomment-3241790796 From adinn at openjdk.org Mon Sep 1 10:31:43 2025 From: adinn at openjdk.org (Andrew Dinn) Date: Mon, 1 Sep 2025 10:31:43 GMT Subject: RFR: 8365501: Remove special AdapterHandlerEntry for abstract methods [v3] In-Reply-To: References: Message-ID: <3Rdyz0i6XIKqcVC5Rbw1eDU4qZyawLb5JYWws3UARIw=.68cf8962-f5d5-47de-8cc3-d9b18b1453f0@github.com> On Wed, 27 Aug 2025 19:35:04 GMT, Ashutosh Mehra wrote: >> This PR removes the need for having AdapterHandlerEntry for abstract methods. The check for abstract method is now done in the accessor functions in Method such as Method::get_i2c_entry(). >> Motivation for this change is described in the JBS issue. > > Ashutosh Mehra has updated the pull request incrementally with one additional commit since the last revision: > > Address review comment - swap conditions > > Signed-off-by: Ashutosh Mehra Looks good but I would appreciate an explanation as to why we don't need the lock. src/hotspot/share/runtime/sharedRuntime.cpp line 2567: > 2565: { > 2566: ResourceMark rm; > 2567: MutexLocker mu(AdapterHandlerLibrary_lock); Why are we ok to drop this lock here? Was it unnecessary even before this change? ------------- Marked as reviewed by adinn (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26764#pullrequestreview-3173094876 PR Review Comment: https://git.openjdk.org/jdk/pull/26764#discussion_r2313562473 From krk at openjdk.org Mon Sep 1 11:42:17 2025 From: krk at openjdk.org (Kerem Kat) Date: Mon, 1 Sep 2025 11:42:17 GMT Subject: RFR: 8366154: Validate thread type requirements in debug commands Message-ID: Prevents segmentation faults during `gdb` sessions. The crashes were caused by the `ResourceMark` constructor being called on a native thread, which is not supported. This happened when invoking debug commands that require a `Thread` or `JavaThread` context from an incorrect thread type. ### Solution This change introduces `onThread()` and `onJavaThread()` helper methods to the `Command` class. These methods validate the thread context and ensure `ResourceMark` is only created when on a valid VM thread. All thread-dependent debug commands now use these guards to validate the context, printing a clear error and exiting gracefully upon failure. ### Testing Manually verified using `gdb` by calling the modified commands (`ps`, `universe`, `pns`, etc.) from different thread contexts (native, Java, and non-java threads) to ensure they fail gracefully with an error message instead of crashing the debug session. ------------- Commit messages: - Update src/hotspot/share/utilities/debug.cpp - 8366154: Validate thread type requirements in debug commands Changes: https://git.openjdk.org/jdk/pull/27033/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27033&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8366154 Stats: 63 lines in 1 file changed: 45 ins; 4 del; 14 mod Patch: https://git.openjdk.org/jdk/pull/27033.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27033/head:pull/27033 PR: https://git.openjdk.org/jdk/pull/27033 From duke at openjdk.org Mon Sep 1 11:42:17 2025 From: duke at openjdk.org (Francesco Andreuzzi) Date: Mon, 1 Sep 2025 11:42:17 GMT Subject: RFR: 8366154: Validate thread type requirements in debug commands In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 11:36:21 GMT, Kerem Kat wrote: > Prevents segmentation faults during `gdb` sessions. The crashes were caused by the `ResourceMark` constructor being called on a native thread, which is not supported. This happened when invoking debug commands that require a `Thread` or `JavaThread` context from an incorrect thread type. > > ### Solution > > This change introduces `onThread()` and `onJavaThread()` helper methods to the `Command` class. These methods validate the thread context and ensure `ResourceMark` is only created when on a valid VM thread. All thread-dependent debug commands now use these guards to validate the context, printing a clear error and exiting gracefully upon failure. > > ### Testing > > Manually verified using `gdb` by calling the modified commands (`ps`, `universe`, `pns`, etc.) from different thread contexts (native, Java, and non-java threads) to ensure they fail gracefully with an error message instead of crashing the debug session. src/hotspot/share/utilities/debug.cpp line 338: > 336: if (JavaThread::active() == nullptr) { > 337: tty->print_cr("Failed: Current thread is not a java thread or the vm thread"); > 338: return false; Suggestion: return false; ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27033#discussion_r2313718023 From duke at openjdk.org Mon Sep 1 11:50:01 2025 From: duke at openjdk.org (Ruben) Date: Mon, 1 Sep 2025 11:50:01 GMT Subject: RFR: 8365047: Remove exception handler stub code in C2 [v3] In-Reply-To: <4R-933Vw15ku03kFonQY4msXdmzkNVnawVWFB7Uu4k0=.1653f2ec-79d1-4076-aa03-4bae566d74c2@github.com> References: <4R-933Vw15ku03kFonQY4msXdmzkNVnawVWFB7Uu4k0=.1653f2ec-79d1-4076-aa03-4bae566d74c2@github.com> Message-ID: > The C2 exception handler stub code is only a trampoline to the generated exception handler blob. This change removes the extra step on the way to the generated blob. > > According to some comments in the source code, the exception handler stub code used to be patched upon deoptimization, however presumably these comments are outdated as the patching upon deoptimization happens for post-call NOPs only. Ruben has updated the pull request incrementally with one additional commit since the last revision: Ensure stub code is not adjacent to a call ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26678/files - new: https://git.openjdk.org/jdk/pull/26678/files/2d8012a3..1f6546e9 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26678&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26678&range=01-02 Stats: 17 lines in 1 file changed: 12 ins; 0 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/26678.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26678/head:pull/26678 PR: https://git.openjdk.org/jdk/pull/26678 From duke at openjdk.org Mon Sep 1 12:16:47 2025 From: duke at openjdk.org (Ruben) Date: Mon, 1 Sep 2025 12:16:47 GMT Subject: RFR: 8365047: Remove exception handler stub code in C2 [v2] In-Reply-To: References: <4R-933Vw15ku03kFonQY4msXdmzkNVnawVWFB7Uu4k0=.1653f2ec-79d1-4076-aa03-4bae566d74c2@github.com> Message-ID: On Mon, 1 Sep 2025 09:51:38 GMT, Andrew Dinn wrote: >> If we end up adding a nop or illegal instruction, then we can also undo the work-around that we did in JDK-8172844 for a similar problem. > > @dean-long I think there is an alternative fix for this that we should consider. The problem here arises because a return address for a legitimate call from the body may alias the nmethod's deopt_handler start. However, that aliasing is solely down to how we are recording and comparing addresses and I think we can easily and safely avoid it. > > The nmethod's deopt handler offset is set to identify the start of the deopt handler code generated into the stubs area. We need to be able to identify that stub's first instruction because we have to patch it into the stack or link register as a return address and then return to it in order to initiate a deopt. Removing the exception handler means it is now possible for it to directly follow the main code and alias the return address of a trailing call. > > We actually work hard to ensure that this same start address is recorded on the stack when we enter the deopt blob. The generated handler code always uses a jump to enter the deopt blob. However, it makes that jump look like a call by patching in a return address that equals the stub start. On Intel we make a fake call in order to push a return address and then carefully decrement the pushed address to refer to the stub start rather than the pushed address (i.e. the one that follows the fake call). On aarch64 it requires less work. The stub start is loaded into lr before jumping effectively simulating a call that just preceded the start address. > > Doing all this fiddling of the return pc is what makes the frame code test for a deopt caller frame both *simple* -- just compare the pc to the nmethod's deopt address -- and *ambiguous* -- oops! it could have been a trailing call in the main code. However, we can easily avoid the ambiguity. We can switch to an actual call in the generated code and adjust the deopt_pc test in the frame code to look for the nmethod's deopt address *plus* some arch-specific constant offset. The offset's size is determined by whatever instructions we need to plant in order to get to and make the call. We can make this safe against code changes by binding a label after the call and asserting that the difference between the label address and stub start address equals the relevant constant. > > That will give correct results if we traverse the frame stack inside or below the deopt blob code. But what about when we fiddle the return stack to force a return into the deopt stub? i.e. when the return address is the nmethod's deopt stub address? I don't b... Thank you for the feedback and suggestions, @adinn and @dean-long. I've prototyped adding a NOP at the end of main code region if otherwise the last instruction is a call - not an illegal instruction only to avoid tweaking the logic behind `MachHaltNode` or introducing a new node type. If `MachHaltNode` is used as is, it would add more than one instruction - otherwise, the signal handlers might have to be updated. > We can switch to an actual call in the generated code and adjust the deopt_pc test in the frame code to look for the nmethod's deopt address plus some arch-specific constant offset. I believe this alternative approach would work. I am planning to spend some time to prototype this. Also, I'm attempting to find an approach which would not require each `nmethod` to have a deoptimization handler stub code - the per-nmethod offset to the "original PC" stack slot appears to be the main obstacle in this. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26678#issuecomment-3242134771 From cnorrbin at openjdk.org Mon Sep 1 12:27:43 2025 From: cnorrbin at openjdk.org (Casper Norrbin) Date: Mon, 1 Sep 2025 12:27:43 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock In-Reply-To: <-Z6DWW-tqahqtLzZt0ULHvFrTwL3uINZemJFO2OivhA=.0d918002-6ea9-4330-a97a-4b36521b7ab5@github.com> References: <-Z6DWW-tqahqtLzZt0ULHvFrTwL3uINZemJFO2OivhA=.0d918002-6ea9-4330-a97a-4b36521b7ab5@github.com> Message-ID: On Fri, 29 Aug 2025 19:02:16 GMT, Johan Sj?len wrote: >> Hi, >> >> The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. > > src/hotspot/share/utilities/rbTree.hpp line 454: > >> 452: public: >> 453: RBTree() : BaseType(), _allocator() {} >> 454: RBTree(const RBTree& other) : BaseType(), _allocator() { > > @caspernorrbin , I added this. Does it look correct? Looks correct to me, as long as the value type can also be properly copy-constructible. Maybe we can add in an assert to avoid potential future misuse? :-) Something like: `assert(std::is_copy_constructible(), "Value type must be copy-constructible");` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27003#discussion_r2313812719 From duke at openjdk.org Mon Sep 1 12:55:31 2025 From: duke at openjdk.org (Francesco Andreuzzi) Date: Mon, 1 Sep 2025 12:55:31 GMT Subject: RFR: 8366556: Sort share/runtime includes Message-ID: This PR sorts the includes in `hotspot/share/runtime` using `SortIncludes.java`, and removes some unnecessary ones. I'm also adding the directory to `TestIncludesAreSorted`. Passes tier1. ------------- Commit messages: - sort Changes: https://git.openjdk.org/jdk/pull/27034/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27034&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8366556 Stats: 98 lines in 39 files changed: 45 ins; 52 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/27034.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27034/head:pull/27034 PR: https://git.openjdk.org/jdk/pull/27034 From tschatzl at openjdk.org Mon Sep 1 12:59:41 2025 From: tschatzl at openjdk.org (Thomas Schatzl) Date: Mon, 1 Sep 2025 12:59:41 GMT Subject: RFR: 8366155: Serial: Obsolete PretenureSizeThreshold In-Reply-To: References: Message-ID: On Tue, 26 Aug 2025 11:44:35 GMT, Albert Mingkun Yang wrote: > Remove obj-size checking before young/old-gen allocation -- an allocation succeeds iff there is enough free space. > > This simplifies the allocation logic: > 1. before attempting gc: `mem_allocate_work` does young-gen allocation then old-gen-no-expansion allocation > 2. after gc (still inside gc safepoint): `satisfy_failed_allocation` does young-gen allocation old-gen-with-expansion allocation > > Test: tier1-3 Seems good. ------------- Marked as reviewed by tschatzl (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26941#pullrequestreview-3173572869 From jsjolen at openjdk.org Mon Sep 1 13:15:45 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Mon, 1 Sep 2025 13:15:45 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock In-Reply-To: References: <-Z6DWW-tqahqtLzZt0ULHvFrTwL3uINZemJFO2OivhA=.0d918002-6ea9-4330-a97a-4b36521b7ab5@github.com> Message-ID: On Mon, 1 Sep 2025 12:25:25 GMT, Casper Norrbin wrote: >> src/hotspot/share/utilities/rbTree.hpp line 454: >> >>> 452: public: >>> 453: RBTree() : BaseType(), _allocator() {} >>> 454: RBTree(const RBTree& other) : BaseType(), _allocator() { >> >> @caspernorrbin , I added this. Does it look correct? > > Looks correct to me, as long as the value type can also be properly copy-constructible. Maybe we can add in an assert to avoid potential future misuse? :-) > > Something like: > `assert(std::is_copy_constructible(), "Value type must be copy-constructible");` Yeah, we can do that! I'll put it in a static_assert even. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27003#discussion_r2313930488 From ayang at openjdk.org Mon Sep 1 13:16:57 2025 From: ayang at openjdk.org (Albert Mingkun Yang) Date: Mon, 1 Sep 2025 13:16:57 GMT Subject: RFR: 8366556: Sort share/runtime includes In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 12:49:20 GMT, Francesco Andreuzzi wrote: > This PR sorts the includes in `hotspot/share/runtime` using `SortIncludes.java`, and removes some unnecessary ones. I'm also adding the directory to `TestIncludesAreSorted`. > > Passes tier1. A question regarding preexisting include; otherwise good. src/hotspot/share/runtime/flags/jvmFlagLimit.cpp line 26: > 24: > 25: #include "gc/shared/jvmFlagConstraintsGC.hpp" > 26: #include "gc/shared/referenceProcessor.hpp" Why is `referenceProcessor` needed in this file? ------------- Marked as reviewed by ayang (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27034#pullrequestreview-3173626893 PR Review Comment: https://git.openjdk.org/jdk/pull/27034#discussion_r2313931861 From epeter at openjdk.org Mon Sep 1 13:17:46 2025 From: epeter at openjdk.org (Emanuel Peter) Date: Mon, 1 Sep 2025 13:17:46 GMT Subject: RFR: 8360389: Support printing from C2 compiled code [v8] In-Reply-To: References: Message-ID: On Tue, 26 Aug 2025 14:41:21 GMT, Beno?t Maillard wrote: >> This PR adds support for printf-style debugging from C2 compiled code. This is implemented as a runtime call to a C++ method that prints the values of the nodes passed as arguments. The runtime C++ method is implemented with the help of variadic templates, as it is expected to support various combinations of argument types. >> >> ## Usage >> >> Suppose we have this piece of Java code, that simply computes an arithmetic operation, and >> that we compile `square` with C2. >> >> class Square { >> static int square(int a) { >> return a * a; >> } >> >> public static void main(String[] args) { >> square(9); >> } >> } >> >> >> We would like to inspect the node that contains the value returned in this method. >> We can add a call to `Compile::make_debug_print` and pass a message, the IGVN instance, as well as the node(s) that we would like to inspect. >> >> ```c++ >> void Compile::return_values(JVMState* jvms) { >> GraphKit kit(jvms); >> Node* ret = new ReturnNode(TypeFunc::Parms, >> kit.control(), >> kit.i_o(), >> kit.reset_memory(), >> kit.frameptr(), >> kit.returnadr()); >> // Add zero or 1 return values >> int ret_size = tf()->range()->cnt() - TypeFunc::Parms; >> >> >> Node* return_value; >> if (ret_size > 0) { >> kit.inc_sp(-ret_size); // pop the return value(s) >> kit.sync_jvms(); >> return_value = kit.argument(0); >> ret->add_req(return_value); >> >> // <-------------------- Simply insert this >> C->make_debug_print("return: ", initial_gvn(), return_value); >> } >> >> // bind it to root >> root()->add_req(ret); >> record_for_igvn(ret); >> initial_gvn()->transform(ret); >> } >> >> >> We can then call run our code with `-XX:CompileCommand="compileonly,Square::square` >> and we get the following output: >> >> >> return: >> int 81 >> >> >> This case is of course trivial, but more useful examples are shown later. >> >> ## Implementation >> >> The debugging capability is implemented as a runtime call to a C++ printing method. For this, `Compile::make_debug_print` inserts a `CallLeafNode` into the graph and rewires control flow as needed. >> >> The actual printing is handled by the `SharedRuntime::debug_print` method, written with a variadic template to support various argument type combinations. A pointer to this runtime method is obtained at compile time and is passed to the ... > > Beno?t Maillard has updated the pull request incrementally with one additional commit since the last revision: > > Fix mismatch with #ifdef COMPILER2 between .hpp and .cpp I have not read the PR in any detail. Just tried to use it in a bug I'm trying to fix. [JDK-8366490](https://bugs.openjdk.org/browse/JDK-8366490) So I did this: diff --git a/src/hotspot/share/opto/vectorization.cpp b/src/hotspot/share/opto/vectorization.cpp index cd5aba6c31d..1b1f7c2f6f2 100644 --- a/src/hotspot/share/opto/vectorization.cpp +++ b/src/hotspot/share/opto/vectorization.cpp @@ -1046,6 +1046,8 @@ BoolNode* VPointer::make_speculative_aliasing_check_with(const VPointer& other) tty->print("size2: "); size2->dump(); tty->print_cr("span1: "); span1->dump_bfs(5, nullptr, ""); tty->print_cr("span2: "); span2->dump_bfs(5, nullptr, ""); + + phase->C->make_debug_print("span ", &igvn, span1); } #endif And ran my test: `./java -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,Reduced1::test -XX:CompileCommand=printcompilation,Reduced1::* -XX:CompileCommand=dontinline,Reduced1::allocateArrays -XX:-TieredCompilation -Xbatch -XX:+StressGCM -XX:+TraceLoopOpts -XX:CompileCommand=TraceAutoVectorization,Reduced1::test,SW_INFO,SPECULATIVE_ALIASING_ANALYSIS -XX:+TraceNewVectors -XX:-LoopMultiversioning -XX:SuperWordAutomaticAlignment=0 -XX:+TraceDeoptimization Reduced1.java` class Reduced1 { static final int N = 400; static void allocateArrays() { for (int i = 0; 200_000 > i; ++i) { int[] a = new int[N]; } } static int[] test() { int a[] = new int[N]; allocateArrays(); for (int k = 0; k < 500; k++) { for (int i = 1; i < 69; i++) { a[i] = 14; a[4] -= 14; } } return a; } public static void main(String[] args) { int[] gold = test(); for (int r = 0; r < 10; r++) { int[] a = test(); System.out.println("a[4]: " + a[4]); if (a[4] != gold[4]) { throw new RuntimeException("wrong value " + gold[4] + " " + a[4]); } } } } But that got me some assert: # Internal Error (/home/empeter/Documents/oracle/jdk-fork2/open/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp:1126), pid=2630187, tid=2630207 # assert((i + 1) < total_args_passed && sig_bt[i + 1] == T_VOID) failed: expecting half 33 Stack: [0x00007fe32ed13000,0x00007fe32ee13000], sp=0x00007fe32ee0e8d0, free space=1006k 34 Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) 35 V [libjvm.so+0x19a3163] SharedRuntime::c_calling_convention(BasicType const*, VMRegPair*, int)+0x673 (sharedRuntime_x86_64.cpp:1126) 36 V [libjvm.so+0x1658abe] Matcher::match_sfpt(SafePointNode*)+0xd6e (matcher.cpp:1396) 37 V [libjvm.so+0x165b695] Matcher::xform(Node*, int)+0x1075 (matcher.cpp:1159) 38 V [libjvm.so+0x1661b53] Matcher::match()+0x1113 (matcher.cpp:369) 39 V [libjvm.so+0xb7b6ce] Compile::Code_Gen()+0x1fe (compile.cpp:3024) 40 V [libjvm.so+0xb81103] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1fd3 (compile.cpp:892) 41 V [libjvm.so+0x9a1f76] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x466 (c2compiler.cpp:147) 42 V [libjvm.so+0xb904c8] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xb48 (compileBroker.cpp:2342) 43 V [libjvm.so+0xb91650] CompileBroker::compiler_thread_loop()+0x530 (compileBroker.cpp:1986) 44 V [libjvm.so+0x10f258b] JavaThread::thread_main_inner()+0x13b (javaThread.cpp:775) 45 V [libjvm.so+0x1b63d16] Thread::call_run()+0xb6 (thread.cpp:243) 46 V [libjvm.so+0x17d94d8] thread_native_entry(Thread*)+0x128 (os_linux.cpp:892) Am I doing something wrong here, or is that maybe a limitation of the current implementation? ------------- PR Comment: https://git.openjdk.org/jdk/pull/26475#issuecomment-3242340816 From lkorinth at openjdk.org Mon Sep 1 13:21:49 2025 From: lkorinth at openjdk.org (Leo Korinth) Date: Mon, 1 Sep 2025 13:21:49 GMT Subject: RFR: 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 [v9] In-Reply-To: References: Message-ID: > This changes the timeout factor from 4 to 1. Most of the changes add timeouts to individual test cases so that I am able to run them with a timeout factor of 0.7 (some margin to the checked in factor of one) > > In addition to changing the timeout factor, I am also using a library call to parse the timeout factor from the Java properties (I cannot use the library function everywhere as jtreg does not allow me to add @library notations to non test case files). > > My approach has been to run all tests, and afterwards updating those that fail due to the timeout factor. The amount of updated test cases is huge, and my strategy has been to quadruple the timeout if I could not directly see that less was needed. In a few places, I have added a bit more timeout so that it will work with the 0.7 timeout factor. > > These fixes have been created when I have ploughed through test cases: > JDK-8352719: Add an equals sign to the modules statement > JDK-8352709: Remove bad timing annotations from WhileOpTest.java > JDK-8352074: Test MemoryLeak.java seems not to test what it is supposed to test > CODETOOLS-7903937: JTREG uses timeout factor on socket timeout but not on KEEPALIVE > CODETOOLS-7903961: Make default timeout configurable > > After the review, I will update the copyrights. > > I have run testing tier1-8. The last time with a timeout factor of 1 instead of 0.7. > > I got 4 timing related faults: > 1) runtime/Thread/TestThreadDumpMonitorContention.java > This is probably: https://bugs.openjdk.org/browse/JDK-8361370 > 2) sun/tools/jhsdb/BasicLauncherTest.java > I am unsure about this one, it has not failed on my runs before, even with a timeout factor of 0.7, maybe I was unlucky. > 3) gc/stress/TestReclaimStringsLeaksMemory.java > I updated this to 480 seconds, I finish this fairly fast (~14s) on my not very fast computer, but the Macs that fail are old x86-based ones. > 4) sun/security/ssl/X509KeyManager/CertChecking.java > This is a new test that I got on last rebase. I have added a timeout of 480 to it. > > In addition to these four tests, I have another one "java/lang/ThreadLocal/MemoryLeak.java" that earlier failed with a timeout factor of 0.7 but did not fail in the last run. I will *not* update that test case, because the extra time spent is strange and should be looked at. I have created JDK-8352074 on that test case, and I will probably create another bug describing the timeout I got. > > From the review of the cancelled "8356171: Increase timeout for test cases as preparation for change of... Leo Korinth has updated the pull request incrementally with one additional commit since the last revision: changed both test in GetStackTraceALotWhenBlocking to use timeout of 1200 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26749/files - new: https://git.openjdk.org/jdk/pull/26749/files/7ca719c8..5c0bcd19 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26749&range=08 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26749&range=07-08 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/26749.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26749/head:pull/26749 PR: https://git.openjdk.org/jdk/pull/26749 From jsjolen at openjdk.org Mon Sep 1 13:22:03 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Mon, 1 Sep 2025 13:22:03 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v2] In-Reply-To: References: Message-ID: <_elWT9cp-yBL5OiRriEiVRTq5JPu09BY6jxtjMw4GJI=.1df62cde-de1f-4703-9112-54d282a20a37@github.com> > Hi, > > The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. Johan Sj?len has updated the pull request incrementally with one additional commit since the last revision: Static assert copy-constructible ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27003/files - new: https://git.openjdk.org/jdk/pull/27003/files/958c9706..a125e582 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=00-01 Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/27003.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27003/head:pull/27003 PR: https://git.openjdk.org/jdk/pull/27003 From tschatzl at openjdk.org Mon Sep 1 13:24:37 2025 From: tschatzl at openjdk.org (Thomas Schatzl) Date: Mon, 1 Sep 2025 13:24:37 GMT Subject: RFR: 8342382: Implement JEP 522: G1 GC: Improve Throughput by Reducing Synchronization [v51] In-Reply-To: References: Message-ID: > Hi all, > > please review this change that implements (currently Draft) JEP: G1: Improve Application Throughput with a More Efficient Write-Barrier. > > The reason for posting this early is that this is a large change, and the JEP process is already taking very long with no end in sight but we would like to have this ready by JDK 25. > > ### Current situation > > With this change, G1 will reduce the post write barrier to much more resemble Parallel GC's as described in the JEP. The reason is that G1 lacks in throughput compared to Parallel/Serial GC due to larger barrier. > > The main reason for the current barrier is how g1 implements concurrent refinement: > * g1 tracks dirtied cards using sets (dirty card queue set - dcqs) of buffers (dirty card queues - dcq) containing the location of dirtied cards. Refinement threads pick up their contents to re-refine. The barrier needs to enqueue card locations. > * For correctness dirty card updates requires fine-grained synchronization between mutator and refinement threads, > * Finally there is generic code to avoid dirtying cards altogether (filters), to avoid executing the synchronization and the enqueuing as much as possible. > > These tasks require the current barrier to look as follows for an assignment `x.a = y` in pseudo code: > > > // Filtering > if (region(@x.a) == region(y)) goto done; // same region check > if (y == null) goto done; // null value check > if (card(@x.a) == young_card) goto done; // write to young gen check > StoreLoad; // synchronize > if (card(@x.a) == dirty_card) goto done; > > *card(@x.a) = dirty > > // Card tracking > enqueue(card-address(@x.a)) into thread-local-dcq; > if (thread-local-dcq is not full) goto done; > > call runtime to move thread-local-dcq into dcqs > > done: > > > Overall this post-write barrier alone is in the range of 40-50 total instructions, compared to three or four(!) for parallel and serial gc. > > The large size of the inlined barrier not only has a large code footprint, but also prevents some compiler optimizations like loop unrolling or inlining. > > There are several papers showing that this barrier alone can decrease throughput by 10-20% ([Yang12](https://dl.acm.org/doi/10.1145/2426642.2259004)), which is corroborated by some benchmarks (see links). > > The main idea for this change is to not use fine-grained synchronization between refinement and mutator threads, but coarse grained based on atomically switching card tables. Mutators only work on the "primary" card table, refinement threads on a se... Thomas Schatzl has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 68 commits: - Merge branch 'master' into 8342382-card-table-instead-of-dcq - * fix merge error - * forgot to actually save the files - Merge branch 'master' into 8342382-card-table-instead-of-dcq - Merge branch 'master' into 8342382-card-table-instead-of-dcq - Merge branch 'master' into 8342382-card-table-instead-of-dcq - Merge branch 'master' into 8342382-card-table-instead-of-dcq - * remove unused G1DetachedRefinementStats_lock - Merge branch 'master' into 8342382-card-table-instead-of-dcq - Merge branch 'master' into 8342382-card-table-instead-of-dcq - ... and 58 more: https://git.openjdk.org/jdk/compare/98af1892...4a41b40b ------------- Changes: https://git.openjdk.org/jdk/pull/23739/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23739&range=50 Stats: 7100 lines in 112 files changed: 2584 ins; 3578 del; 938 mod Patch: https://git.openjdk.org/jdk/pull/23739.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/23739/head:pull/23739 PR: https://git.openjdk.org/jdk/pull/23739 From duke at openjdk.org Mon Sep 1 13:26:37 2025 From: duke at openjdk.org (Francesco Andreuzzi) Date: Mon, 1 Sep 2025 13:26:37 GMT Subject: RFR: 8366556: Sort share/runtime includes [v2] In-Reply-To: References: Message-ID: <2bvgNWeNmR_PeSKtYLaY0SG3Bf0wavjjnYRXwyczFsg=.d48df777-38b3-411d-ab05-d94e8479dd10@github.com> > This PR sorts the includes in `hotspot/share/runtime` using `SortIncludes.java`, and removes some unnecessary ones. I'm also adding the directory to `TestIncludesAreSorted`. > > Passes tier1. Francesco Andreuzzi has updated the pull request incrementally with one additional commit since the last revision: nn ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27034/files - new: https://git.openjdk.org/jdk/pull/27034/files/0b29949f..279fb946 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27034&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27034&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/27034.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27034/head:pull/27034 PR: https://git.openjdk.org/jdk/pull/27034 From duke at openjdk.org Mon Sep 1 13:26:39 2025 From: duke at openjdk.org (Francesco Andreuzzi) Date: Mon, 1 Sep 2025 13:26:39 GMT Subject: RFR: 8366556: Sort share/runtime includes [v2] In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 13:13:10 GMT, Albert Mingkun Yang wrote: >> Francesco Andreuzzi has updated the pull request incrementally with one additional commit since the last revision: >> >> nn > > src/hotspot/share/runtime/flags/jvmFlagLimit.cpp line 26: > >> 24: >> 25: #include "gc/shared/jvmFlagConstraintsGC.hpp" >> 26: #include "gc/shared/referenceProcessor.hpp" > > Why is `referenceProcessor` needed in this file? `jvmFlagLimit.cpp` does not seem to use any of the symbols declared by `referenceProcessor.hpp`, so I guess the include can be removed: 279fb9460609892c693280e0f7b5808da697343c ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27034#discussion_r2313953097 From cnorrbin at openjdk.org Mon Sep 1 13:40:28 2025 From: cnorrbin at openjdk.org (Casper Norrbin) Date: Mon, 1 Sep 2025 13:40:28 GMT Subject: RFR: 8366238: Improve RBTree API with stricter comparator semantics and pluggable validation/printing hooks. [v4] In-Reply-To: References: Message-ID: > Hi everyone, > > The current red-black tree can be made safer, and its inspection capabilities improved. > > As briefly discussed in #26904, `COMPARATOR::cmp` could be made clearer and more robust. In particular, its `int` return type invites unsafe `return a ? b` arithmetic, and the boolean validation function also named `cmp` is misleading. > > To address this, I?ve introduced the `RBTreeOrdering` enum, inspired by C++20?s `<=>`, which makes incorrect arithmetic impossible. The return type of `COMPARATOR::cmp` is now this enum, forcing users to write an explicit and safe comparison. From the discussion in that PR, I have also renamed the boolean `cmp` to `less`, making its purpose obvious and preventing confusion between the two functions. > > Inspection has also been improved, especially for intrusive trees. Previously, `verify_self` only verified core RB-tree properties, yet intrusive nodes often hold additional data with their own separate invariants. Users had to perform those checks in a second traversal, and if an error occurs `print_on` produced little diagnostic value by only printing node addresses. > > To solve this, the tree now accepts user-supplied verification and printing callables. This lets users validate their custom node data during the same walk and print richer information when errors occur. > > Everything is implemented via template parameters with set defaults, so existing code remains unchanged while new code can opt in to the expanded functionality. > > Testing: > - Oracle tiers 1-3 Casper Norrbin has updated the pull request incrementally with one additional commit since the last revision: johan feedback ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26981/files - new: https://git.openjdk.org/jdk/pull/26981/files/f780a53e..f7ce633b Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26981&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26981&range=02-03 Stats: 56 lines in 6 files changed: 8 ins; 0 del; 48 mod Patch: https://git.openjdk.org/jdk/pull/26981.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26981/head:pull/26981 PR: https://git.openjdk.org/jdk/pull/26981 From cnorrbin at openjdk.org Mon Sep 1 13:40:29 2025 From: cnorrbin at openjdk.org (Casper Norrbin) Date: Mon, 1 Sep 2025 13:40:29 GMT Subject: RFR: 8366238: Improve RBTree API with stricter comparator semantics and pluggable validation/printing hooks. [v3] In-Reply-To: References: <9p4A1E9arftDmwBvVfAMxnqbvBUZ9heQ4jbYXeEowrw=.76647921-46a2-4be2-9c7a-f19b167a71e9@github.com> Message-ID: <0-Qp9OoEh4x_uB6YBWqTJJiDwcFVnY9xRlqKf2oIBNY=.2f9b5c13-d577-41e2-bf2d-090ca66f07cf@github.com> On Mon, 1 Sep 2025 09:12:49 GMT, Johan Sj?len wrote: >> src/hotspot/share/utilities/rbTree.hpp line 65: >> >>> 63: // Nodes are address stable and will not change during its lifetime. >>> 64: >>> 65: enum class RBTreeOrdering : int { less = -1, equal = 0, greater = 1 }; >> >> Is assigning the elements to specific values necessary? > > Personally, I'd prefer LT, EQ, GT to be the enum members. I'd like to see a `TotalOrdering` enum class in the future, to replace this. I assigned the values so they'd be similar to the previous `int` return, not really needed. I don't mind the other names, so renamed to LT, EQ, GT and removed the values. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26981#discussion_r2313986169 From cnorrbin at openjdk.org Mon Sep 1 13:40:29 2025 From: cnorrbin at openjdk.org (Casper Norrbin) Date: Mon, 1 Sep 2025 13:40:29 GMT Subject: RFR: 8366238: Improve RBTree API with stricter comparator semantics and pluggable validation/printing hooks. [v3] In-Reply-To: References: <9p4A1E9arftDmwBvVfAMxnqbvBUZ9heQ4jbYXeEowrw=.76647921-46a2-4be2-9c7a-f19b167a71e9@github.com> Message-ID: <1Rnx8JXn2FoHMMFGa04Nm9kqTNqZdYXJv-ZoOlYIrA8=.41f1a1f2-23cd-4eff-8565-3ffd7e82b2fd@github.com> On Mon, 1 Sep 2025 09:08:00 GMT, Johan Sj?len wrote: >> Casper Norrbin has updated the pull request incrementally with one additional commit since the last revision: >> >> albert feedback > > src/hotspot/share/utilities/rbTree.hpp line 133: > >> 131: size_t& tree_depth, bool expect_visited, NodeVerifier verifier, >> 132: const USER_VERIFIER& extra_verifier) const; >> 133: > > `NodeType` is unused. Here we have two different naming standards for the template name. `NodeType` is used in the inline file so is needed. Renamed `NodeVerifier` to `NODE_VERIFIER` to fit in with the other templates. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26981#discussion_r2313988884 From alanb at openjdk.org Mon Sep 1 13:55:46 2025 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 1 Sep 2025 13:55:46 GMT Subject: RFR: 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 [v9] In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 13:21:49 GMT, Leo Korinth wrote: >> This changes the timeout factor from 4 to 1. Most of the changes add timeouts to individual test cases so that I am able to run them with a timeout factor of 0.7 (some margin to the checked in factor of one) >> >> In addition to changing the timeout factor, I am also using a library call to parse the timeout factor from the Java properties (I cannot use the library function everywhere as jtreg does not allow me to add @library notations to non test case files). >> >> My approach has been to run all tests, and afterwards updating those that fail due to the timeout factor. The amount of updated test cases is huge, and my strategy has been to quadruple the timeout if I could not directly see that less was needed. In a few places, I have added a bit more timeout so that it will work with the 0.7 timeout factor. >> >> These fixes have been created when I have ploughed through test cases: >> JDK-8352719: Add an equals sign to the modules statement >> JDK-8352709: Remove bad timing annotations from WhileOpTest.java >> JDK-8352074: Test MemoryLeak.java seems not to test what it is supposed to test >> CODETOOLS-7903937: JTREG uses timeout factor on socket timeout but not on KEEPALIVE >> CODETOOLS-7903961: Make default timeout configurable >> >> After the review, I will update the copyrights. >> >> I have run testing tier1-8. The last time with a timeout factor of 1 instead of 0.7. >> >> I got 4 timing related faults: >> 1) runtime/Thread/TestThreadDumpMonitorContention.java >> This is probably: https://bugs.openjdk.org/browse/JDK-8361370 >> 2) sun/tools/jhsdb/BasicLauncherTest.java >> I am unsure about this one, it has not failed on my runs before, even with a timeout factor of 0.7, maybe I was unlucky. >> 3) gc/stress/TestReclaimStringsLeaksMemory.java >> I updated this to 480 seconds, I finish this fairly fast (~14s) on my not very fast computer, but the Macs that fail are old x86-based ones. >> 4) sun/security/ssl/X509KeyManager/CertChecking.java >> This is a new test that I got on last rebase. I have added a timeout of 480 to it. >> >> In addition to these four tests, I have another one "java/lang/ThreadLocal/MemoryLeak.java" that earlier failed with a timeout factor of 0.7 but did not fail in the last run. I will *not* update that test case, because the extra time spent is strange and should be looked at. I have created JDK-8352074 on that test case, and I will probably create another bug describing the timeout I got. >> >> From the review of the cancelled "8356171: ... > > Leo Korinth has updated the pull request incrementally with one additional commit since the last revision: > > changed both test in GetStackTraceALotWhenBlocking to use timeout of 1200 Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/26749#pullrequestreview-3173774701 From tschatzl at openjdk.org Mon Sep 1 14:24:34 2025 From: tschatzl at openjdk.org (Thomas Schatzl) Date: Mon, 1 Sep 2025 14:24:34 GMT Subject: RFR: 8342382: Implement JEP 522: G1 GC: Improve Throughput by Reducing Synchronization [v52] In-Reply-To: References: Message-ID: <8ppqEuxHuhM5tXXssVXaq-uQlixvWerkx3UxT-XYTmg=.b6a5ee73-33f0-4f58-b14d-808895da6347@github.com> > Hi all, > > please review this change that implements (currently Draft) JEP: G1: Improve Application Throughput with a More Efficient Write-Barrier. > > The reason for posting this early is that this is a large change, and the JEP process is already taking very long with no end in sight but we would like to have this ready by JDK 25. > > ### Current situation > > With this change, G1 will reduce the post write barrier to much more resemble Parallel GC's as described in the JEP. The reason is that G1 lacks in throughput compared to Parallel/Serial GC due to larger barrier. > > The main reason for the current barrier is how g1 implements concurrent refinement: > * g1 tracks dirtied cards using sets (dirty card queue set - dcqs) of buffers (dirty card queues - dcq) containing the location of dirtied cards. Refinement threads pick up their contents to re-refine. The barrier needs to enqueue card locations. > * For correctness dirty card updates requires fine-grained synchronization between mutator and refinement threads, > * Finally there is generic code to avoid dirtying cards altogether (filters), to avoid executing the synchronization and the enqueuing as much as possible. > > These tasks require the current barrier to look as follows for an assignment `x.a = y` in pseudo code: > > > // Filtering > if (region(@x.a) == region(y)) goto done; // same region check > if (y == null) goto done; // null value check > if (card(@x.a) == young_card) goto done; // write to young gen check > StoreLoad; // synchronize > if (card(@x.a) == dirty_card) goto done; > > *card(@x.a) = dirty > > // Card tracking > enqueue(card-address(@x.a)) into thread-local-dcq; > if (thread-local-dcq is not full) goto done; > > call runtime to move thread-local-dcq into dcqs > > done: > > > Overall this post-write barrier alone is in the range of 40-50 total instructions, compared to three or four(!) for parallel and serial gc. > > The large size of the inlined barrier not only has a large code footprint, but also prevents some compiler optimizations like loop unrolling or inlining. > > There are several papers showing that this barrier alone can decrease throughput by 10-20% ([Yang12](https://dl.acm.org/doi/10.1145/2426642.2259004)), which is corroborated by some benchmarks (see links). > > The main idea for this change is to not use fine-grained synchronization between refinement and mutator threads, but coarse grained based on atomically switching card tables. Mutators only work on the "primary" card table, refinement threads on a se... Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision: * commit merge changes ------------- Changes: - all: https://git.openjdk.org/jdk/pull/23739/files - new: https://git.openjdk.org/jdk/pull/23739/files/4a41b40b..b3873d66 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=23739&range=51 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=23739&range=50-51 Stats: 11 lines in 2 files changed: 0 ins; 11 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/23739.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/23739/head:pull/23739 PR: https://git.openjdk.org/jdk/pull/23739 From bmaillard at openjdk.org Mon Sep 1 14:43:45 2025 From: bmaillard at openjdk.org (=?UTF-8?B?QmVub8OudA==?= Maillard) Date: Mon, 1 Sep 2025 14:43:45 GMT Subject: RFR: 8360389: Support printing from C2 compiled code [v8] In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 13:15:08 GMT, Emanuel Peter wrote: >> Beno?t Maillard has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix mismatch with #ifdef COMPILER2 between .hpp and .cpp > > I have not read the PR in any detail. Just tried to use it in a bug I'm trying to fix. [JDK-8366490](https://bugs.openjdk.org/browse/JDK-8366490) > > So I did this: > > > diff --git a/src/hotspot/share/opto/vectorization.cpp b/src/hotspot/share/opto/vectorization.cpp > index cd5aba6c31d..1b1f7c2f6f2 100644 > --- a/src/hotspot/share/opto/vectorization.cpp > +++ b/src/hotspot/share/opto/vectorization.cpp > @@ -1046,6 +1046,8 @@ BoolNode* VPointer::make_speculative_aliasing_check_with(const VPointer& other) > tty->print("size2: "); size2->dump(); > tty->print_cr("span1: "); span1->dump_bfs(5, nullptr, ""); > tty->print_cr("span2: "); span2->dump_bfs(5, nullptr, ""); > + > + phase->C->make_debug_print("span ", &igvn, span1); > } > #endif > > > And ran my test: > `./java -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,Reduced1::test -XX:CompileCommand=printcompilation,Reduced1::* -XX:CompileCommand=dontinline,Reduced1::allocateArrays -XX:-TieredCompilation -Xbatch -XX:+StressGCM -XX:+TraceLoopOpts -XX:CompileCommand=TraceAutoVectorization,Reduced1::test,SW_INFO,SPECULATIVE_ALIASING_ANALYSIS -XX:+TraceNewVectors -XX:-LoopMultiversioning -XX:SuperWordAutomaticAlignment=0 -XX:+TraceDeoptimization Reduced1.java` > > > class Reduced1 { > static final int N = 400; > > static void allocateArrays() { > for (int i = 0; 200_000 > i; ++i) { > int[] a = new int[N]; > } > } > > static int[] test() { > int a[] = new int[N]; > allocateArrays(); > for (int k = 0; k < 500; k++) { > for (int i = 1; i < 69; i++) { > a[i] = 14; > a[4] -= 14; > } > } > return a; > } > > public static void main(String[] args) { > int[] gold = test(); > for (int r = 0; r < 10; r++) { > int[] a = test(); > System.out.println("a[4]: " + a[4]); > if (a[4] != gold[4]) { > throw new RuntimeException("wrong value " + gold[4] + " " + a[4]); > } > } > } > } > > > But that got me some assert: > > # Internal Error (/home/empeter/Documents/oracle/jdk-fork2/open/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp:1126), pid=2630187, tid=2630207 > # assert((i + 1) < total_args_passed && sig_bt[i + 1] == T_VOID) failed: expecting half > > 33 Stack: [0x00007fe32ed13000,0x00007fe32ee13000], sp=0x00007fe32ee0e8d0, free space=1006k > 34 Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) > 35 V [libjvm.so+0x19... When using `jlong` or `jdouble` you need to pass an additional placeholder half node @eme64. Here you can just do this: ```c++ phase->C->make_debug_print("span ", &igvn, span1, phase->C->top()); The first of the additional examples (identity optimizations) hints at this but I should have probably made it more explicit in the description. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26475#issuecomment-3242604663 From epeter at openjdk.org Mon Sep 1 14:43:46 2025 From: epeter at openjdk.org (Emanuel Peter) Date: Mon, 1 Sep 2025 14:43:46 GMT Subject: RFR: 8360389: Support printing from C2 compiled code [v8] In-Reply-To: References: Message-ID: On Tue, 26 Aug 2025 14:41:21 GMT, Beno?t Maillard wrote: >> This PR adds support for printf-style debugging from C2 compiled code. This is implemented as a runtime call to a C++ method that prints the values of the nodes passed as arguments. The runtime C++ method is implemented with the help of variadic templates, as it is expected to support various combinations of argument types. >> >> ## Usage >> >> Suppose we have this piece of Java code, that simply computes an arithmetic operation, and >> that we compile `square` with C2. >> >> class Square { >> static int square(int a) { >> return a * a; >> } >> >> public static void main(String[] args) { >> square(9); >> } >> } >> >> >> We would like to inspect the node that contains the value returned in this method. >> We can add a call to `Compile::make_debug_print` and pass a message, the IGVN instance, as well as the node(s) that we would like to inspect. >> >> ```c++ >> void Compile::return_values(JVMState* jvms) { >> GraphKit kit(jvms); >> Node* ret = new ReturnNode(TypeFunc::Parms, >> kit.control(), >> kit.i_o(), >> kit.reset_memory(), >> kit.frameptr(), >> kit.returnadr()); >> // Add zero or 1 return values >> int ret_size = tf()->range()->cnt() - TypeFunc::Parms; >> >> >> Node* return_value; >> if (ret_size > 0) { >> kit.inc_sp(-ret_size); // pop the return value(s) >> kit.sync_jvms(); >> return_value = kit.argument(0); >> ret->add_req(return_value); >> >> // <-------------------- Simply insert this >> C->make_debug_print("return: ", initial_gvn(), return_value); >> } >> >> // bind it to root >> root()->add_req(ret); >> record_for_igvn(ret); >> initial_gvn()->transform(ret); >> } >> >> >> We can then call run our code with `-XX:CompileCommand="compileonly,Square::square` >> and we get the following output: >> >> >> return: >> int 81 >> >> >> This case is of course trivial, but more useful examples are shown later. >> >> ## Implementation >> >> The debugging capability is implemented as a runtime call to a C++ printing method. For this, `Compile::make_debug_print` inserts a `CallLeafNode` into the graph and rewires control flow as needed. >> >> The actual printing is handled by the `SharedRuntime::debug_print` method, written with a variadic template to support various argument type combinations. A pointer to this runtime method is obtained at compile time and is passed to the ... > > Beno?t Maillard has updated the pull request incrementally with one additional commit since the last revision: > > Fix mismatch with #ifdef COMPILER2 between .hpp and .cpp Ah, I see! Could you verify that somehow in your function, to catch it early? Or is there any way we could drop the need for these place-holders? ------------- PR Comment: https://git.openjdk.org/jdk/pull/26475#issuecomment-3242610980 From vaivanov at openjdk.org Mon Sep 1 15:31:48 2025 From: vaivanov at openjdk.org (Vladimir Ivanov) Date: Mon, 1 Sep 2025 15:31:48 GMT Subject: RFR: 8365290: [perf] x86 ArrayFill intrinsic generates SPLIT_STORE for unaligned arrays [v4] In-Reply-To: References: Message-ID: On Sat, 30 Aug 2025 16:04:00 GMT, Vladimir Ivanov wrote: >> On the SRF platform for runs with intrinsic scores for the ArrayFill test reports ~2x drop for several sizes due to a lot of the 'MEM_UOPS_RETIRED.SPLIT_STORES' events. The 'good' case for the ArraysFill.testCharFill with size=8195 reports numbers like >> MEM_UOPS_RETIRED.SPLIT_LOADS | 22.6711 >> MEM_UOPS_RETIRED.SPLIT_STORES | 4.0859 >> while for 'bad' case these metrics are >> MEM_UOPS_RETIRED.SPLIT_LOADS | 69.1785 >> MEM_UOPS_RETIRED.SPLIT_STORES | 259200.3659 >> >> With alignment on the cache size no score drops due to split_stores but small reduction may be reported due to extra >> SRF 6740E | Size | orig | pathed | pO/orig >> -- | -- | -- | -- | -- >> ArraysFill.testByteFill | 16 | 152031.2 | 157001.2 | 1.03 >> ArraysFill.testByteFill | 31 | 125795.9 | 177399.2 | 1.41 >> ArraysFill.testByteFill | 250 | 57961.69 | 120981.9 | 2.09 >> ArraysFill.testByteFill | 266 | 44900.15 | 147893.8 | 3.29 >> ArraysFill.testByteFill | 511 | 61908.17 | 129830.1 | 2.10 >> ArraysFill.testByteFill | 2047 | 32255.51 | 41986.6 | 1.30 >> ArraysFill.testByteFill | 2048 | 31928.97 | 42154.3 | 1.32 >> ArraysFill.testByteFill | 8195 | 10690.15 | 11036.3 | 1.03 >> ArraysFill.testIntFill | 16 | 145030.7 | 318796.9 | 2.20 >> ArraysFill.testIntFill | 31 | 134138.4 | 212487 | 1.58 >> ArraysFill.testIntFill | 250 | 74179.23 | 79522.66 | 1.07 >> ArraysFill.testIntFill | 266 | 68112.72 | 60116.49 | 0.88 >> ArraysFill.testIntFill | 511 | 39693.28 | 36225.09 | 0.91 >> ArraysFill.testIntFill | 2047 | 11504.14 | 10616.91 | 0.92 >> ArraysFill.testIntFill | 2048 | 11244.71 | 10969.14 | 0.98 >> ArraysFill.testIntFill | 8195 | 2751.289 | 2692.216 | 0.98 >> ArraysFill.testLongFill | 16 | 212532.5 | 212526 | 1.00 >> ArraysFill.testLongFill | 31 | 137432.4 | 137283.3 | 1.00 >> ArraysFill.testLongFill | 250 | 43185 | 43159.78 | 1.00 >> ArraysFill.testLongFill | 266 | 42172.22 | 42170.5 | 1.00 >> ArraysFill.testLongFill | 511 | 23370.15 | 23370.86 | 1.00 >> ArraysFill.testLongFill | 2047 | 6123.008 | 6122.73 | 1.00 >> ArraysFill.testLongFill | 2048 | 5793.722 | 5792.855 | 1.00 >> ArraysFill.testLongFill | 8195 | 616.552 | 616.585 | 1.00 >> ArraysFill.testShortFill | 16 | 152088.6 | 265646.1 | 1.75 >> ArraysFill.testShortFill | 31 | 137369.8 | 185596.4 | 1.35 >> ArraysFill.testShortFill | 250 | 58872.03 | 99621.15 | 1.69 >> ArraysFill.testShortFill | 266 | 91085.31 | 93746.62 | 1.03 >> ArraysFill.testShortFill | 511 | 65331.96 | 78003.83 | 1.19 >> ArraysFill.testShortFill | 2047 | 21716.32 | 21216.81 | 0.98 >> ArraysFill.testShortFill... > > Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision: > > JDK-8365290 [perf] x86 ArrayFill intrinsic generates SPLIT_STORE for unaligned arrays Later alignment improve performance a little bit. Current numbers are: SRF | size | jdk26 | patched with "+optFill" | patched/jdk26 ArraysFill.testByteFill | 16 | 151937.634 | 175045.819 | 1.15 ArraysFill.testByteFill | 31 | 125661.092 | 211226.668 | 1.68 ArraysFill.testByteFill | 250 | 57599.684 | 123670.638 | 2.15 ArraysFill.testByteFill | 266 | 44617.505 | 147306.352 | 3.30 ArraysFill.testByteFill | 511 | 61541.499 | 129234.48 | 2.10 ArraysFill.testByteFill | 2047 | 32073.997 | 41503.438 | 1.29 ArraysFill.testByteFill | 2048 | 31729.263 | 41977.271 | 1.32 ArraysFill.testByteFill | 8195 | 10620.363 | 10911.334 | 1.03 ArraysFill.testIntFill | 16 | 144924.577 | 264101.45 | 1.82 ArraysFill.testIntFill | 31 | 128877.207 | 211225.233 | 1.64 ArraysFill.testIntFill | 250 | 73785.182 | 79204.674 | 1.07 ArraysFill.testIntFill | 266 | 67703.171 | 75436.831 | 1.11 ArraysFill.testIntFill | 511 | 39489.095 | 36011.078 | 0.91 ArraysFill.testIntFill | 2047 | 11431.835 | 10509.545 | 0.92 ArraysFill.testIntFill | 2048 | 11178.661 | 10882.991 | 0.97 ArraysFill.testIntFill | 8195 | 2629.065 | 2601.19 | 0.99 ArraysFill.testLongFill | 16 | 211218.892 | 211250.585 | 1.00 ArraysFill.testLongFill | 31 | 133026.186 | 137374.876 | 1.03 ArraysFill.testLongFill | 250 | 42907.745 | 42937.988 | 1.00 ArraysFill.testLongFill | 266 | 41935.645 | 41920.801 | 1.00 ArraysFill.testLongFill | 511 | 23217.606 | 23227.904 | 1.00 ArraysFill.testLongFill | 2047 | 6083.099 | 6083.384 | 1.00 ArraysFill.testLongFill | 2048 | 5751.203 | 5753.409 | 1.00 ArraysFill.testLongFill | 8195 | 612.17 | 612.634 | 1.00 ArraysFill.testShortFill | 16 | 151917.079 | 352122.571 | 2.32 ArraysFill.testShortFill | 31 | 138000.217 | 226271.221 | 1.64 ArraysFill.testShortFill | 250 | 58641.362 | 99043.571 | 1.69 ArraysFill.testShortFill | 266 | 90499.649 | 93200.335 | 1.03 ArraysFill.testShortFill | 511 | 64958.462 | 77930.734 | 1.20 ArraysFill.testShortFill | 2047 | 21577.954 | 21210.006 | 0.98 ArraysFill.testShortFill | 2048 | 21538.005 | 21429.382 | 0.99 ArraysFill.testShortFill | 8195 | 5883.097 | 5775.499 | 0.98 ------------- PR Comment: https://git.openjdk.org/jdk/pull/26747#issuecomment-3242746861 From lkorinth at openjdk.org Mon Sep 1 16:00:47 2025 From: lkorinth at openjdk.org (Leo Korinth) Date: Mon, 1 Sep 2025 16:00:47 GMT Subject: RFR: 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 [v5] In-Reply-To: References: Message-ID: <9X-5PBm7G1Y8vJ8bw02E501aWdgleLyUWMk3nhSrF08=.bb490a54-e687-49cc-9ecc-df7c051eef18@github.com> On Fri, 22 Aug 2025 15:46:18 GMT, Albert Mingkun Yang wrote: >> Leo Korinth has updated the pull request incrementally with one additional commit since the last revision: >> >> update testing.md, remove makefile link, fix bad text > > test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume2/SuspendResume2.java line 31: > >> 29: * @compile SuspendResume2.java >> 30: * @run driver jdk.test.lib.FileInstaller . . >> 31: * @run main/othervm/native/timeout=700 > > Why `700` instead of `480` in this file? I think this is one of the earlier tests that failed with a timeout factor of `0.7` on 480. Later on I doubled it, but here I was a bit more conservative. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26749#discussion_r2314279387 From lkorinth at openjdk.org Mon Sep 1 16:09:44 2025 From: lkorinth at openjdk.org (Leo Korinth) Date: Mon, 1 Sep 2025 16:09:44 GMT Subject: RFR: 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 [v5] In-Reply-To: References: Message-ID: On Mon, 25 Aug 2025 13:48:10 GMT, Albert Mingkun Yang wrote: >> It is a way to give a "4x" lowest value, while not multiplying a 10x factor with four resulting in a 40x factor. I think (but I am not sure) that it would sometime time out if I only used the given timeout factor and not "guarding" with the max(x, 4). > >> while not multiplying a 10x factor with four resulting in a 40x factor. > > Why is that undesirable? The base is `(HOLD_TARGET_TIME + 30000) * 4` and the timeout-factor changes that linearly. Using `max(..., 4)` here may come as a surprise to end users, IMO. Because 40x is a very large timeout factor. I think I might misunderstand you in some way. My change is conservative, and will give a timeout that is not smaller than before (but can be larger if an explicit (non-default) timeout factor less than 4 was used before). Does that make sense, or do I answer something different from what you are asking? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26749#discussion_r2314295263 From david.holmes at oracle.com Mon Sep 1 21:26:42 2025 From: david.holmes at oracle.com (David Holmes) Date: Tue, 2 Sep 2025 07:26:42 +1000 Subject: Random crashes/failures on Linux Aarch64 In-Reply-To: <9c47ee52-fddc-42b8-8f31-680e6d1ca676@littlepinkcloud.com> References: <9c47ee52-fddc-42b8-8f31-680e6d1ca676@littlepinkcloud.com> Message-ID: Hi Andrew, On 1/09/2025 8:20 pm, Andrew Haley wrote: > On 25/08/2025 00:03, David Holmes wrote: >> Still collecting data and trying to see the pattern(s) here, but was >> wondering if other CI's have also been seeing any issues? > > I'm not aware of any. Do you know when this started happening? We have tracked this down to the introduction of new hardware in our CI at the start of August. David From dholmes at openjdk.org Mon Sep 1 22:02:44 2025 From: dholmes at openjdk.org (David Holmes) Date: Mon, 1 Sep 2025 22:02:44 GMT Subject: RFR: 8366154: Validate thread type requirements in debug commands In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 11:36:21 GMT, Kerem Kat wrote: > Prevents segmentation faults during `gdb` sessions. The crashes were caused by the `ResourceMark` constructor being called on a native thread, which is not supported. This happened when invoking debug commands that require a `Thread` or `JavaThread` context from an incorrect thread type. > > ### Solution > > This change introduces `onThread()` and `onJavaThread()` helper methods to the `Command` class. These methods validate the thread context and ensure `ResourceMark` is only created when on a valid VM thread. All thread-dependent debug commands now use these guards to validate the context, printing a clear error and exiting gracefully upon failure. > > ### Testing > > Manually verified using `gdb` by calling the modified commands (`ps`, `universe`, `pns`, etc.) from different thread contexts (native, Java, and non-java threads) to ensure they fail gracefully with an error message instead of crashing the debug session. We typically assume the user knows what they are doing at this level, but I suppose making it a little more robust doesn't hurt. I don't think we quite need everything though. Thanks src/hotspot/share/utilities/debug.cpp line 326: > 324: } > 325: > 326: if (!_has_rm) { Is it even possible for this not to be false with correct usage? src/hotspot/share/utilities/debug.cpp line 327: > 325: > 326: if (!_has_rm) { > 327: ::new (&_rm) ResourceMark(); There should be `#include ` to use global placement-new. src/hotspot/share/utilities/debug.cpp line 341: > 339: } > 340: return true; > 341: } I don't think we need this. The commands that require a JavaThread should be checking that directly themselves. Typically we assume/expect the person debugging to know what they are dealing with and use the appropriate commands. ------------- Changes requested by dholmes (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27033#pullrequestreview-3174512977 PR Review Comment: https://git.openjdk.org/jdk/pull/27033#discussion_r2314601972 PR Review Comment: https://git.openjdk.org/jdk/pull/27033#discussion_r2314595903 PR Review Comment: https://git.openjdk.org/jdk/pull/27033#discussion_r2314599669 From lmesnik at openjdk.org Tue Sep 2 01:16:55 2025 From: lmesnik at openjdk.org (Leonid Mesnik) Date: Tue, 2 Sep 2025 01:16:55 GMT Subject: RFR: 8365937: post_method_exit might incorrectly set was_popped_by_exception and value in the middle of stack unwinding [v4] In-Reply-To: <1n0gbxAE37Nf7SHwUFLwCr1fJ2W4EuPh88kxMyO8un0=.5e803b50-f08f-4887-8d4c-3eb37156a754@github.com> References: <2SqwKSSfcLR6krBk2CYQZ8Q5X2T1eK4gaM4D6Hte2WA=.f4e906aa-4ffe-4d50-ba59-0ef12fb2f790@github.com> <1n0gbxAE37Nf7SHwUFLwCr1fJ2W4EuPh88kxMyO8un0=.5e803b50-f08f-4887-8d4c-3eb37156a754@github.com> Message-ID: On Mon, 1 Sep 2025 05:19:51 GMT, David Holmes wrote: >> Sorry I still can't see this. Method A throws an exception. The callback for the method-exit event for method A then invokes Java method B. Method B also has a callback enabled and so we are processing the method-exit for B. Method B has completed normally, but the exception from method A is still listed as pending? I can't see how that would come about as we must (temporarily) clear the pending exception to do the upcall else the upcall method would immediately throw that pending exception. But if we have cleared it then the upcall method's method-exit event shouldn't be able to see it. Similarly we must save/restore the JvmtiThreadState else we would be processing the normal exit as if it were an exception one. > > Or mabye I do get it. The actual pending exception (on the ThreadShadow) must be saved, cleared and later restored, else we can't execute the Java upcall. But because we have separate paths for normal and exceptional method-exit processing, maybe we don't have to save/restore the JvmtiThreadState exception fields? But in that case are those fields even useful? To be honest I can't see how the two fields interact: there is either no exception being thrown, or there is - so only one field needed. BTW, I forget to mention that the `state->is_exception_detected() && !state->is_exception_caught();` is just the same as `state->is_exception_detected()` Because exception state is enum an if it is `ES_DETECTED` then it can't be `ES_CAUGHT`. Am I understand correctly, that you propose to clear/restore `_exception_state` for any upcall since it is the separate execution path? In this case it should be done in every place where java is called from vm while exception is in detected state. It makes sense to keep this field consistent. I looked on the `_exception_state` in the `JvmtiThreadState` and is also used in the `notice_unwind_due_to_exception`. But it is unclear how it can be false in this method. Also, it is used in the `post_exception_throw` and it also unclear what is checked there. And seems it is not used in any other places. So, probably, this state is not useful if method exit/exception posting work without it. Or it is needed to find all places where it is should be saved/restored. It might includes methodExit events but there are other places that should be fixed. It is needed to change this line to assertion and see where it is hit. However, I think it could be done separately. It is too complicated for this fix. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26886#discussion_r2314718031 From iklam at openjdk.org Tue Sep 2 01:38:16 2025 From: iklam at openjdk.org (Ioi Lam) Date: Tue, 2 Sep 2025 01:38:16 GMT Subject: RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* Message-ID: By adding an `InstanceKlass* InstanceKlass::super()` method to shadow `Klass* Klass:super()`, this PR makes it possible to simplify the following code InstanceKlass* ik; InstanceKlass* s; s = InstanceKlass::cast(ik->super()); // before JDK-8366024 s = ik->java_super(); // after JDK-8366024 to s = k->super(); So you no longer need to do casting or need to understand what `java_super()` is. ------------- Commit messages: - 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* Changes: https://git.openjdk.org/jdk/pull/27037/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27037&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8366584 Stats: 91 lines in 28 files changed: 8 ins; 2 del; 81 mod Patch: https://git.openjdk.org/jdk/pull/27037.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27037/head:pull/27037 PR: https://git.openjdk.org/jdk/pull/27037 From dholmes at openjdk.org Tue Sep 2 03:57:53 2025 From: dholmes at openjdk.org (David Holmes) Date: Tue, 2 Sep 2025 03:57:53 GMT Subject: RFR: 8365937: post_method_exit might incorrectly set was_popped_by_exception and value in the middle of stack unwinding [v4] In-Reply-To: References: <2SqwKSSfcLR6krBk2CYQZ8Q5X2T1eK4gaM4D6Hte2WA=.f4e906aa-4ffe-4d50-ba59-0ef12fb2f790@github.com> <1n0gbxAE37Nf7SHwUFLwCr1fJ2W4EuPh88kxMyO8un0=.5e803b50-f08f-4887-8d4c-3eb37156a754@github.com> Message-ID: <3XY_bM2M8_J57W_owMK6TRa2bQWELfIpVd4KvCPGvcI=.348b3b15-6b59-41f6-a8ea-051eb8a5a0c0@github.com> On Tue, 2 Sep 2025 01:13:40 GMT, Leonid Mesnik wrote: >> Or mabye I do get it. The actual pending exception (on the ThreadShadow) must be saved, cleared and later restored, else we can't execute the Java upcall. But because we have separate paths for normal and exceptional method-exit processing, maybe we don't have to save/restore the JvmtiThreadState exception fields? But in that case are those fields even useful? To be honest I can't see how the two fields interact: there is either no exception being thrown, or there is - so only one field needed. > > BTW, I forget to mention that the > `state->is_exception_detected() && !state->is_exception_caught();` > is just the same as > `state->is_exception_detected()` > Because exception state is enum an if it is `ES_DETECTED` then it can't be `ES_CAUGHT`. > > Am I understand correctly, that you propose to clear/restore `_exception_state` for any upcall since it is the separate execution path? In this case it should be done in every place where java is called from vm while exception is in detected state. It makes sense to keep this field consistent. > > I looked on the `_exception_state` in the `JvmtiThreadState` and is also used in the `notice_unwind_due_to_exception`. But it is unclear how it can be false in this method. > Also, it is used in the `post_exception_throw` and it also unclear what is checked there. And seems it is not used in any other places. > > So, probably, this state is not useful if method exit/exception posting work without it. Or it is needed to find all places where it is should be saved/restored. It might includes methodExit events but there are other places that should be fixed. It is needed to change this line to assertion and see where it is hit. > However, I think it could be done separately. It is too complicated for this fix. I think this state, and its use, needs more examination, but yes that can be deferred to another issue. Thanks ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26886#discussion_r2314852578 From dholmes at openjdk.org Tue Sep 2 04:01:49 2025 From: dholmes at openjdk.org (David Holmes) Date: Tue, 2 Sep 2025 04:01:49 GMT Subject: RFR: 8366456: Allow AllocFailStrategy for RBTree [v2] In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 08:57:30 GMT, Johan Sj?len wrote: >> Right now the RBTree forces you to use the intrusive tree if you want fine-grained control of the out-of-memory strategy of the node allocations. We can change this to be a bit more flexible. >> >> One of the tests were incorrectly indented, so I fixed that. I also changed from `typedef` to `using`, turns out that `typedef` can give strange errors when the template instantiation is incorrect[0]. >> >> [0] For my particular gcc > > Johan Sj?len has updated the pull request incrementally with one additional commit since the last revision: > > Remove Please remember the 24 hour rule for integrations as well. Thanks ------------- PR Comment: https://git.openjdk.org/jdk/pull/27011#issuecomment-3243702148 From dholmes at openjdk.org Tue Sep 2 04:45:41 2025 From: dholmes at openjdk.org (David Holmes) Date: Tue, 2 Sep 2025 04:45:41 GMT Subject: RFR: 8366556: Sort share/runtime includes [v2] In-Reply-To: <2bvgNWeNmR_PeSKtYLaY0SG3Bf0wavjjnYRXwyczFsg=.d48df777-38b3-411d-ab05-d94e8479dd10@github.com> References: <2bvgNWeNmR_PeSKtYLaY0SG3Bf0wavjjnYRXwyczFsg=.d48df777-38b3-411d-ab05-d94e8479dd10@github.com> Message-ID: On Mon, 1 Sep 2025 13:26:37 GMT, Francesco Andreuzzi wrote: >> This PR sorts the includes in `hotspot/share/runtime` using `SortIncludes.java`, and removes some unnecessary ones. I'm also adding the directory to `TestIncludesAreSorted`. >> >> Passes tier1. > > Francesco Andreuzzi has updated the pull request incrementally with one additional commit since the last revision: > > nn Looks good. I don't agree with the way `SortIncludes` handles underscore, but that is a separate matter. Thanks ------------- Marked as reviewed by dholmes (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27034#pullrequestreview-3174852048 From dholmes at openjdk.org Tue Sep 2 05:39:49 2025 From: dholmes at openjdk.org (David Holmes) Date: Tue, 2 Sep 2025 05:39:49 GMT Subject: RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 01:31:59 GMT, Ioi Lam wrote: > By adding an `InstanceKlass* InstanceKlass::super()` method to shadow `Klass* Klass:super()`, this PR makes it possible to simplify the following code > > > InstanceKlass* ik; > InstanceKlass* s; > s = InstanceKlass::cast(ik->super()); // before JDK-8366024 > s = ik->java_super(); // after JDK-8366024 > > > to > > > s = k->super(); > > > So you no longer need to do casting or need to understand what `java_super()` is. Looks good! Great to see all those `java_super()` calls disappear. A couple of nits/comments. Thanks src/hotspot/share/memory/heapInspection.cpp line 405: > 403: bool print_subclasses) { > 404: // Set do_print for all superclasses of this class. > 405: InstanceKlass* super = InstanceKlass::cast(cie->klass())->super(); Pre-existing, but if this cast is safe then `KlassInfoEntry::_klass` should be declared `InstanceKlass`. Otherwise this cast is not safe! Separate RFE for that. src/hotspot/share/oops/instanceKlass.hpp line 921: > 919: } > 920: > 921: // This shadows Klass::super(). The _super of an InstanceKlass is Suggestion: // This overrides Klass::super(). The _super of an InstanceKlass is src/hotspot/share/oops/instanceKlass.hpp line 924: > 922: // always an InstanceKlass (or nullptr) > 923: InstanceKlass* super() const { > 924: return (Klass::super() == nullptr) ? nullptr : InstanceKlass::cast(Klass::super()); Is it better/simpler/cleaner to just do: return static_cast(Klass::super()); ? src/hotspot/share/oops/klassVtable.cpp line 1574: > 1572: Klass* super = _klass->super(); > 1573: if (super != nullptr) { > 1574: InstanceKlass* sk = InstanceKlass::cast(super); // why are we sure this is InstanceKlass?? I don't think it is guaranteed to be an IK. But AFAICS we don't actually need an IK here anyway, we should be able to use `super` directly. ------------- PR Review: https://git.openjdk.org/jdk/pull/27037#pullrequestreview-3174870461 PR Review Comment: https://git.openjdk.org/jdk/pull/27037#discussion_r2314910364 PR Review Comment: https://git.openjdk.org/jdk/pull/27037#discussion_r2314913536 PR Review Comment: https://git.openjdk.org/jdk/pull/27037#discussion_r2314912896 PR Review Comment: https://git.openjdk.org/jdk/pull/27037#discussion_r2314951109 From jsjolen at openjdk.org Tue Sep 2 06:42:43 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 06:42:43 GMT Subject: RFR: 8364735: [asan] heap-use-after-free error detected in defaultStream::writer during VM shutdown [v2] In-Reply-To: References: <3TJnBvDoAPUf4p2e8Y0vpckfm3v8e31cKKwfOeyRnnM=.34c016f4-419d-4dd6-9102-b112a7423f7b@github.com> Message-ID: On Fri, 29 Aug 2025 01:02:43 GMT, David Holmes wrote: >> `ostream_exit` was deleting the stream underlying the `xtty` prior to nulling the `xtty` global variable, resulting in a use-after-free-error. Due to races during VM shutdown we cannot make use of `xtty` perfectly safe, but we can certainly narrow the window during which use-after-free is possible. >> >> Testing: >> - tiers 1-3 sanity >> >> Thanks > > David Holmes has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision: > > - Merge branch 'master' into 8364735-xtty > - 8364735: [asan] heap-use-after-free error detected in defaultStream::writer during VM shutdown After considering all of the discussions above and David's subsequent investigation, I think it seems reasonable to accept David's fix. Perhaps a refactoring is due, but that can be in a future PR. ------------- Marked as reviewed by jsjolen (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26832#pullrequestreview-3175082255 From jsjolen at openjdk.org Tue Sep 2 07:03:27 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 07:03:27 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v3] In-Reply-To: References: Message-ID: > Hi, > > The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. Johan Sj?len has updated the pull request incrementally with one additional commit since the last revision: Add misisng locks ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27003/files - new: https://git.openjdk.org/jdk/pull/27003/files/a125e582..800eca26 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=01-02 Stats: 31 lines in 3 files changed: 16 ins; 0 del; 15 mod Patch: https://git.openjdk.org/jdk/pull/27003.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27003/head:pull/27003 PR: https://git.openjdk.org/jdk/pull/27003 From jsjolen at openjdk.org Tue Sep 2 07:07:41 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 07:07:41 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v3] In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 07:03:27 GMT, Johan Sj?len wrote: >> Hi, >> >> The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. > > Johan Sj?len has refreshed the contents of this pull request, and previous commits have been removed. Incremental views are not available. Oops, I accidentally committed to my current branch, I meant to commit to a new one. I'm going to rewrite history a bit, sorry bot. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27003#issuecomment-3244054097 From dholmes at openjdk.org Tue Sep 2 07:10:43 2025 From: dholmes at openjdk.org (David Holmes) Date: Tue, 2 Sep 2025 07:10:43 GMT Subject: RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* In-Reply-To: References: Message-ID: <-jsZbxQ5S-quQBlUaeX5L_uu9f1oZGprF3COQgXUlwg=.4e173397-8a0f-43c5-980c-4f78fee8e59c@github.com> On Tue, 2 Sep 2025 04:59:37 GMT, David Holmes wrote: >> By adding an `InstanceKlass* InstanceKlass::super()` method to shadow `Klass* Klass:super()`, this PR makes it possible to simplify the following code >> >> >> InstanceKlass* ik; >> InstanceKlass* s; >> s = InstanceKlass::cast(ik->super()); // before JDK-8366024 >> s = ik->java_super(); // after JDK-8366024 >> >> >> to >> >> >> s = k->super(); >> >> >> So you no longer need to do casting or need to understand what `java_super()` is. > > src/hotspot/share/oops/instanceKlass.hpp line 921: > >> 919: } >> 920: >> 921: // This shadows Klass::super(). The _super of an InstanceKlass is > > Suggestion: > > // This overrides Klass::super(). The _super of an InstanceKlass is Correction: this is not "overriding" as defined by C++. "shadow" is fine. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27037#discussion_r2315125979 From lkorinth at openjdk.org Tue Sep 2 07:29:57 2025 From: lkorinth at openjdk.org (Leo Korinth) Date: Tue, 2 Sep 2025 07:29:57 GMT Subject: Integrated: 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 In-Reply-To: References: Message-ID: On Tue, 12 Aug 2025 17:01:41 GMT, Leo Korinth wrote: > This changes the timeout factor from 4 to 1. Most of the changes add timeouts to individual test cases so that I am able to run them with a timeout factor of 0.7 (some margin to the checked in factor of one) > > In addition to changing the timeout factor, I am also using a library call to parse the timeout factor from the Java properties (I cannot use the library function everywhere as jtreg does not allow me to add @library notations to non test case files). > > My approach has been to run all tests, and afterwards updating those that fail due to the timeout factor. The amount of updated test cases is huge, and my strategy has been to quadruple the timeout if I could not directly see that less was needed. In a few places, I have added a bit more timeout so that it will work with the 0.7 timeout factor. > > These fixes have been created when I have ploughed through test cases: > JDK-8352719: Add an equals sign to the modules statement > JDK-8352709: Remove bad timing annotations from WhileOpTest.java > JDK-8352074: Test MemoryLeak.java seems not to test what it is supposed to test > CODETOOLS-7903937: JTREG uses timeout factor on socket timeout but not on KEEPALIVE > CODETOOLS-7903961: Make default timeout configurable > > After the review, I will update the copyrights. > > I have run testing tier1-8. The last time with a timeout factor of 1 instead of 0.7. > > I got 4 timing related faults: > 1) runtime/Thread/TestThreadDumpMonitorContention.java > This is probably: https://bugs.openjdk.org/browse/JDK-8361370 > 2) sun/tools/jhsdb/BasicLauncherTest.java > I am unsure about this one, it has not failed on my runs before, even with a timeout factor of 0.7, maybe I was unlucky. > 3) gc/stress/TestReclaimStringsLeaksMemory.java > I updated this to 480 seconds, I finish this fairly fast (~14s) on my not very fast computer, but the Macs that fail are old x86-based ones. > 4) sun/security/ssl/X509KeyManager/CertChecking.java > This is a new test that I got on last rebase. I have added a timeout of 480 to it. > > In addition to these four tests, I have another one "java/lang/ThreadLocal/MemoryLeak.java" that earlier failed with a timeout factor of 0.7 but did not fail in the last run. I will *not* update that test case, because the extra time spent is strange and should be looked at. I have created JDK-8352074 on that test case, and I will probably create another bug describing the timeout I got. > > From the review of the cancelled "8356171: Increase timeout for test cases as preparation for change of... This pull request has now been integrated. Changeset: 55e7af05 Author: Leo Korinth URL: https://git.openjdk.org/jdk/commit/55e7af0560335ef69af072cee60956cf8e6d00a1 Stats: 901 lines in 342 files changed: 51 ins; 91 del; 759 mod 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 Reviewed-by: alanb, sspitsyn, lmesnik, ihse ------------- PR: https://git.openjdk.org/jdk/pull/26749 From duke at openjdk.org Tue Sep 2 07:55:45 2025 From: duke at openjdk.org (Francesco Andreuzzi) Date: Tue, 2 Sep 2025 07:55:45 GMT Subject: RFR: 8366556: Sort share/runtime includes [v2] In-Reply-To: References: <2bvgNWeNmR_PeSKtYLaY0SG3Bf0wavjjnYRXwyczFsg=.d48df777-38b3-411d-ab05-d94e8479dd10@github.com> Message-ID: On Tue, 2 Sep 2025 04:42:54 GMT, David Holmes wrote: > I don't agree with the way SortIncludes handles underscore, but that is a separate matter. @dholmes-ora should this be discussed somewhere? ------------- PR Comment: https://git.openjdk.org/jdk/pull/27034#issuecomment-3244204874 From duke at openjdk.org Tue Sep 2 07:55:46 2025 From: duke at openjdk.org (duke) Date: Tue, 2 Sep 2025 07:55:46 GMT Subject: RFR: 8366556: Sort share/runtime includes [v2] In-Reply-To: <2bvgNWeNmR_PeSKtYLaY0SG3Bf0wavjjnYRXwyczFsg=.d48df777-38b3-411d-ab05-d94e8479dd10@github.com> References: <2bvgNWeNmR_PeSKtYLaY0SG3Bf0wavjjnYRXwyczFsg=.d48df777-38b3-411d-ab05-d94e8479dd10@github.com> Message-ID: On Mon, 1 Sep 2025 13:26:37 GMT, Francesco Andreuzzi wrote: >> This PR sorts the includes in `hotspot/share/runtime` using `SortIncludes.java`, and removes some unnecessary ones. I'm also adding the directory to `TestIncludesAreSorted`. >> >> Passes tier1. > > Francesco Andreuzzi has updated the pull request incrementally with one additional commit since the last revision: > > nn @fandreuz Your change (at version 279fb9460609892c693280e0f7b5808da697343c) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27034#issuecomment-3244206317 From dholmes at openjdk.org Tue Sep 2 07:57:47 2025 From: dholmes at openjdk.org (David Holmes) Date: Tue, 2 Sep 2025 07:57:47 GMT Subject: RFR: 8364735: [asan] heap-use-after-free error detected in defaultStream::writer during VM shutdown [v2] In-Reply-To: References: <3TJnBvDoAPUf4p2e8Y0vpckfm3v8e31cKKwfOeyRnnM=.34c016f4-419d-4dd6-9102-b112a7423f7b@github.com> Message-ID: On Tue, 2 Sep 2025 06:39:48 GMT, Johan Sj?len wrote: >> David Holmes has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision: >> >> - Merge branch 'master' into 8364735-xtty >> - 8364735: [asan] heap-use-after-free error detected in defaultStream::writer during VM shutdown > > After considering all of the discussions above and David's subsequent investigation, I think it seems reasonable to accept David's fix. Perhaps a refactoring is due, but that can be in a future PR. Thanks for the Review @jdksjolen ! ------------- PR Comment: https://git.openjdk.org/jdk/pull/26832#issuecomment-3244213009 From duke at openjdk.org Tue Sep 2 07:59:52 2025 From: duke at openjdk.org (Francesco Andreuzzi) Date: Tue, 2 Sep 2025 07:59:52 GMT Subject: Integrated: 8366556: Sort share/runtime includes In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 12:49:20 GMT, Francesco Andreuzzi wrote: > This PR sorts the includes in `hotspot/share/runtime` using `SortIncludes.java`, and removes some unnecessary ones. I'm also adding the directory to `TestIncludesAreSorted`. > > Passes tier1. This pull request has now been integrated. Changeset: d19eab4f Author: Francesco Andreuzzi Committer: Albert Mingkun Yang URL: https://git.openjdk.org/jdk/commit/d19eab4f08592140229de43689c7d20ff7fbf4ee Stats: 97 lines in 39 files changed: 44 ins; 52 del; 1 mod 8366556: Sort share/runtime includes Reviewed-by: dholmes, ayang ------------- PR: https://git.openjdk.org/jdk/pull/27034 From dholmes at openjdk.org Tue Sep 2 08:06:53 2025 From: dholmes at openjdk.org (David Holmes) Date: Tue, 2 Sep 2025 08:06:53 GMT Subject: RFR: 8366556: Sort share/runtime includes [v2] In-Reply-To: References: <2bvgNWeNmR_PeSKtYLaY0SG3Bf0wavjjnYRXwyczFsg=.d48df777-38b3-411d-ab05-d94e8479dd10@github.com> Message-ID: On Tue, 2 Sep 2025 07:52:42 GMT, Francesco Andreuzzi wrote: > > I don't agree with the way SortIncludes handles underscore, but that is a separate matter. > > @dholmes-ora should this be discussed somewhere? It's okay we had an internal discussion and revisited the history. Thanks ------------- PR Comment: https://git.openjdk.org/jdk/pull/27034#issuecomment-3244238501 From azafari at openjdk.org Tue Sep 2 09:02:43 2025 From: azafari at openjdk.org (Afshin Zafari) Date: Tue, 2 Sep 2025 09:02:43 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v2] In-Reply-To: <_elWT9cp-yBL5OiRriEiVRTq5JPu09BY6jxtjMw4GJI=.1df62cde-de1f-4703-9112-54d282a20a37@github.com> References: <_elWT9cp-yBL5OiRriEiVRTq5JPu09BY6jxtjMw4GJI=.1df62cde-de1f-4703-9112-54d282a20a37@github.com> Message-ID: <3gCtC-iqis4JAN5y07b-N3K7uHyvHfQD_xsZSDd5Hmc=.c6401659-f561-448d-8bfe-d67dd74ccaa4@github.com> On Mon, 1 Sep 2025 13:22:03 GMT, Johan Sj?len wrote: >> Hi, >> >> The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. > > Johan Sj?len has updated the pull request incrementally with one additional commit since the last revision: > > Static assert copy-constructible Thank you @jdksjolen for taking this issue. I have only one concern when we copy a RBTree to a new one. We do a `visit_in_order` on the source tree and `upsert` the key-value to the destination tree. We do a sorted access on both trees. We can avoid one, by a new function like: `visit_all()` for the source tree, or for the destination tree use the `hint_node` somehow (that I don't know how, ping @caspernorrbin) in `RBTree::upsert(K, V, Node* hint_node)` ------------- PR Review: https://git.openjdk.org/jdk/pull/27003#pullrequestreview-3175564256 From azafari at openjdk.org Tue Sep 2 09:11:49 2025 From: azafari at openjdk.org (Afshin Zafari) Date: Tue, 2 Sep 2025 09:11:49 GMT Subject: RFR: 8365163: [ubsan] left-shift issue in globalDefinitions.hpp [v6] In-Reply-To: References: <0YDgbtjVs6gVs9Qt79hGrtcdgF5XNEOWzQdejP-s4sQ=.bfaf422f-489f-414c-8ad3-a3d0eb35af4c@github.com> Message-ID: On Wed, 27 Aug 2025 13:57:01 GMT, Kim Barrett wrote: >> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision: >> >> used CONST64 for all 64-bits const terms. > > Looks good. Thank you @kimbarrett, @theRealAph and @stefank for your reviews and comments. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26809#issuecomment-3244465409 From azafari at openjdk.org Tue Sep 2 09:11:50 2025 From: azafari at openjdk.org (Afshin Zafari) Date: Tue, 2 Sep 2025 09:11:50 GMT Subject: Integrated: 8365163: [ubsan] left-shift issue in globalDefinitions.hpp In-Reply-To: <0YDgbtjVs6gVs9Qt79hGrtcdgF5XNEOWzQdejP-s4sQ=.bfaf422f-489f-414c-8ad3-a3d0eb35af4c@github.com> References: <0YDgbtjVs6gVs9Qt79hGrtcdgF5XNEOWzQdejP-s4sQ=.bfaf422f-489f-414c-8ad3-a3d0eb35af4c@github.com> Message-ID: On Sun, 17 Aug 2025 06:49:47 GMT, Afshin Zafari wrote: > There was a left-shift of negative value UB in `set_high` function where the high value sign bit is on and is left-shifted 32 bits to put it in high word of the destination address. > To address it, first the left 32 bits of the provided `high` arg is cleared and then left-shifted 32 bits. > > Tests: > mach5 tiers 1-5 {macosx-aarch64, linux-x64, windows-x64} x {debug, product} This pull request has now been integrated. Changeset: ef7872cc Author: Afshin Zafari URL: https://git.openjdk.org/jdk/commit/ef7872cc31d4d7c0a9f311eafc28132ead3476b6 Stats: 39 lines in 2 files changed: 27 ins; 8 del; 4 mod 8365163: [ubsan] left-shift issue in globalDefinitions.hpp Reviewed-by: kbarrett, stefank, aph ------------- PR: https://git.openjdk.org/jdk/pull/26809 From jpai at openjdk.org Tue Sep 2 09:36:46 2025 From: jpai at openjdk.org (Jaikiran Pai) Date: Tue, 2 Sep 2025 09:36:46 GMT Subject: RFR: 8277444: Data race between JvmtiClassFileReconstituter::copy_bytecodes and class linking [v4] In-Reply-To: References: Message-ID: On Fri, 29 Aug 2025 22:48:06 GMT, Evgeny Astigeevich wrote: >> There is a race between `JvmtiClassFileReconstituter::copy_bytecodes` and `InstanceKlass::link_class_impl`. `InstanceKlass::link_class_impl` can be rewriting bytecodes. `JvmtiClassFileReconstituter::copy_bytecodes` will not restore them to the original ones because the flag `rewritten` is `false`. This will result in invalid bytecode. >> >> This PR adds linking a class before the `copy_bytecodes` method is called. >> The PR also adds a regression test. >> >> Tested fastdebug and release builds: Linux x86_64 and arm64 >> - The reproducer from JDK-8277444 passed. >> - The regression test passed. >> - Tier1 - tier3 passed. > > Evgeny Astigeevich has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision: > > - Merge branch 'master' into JDK-8277444 > - Link classes before copy_bytecodes; Add regression test > - Symplify comments; Get JavaThread::current in variable > - Add missing include runtime/synchronizer.hpp > - 8277444: Race condition on Instrumentation.retransformClasses() and class linking > The virtual thread test that is failing in this PR's GitHub actions job is `java/lang/Thread/virtual/stress/GetStackTraceALotWhenBlocking#id0` > It looks like it's taking long to complete and that's causing the test timeout. I recollect that this test failure was addressed some time back, so this appears to be a new occurrence. In any case, this failure doesn't look related to the changes in this PR because I see some other PRs having failed with this same issue. I'll check and file an issue later today/tomorrow (unless anyone else gets to it first). I've filed https://bugs.openjdk.org/browse/JDK-8366669 to track this failure. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26863#issuecomment-3244555487 From krk at openjdk.org Tue Sep 2 09:39:44 2025 From: krk at openjdk.org (Kerem Kat) Date: Tue, 2 Sep 2025 09:39:44 GMT Subject: RFR: 8366154: Validate thread type requirements in debug commands In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 21:58:02 GMT, David Holmes wrote: >> Prevents segmentation faults during `gdb` sessions. The crashes were caused by the `ResourceMark` constructor being called on a native thread, which is not supported. This happened when invoking debug commands that require a `Thread` or `JavaThread` context from an incorrect thread type. >> >> ### Solution >> >> This change introduces `onThread()` and `onJavaThread()` helper methods to the `Command` class. These methods validate the thread context and ensure `ResourceMark` is only created when on a valid VM thread. All thread-dependent debug commands now use these guards to validate the context, printing a clear error and exiting gracefully upon failure. >> >> ### Testing >> >> Manually verified using `gdb` by calling the modified commands (`ps`, `universe`, `pns`, etc.) from different thread contexts (native, Java, and non-java threads) to ensure they fail gracefully with an error message instead of crashing the debug session. > > src/hotspot/share/utilities/debug.cpp line 326: > >> 324: } >> 325: >> 326: if (!_has_rm) { > > Is it even possible for this not to be false with correct usage? No, `onThread` would have to be called at least twice. > src/hotspot/share/utilities/debug.cpp line 327: > >> 325: >> 326: if (!_has_rm) { >> 327: ::new (&_rm) ResourceMark(); > > There should be `#include ` to use global placement-new. added, thanks. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27033#discussion_r2315520918 PR Review Comment: https://git.openjdk.org/jdk/pull/27033#discussion_r2315521505 From cnorrbin at openjdk.org Tue Sep 2 09:39:44 2025 From: cnorrbin at openjdk.org (Casper Norrbin) Date: Tue, 2 Sep 2025 09:39:44 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v2] In-Reply-To: <3gCtC-iqis4JAN5y07b-N3K7uHyvHfQD_xsZSDd5Hmc=.c6401659-f561-448d-8bfe-d67dd74ccaa4@github.com> References: <_elWT9cp-yBL5OiRriEiVRTq5JPu09BY6jxtjMw4GJI=.1df62cde-de1f-4703-9112-54d282a20a37@github.com> <3gCtC-iqis4JAN5y07b-N3K7uHyvHfQD_xsZSDd5Hmc=.c6401659-f561-448d-8bfe-d67dd74ccaa4@github.com> Message-ID: <870gPQnYOOc-Fy7DO7kUvAHoHqV3GjAfscrTIWczk_w=.706d8fb6-a4fb-418f-8f00-dbae474b36fa@github.com> On Tue, 2 Sep 2025 09:00:19 GMT, Afshin Zafari wrote: > We can avoid one, by a new function like: `visit_all()` for the source tree, or for the destination tree use the `hint_node` somehow (that I don't know how, ping @caspernorrbin) in `RBTree::upsert(K, V, Node* hint_node)` I don't think we would see much improvement iterating differently on the source tree. However, for the destination tree we traverse down the tree for each upsert, which could have quite an impact on large trees. `hint_node` decides where to start searching from, so if we cache the previous node we can avoid this traversal and start directly at the insert point. To achieve this we could change the return type of `upsert` from `void` to `RBNode*`, which is easily done and change the copy-constructor to something like: ```c++ RBTree(const RBTree& other) : BaseType(), _allocator() { static_assert(std::is_copy_constructible::value, "Key type must be copy-constructible when copying a RBTree"); static_assert(std::is_copy_constructible::value, "Value type must be copy-constructible when copying a RBTree"); RBNode* prev_node = nullptr; other.visit_in_order([&](RBNode* node) { RBNode* new_node = this->upsert(node->key(), node->val(), prev_node); prev_node = new_node; return true; }); } ------------- PR Comment: https://git.openjdk.org/jdk/pull/27003#issuecomment-3244565428 From jsjolen at openjdk.org Tue Sep 2 09:44:42 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 09:44:42 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v2] In-Reply-To: <870gPQnYOOc-Fy7DO7kUvAHoHqV3GjAfscrTIWczk_w=.706d8fb6-a4fb-418f-8f00-dbae474b36fa@github.com> References: <_elWT9cp-yBL5OiRriEiVRTq5JPu09BY6jxtjMw4GJI=.1df62cde-de1f-4703-9112-54d282a20a37@github.com> <3gCtC-iqis4JAN5y07b-N3K7uHyvHfQD_xsZSDd5Hmc=.c6401659-f561-448d-8bfe-d67dd74ccaa4@github.com> <870gPQnYOOc-Fy7DO7kUvAHoHqV3GjAfscrTIWczk_w=.706d8fb6-a4fb-418f-8f00-dbae474b36fa@github.com> Message-ID: On Tue, 2 Sep 2025 09:37:02 GMT, Casper Norrbin wrote: > > We can avoid one, by a new function like: `visit_all()` for the source tree, or for the destination tree use the `hint_node` somehow (that I don't know how, ping @caspernorrbin) in `RBTree::upsert(K, V, Node* hint_node)` > > I don't think we would see much improvement iterating differently on the source tree. However, for the destination tree we traverse down the tree for each upsert, which could have quite an impact on large trees. `hint_node` decides where to start searching from, so if we cache the previous node we can avoid this traversal and start directly at the insert point. > > To achieve this we could change the return type of `upsert` from `void` to `RBNode*`, which is easily done and change the copy-constructor to something like: > > ```c++ > RBTree(const RBTree& other) : BaseType(), _allocator() { > static_assert(std::is_copy_constructible::value, "Key type must be copy-constructible when copying a RBTree"); > static_assert(std::is_copy_constructible::value, "Value type must be copy-constructible when copying a RBTree"); > RBNode* prev_node = nullptr; > other.visit_in_order([&](RBNode* node) { > RBNode* new_node = this->upsert(node->key(), node->val(), prev_node); > prev_node = new_node; > return true; > }); > } > ``` I think we need to switch out the iterator for that to make sense, specifically it needs to be DFS. Anyway, let's do that. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27003#issuecomment-3244581331 From krk at openjdk.org Tue Sep 2 09:47:42 2025 From: krk at openjdk.org (Kerem Kat) Date: Tue, 2 Sep 2025 09:47:42 GMT Subject: RFR: 8366154: Validate thread type requirements in debug commands In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 21:54:13 GMT, David Holmes wrote: >> Prevents segmentation faults during `gdb` sessions. The crashes were caused by the `ResourceMark` constructor being called on a native thread, which is not supported. This happened when invoking debug commands that require a `Thread` or `JavaThread` context from an incorrect thread type. >> >> ### Solution >> >> This change introduces `onThread()` and `onJavaThread()` helper methods to the `Command` class. These methods validate the thread context and ensure `ResourceMark` is only created when on a valid VM thread. All thread-dependent debug commands now use these guards to validate the context, printing a clear error and exiting gracefully upon failure. >> >> ### Testing >> >> Manually verified using `gdb` by calling the modified commands (`ps`, `universe`, `pns`, etc.) from different thread contexts (native, Java, and non-java threads) to ensure they fail gracefully with an error message instead of crashing the debug session. > > src/hotspot/share/utilities/debug.cpp line 341: > >> 339: } >> 340: return true; >> 341: } > > I don't think we need this. The commands that require a JavaThread should be checking that directly themselves. Typically we assume/expect the person debugging to know what they are dealing with and use the appropriate commands. I will remove this function and do the check in the 3 call sites of it. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27033#discussion_r2315539345 From azafari at openjdk.org Tue Sep 2 09:56:45 2025 From: azafari at openjdk.org (Afshin Zafari) Date: Tue, 2 Sep 2025 09:56:45 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v3] In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 07:03:27 GMT, Johan Sj?len wrote: >> Hi, >> >> The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. > > Johan Sj?len has refreshed the contents of this pull request, and previous commits have been removed. Incremental views are not available. When we do a `visit_in_order` we can set `next(right node)` of new nodes one by one. IOW, since Key-Values are retrieved in order, we can insert them one after another. Right? Inspired by the `visit_in_order()` itself: there we first get `leftmost()` and then use `next()` in a loop. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27003#issuecomment-3244624236 From krk at openjdk.org Tue Sep 2 10:08:58 2025 From: krk at openjdk.org (Kerem Kat) Date: Tue, 2 Sep 2025 10:08:58 GMT Subject: RFR: 8366154: Validate thread type requirements in debug commands [v2] In-Reply-To: References: Message-ID: > Prevents segmentation faults during `gdb` sessions. The crashes were caused by the `ResourceMark` constructor being called on a native thread, which is not supported. This happened when invoking debug commands that require a `Thread` or `JavaThread` context from an incorrect thread type. > > ### Solution > > This change introduces `onThread()` and `onJavaThread()` helper methods to the `Command` class. These methods validate the thread context and ensure `ResourceMark` is only created when on a valid VM thread. All thread-dependent debug commands now use these guards to validate the context, printing a clear error and exiting gracefully upon failure. > > ### Testing > > Manually verified using `gdb` by calling the modified commands (`ps`, `universe`, `pns`, etc.) from different thread contexts (native, Java, and non-java threads) to ensure they fail gracefully with an error message instead of crashing the debug session. Kerem Kat has updated the pull request incrementally with two additional commits since the last revision: - add include for global placement new - remove onJavaThread and check JavaThread::active null where needed ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27033/files - new: https://git.openjdk.org/jdk/pull/27033/files/74d1e08b..0d3ded95 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27033&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27033&range=00-01 Stats: 30 lines in 1 file changed: 15 ins; 13 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/27033.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27033/head:pull/27033 PR: https://git.openjdk.org/jdk/pull/27033 From adinn at openjdk.org Tue Sep 2 11:06:46 2025 From: adinn at openjdk.org (Andrew Dinn) Date: Tue, 2 Sep 2025 11:06:46 GMT Subject: RFR: 8328306: AArch64: MacOS lazy JIT "write xor execute" switching [v4] In-Reply-To: References: <3IdZZGAKHVuMXfeM10Z-VSDNlJmcu5XFilLQfEKb9OY=.5213f5ca-2bca-41eb-b7ce-7621510552be@github.com> Message-ID: On Thu, 21 Aug 2025 00:27:48 GMT, David Holmes wrote: >>> I'm not sure I'm really understanding the rules here. Is it the case that the old code would switch between write and exec in a more block structured pattern - changing when needed >> >> The old code doesn't change when needed but at every VM transition whether needed or not. But only 1% of VM transitions need to change. >> >>> and then restoring. But the new approach only changes when needed and never restores? >> >> More or less, yes. (Although obviously we have to reset the mode when returning from VM mode.) >> >>> If so then I worry that the need to change mode at any given point is a function of the code path to that point, rather than being an obvious property of the code itself. >> >> We change mode when we're _all but certain_ that we need to. That seems right to me. If the mode doesn't need changing because it's already set, that's OK. Why do you think this might be a problem? >> >>> The "healing" allows this to work, >> >> To be clear: healing never happens in testing. >> >>> but I'm not sure how you would ever explain the placement rules to anyone. ?? For example, I find the placement within the `Assembler` constructor extremely obscure but presumably the code that creates the `Assembler` instance then proceeds to use that instance to write into the code cache? >> >> Yes, exactly. We create Assembler instances whenever we need to generate code, and we don't share those instances, so the constructor is sweet spot to change mode. We don't keep Assembler instances hanging around. We could argue that this is temporal coupling, a code smell, but WX mode is a temporal property, so to a large extent that can't be helped.. > >> We change mode when we're _all but certain_ that we need to. That seems right to me. If the mode doesn't need changing because it's already set, that's OK. Why do you think this might be a problem? > > My concern is that if we have code that needs a specific mode, but it is not obvious at that piece of code that this is the case, then things will work fine if somewhere on the path to that code we set the right mode. But if we introduce a new path to that code that might not be the case and so we will introduce a new place where we switch modes. That can lead to redundancy. The whole thing (as it has from day one) seems ad-hoc. > > But if the proposed scheme performs better in general, and is not obviously "worse" from the ad-hoc perspective then ... @dholmes-ora I accept that this approach is not fully robust in the face of changes to the code base. However, in mitigation of that risk, the approach of targeting the major gateway calls that precede most subsequent code updates (e.g. creating an assembler instance) means that only a relatively small number of code paths which bypass those known gateways currently are, or will ever be, susceptible to such failure. Furthermore, weighed against that risk are 1) a mechanism we can use both to catch failures during testing and to avoid any danger when something escapes into production and 2) a significant gain in performance from avoiding (literally) millions of unnecessary transitions. I don't normally support pushing changes which are inherently fragile in the face of code updates. However, in this case I think the mechanisms in place to mitigate the risk and limit any damage and the performance gains to be had make it worth adopting. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26562#issuecomment-3244849530 From fbredberg at openjdk.org Tue Sep 2 11:07:00 2025 From: fbredberg at openjdk.org (Fredrik Bredberg) Date: Tue, 2 Sep 2025 11:07:00 GMT Subject: RFR: 8365190: Remove LockingMode related code from share Message-ID: <4pmrLv9G-kotkKQ_B1wEyXSAJ9Vm3cnxditElz641_E=.23c81f11-ece2-4894-ae2f-8763ad343a4d@github.com> Since the integration of [JDK-8359437](https://bugs.openjdk.org/browse/JDK-8359437) the `LockingMode` flag can no longer be set by the user. After that, a number of PRs has been integrated which has removed all `LockingMode` related code from all platforms (except from zero, which is done in this PR). This PR removes `LockingMode` related code from the shared (non-platform specific) files. It also removes the `LockingMode` variable itself. Passes tier1-tier5 with no added problems. ------------- Commit messages: - 8365190: Remove LockingMode related code from share Changes: https://git.openjdk.org/jdk/pull/27041/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27041&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8365190 Stats: 1268 lines in 50 files changed: 6 ins; 1129 del; 133 mod Patch: https://git.openjdk.org/jdk/pull/27041.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27041/head:pull/27041 PR: https://git.openjdk.org/jdk/pull/27041 From jsjolen at openjdk.org Tue Sep 2 11:13:45 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 11:13:45 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v4] In-Reply-To: References: Message-ID: <4bty3Tqy3pgig2fRDijwX1frSvNQxXbYNgxQ6GVWQWE=.2df02b1e-022f-4e43-a9e4-8e1b7bd57d1b@github.com> > Hi, > > The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. Johan Sj?len has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision: Rewrite copying entirely ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27003/files - new: https://git.openjdk.org/jdk/pull/27003/files/800eca26..2e7bd8c9 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=02-03 Stats: 80 lines in 5 files changed: 40 ins; 18 del; 22 mod Patch: https://git.openjdk.org/jdk/pull/27003.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27003/head:pull/27003 PR: https://git.openjdk.org/jdk/pull/27003 From jsjolen at openjdk.org Tue Sep 2 11:23:01 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 11:23:01 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v5] In-Reply-To: References: Message-ID: > Hi, > > The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. Johan Sj?len has updated the pull request incrementally with two additional commits since the last revision: - Fix - Fix the NodeType* ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27003/files - new: https://git.openjdk.org/jdk/pull/27003/files/2e7bd8c9..69c65fe1 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=03-04 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/27003.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27003/head:pull/27003 PR: https://git.openjdk.org/jdk/pull/27003 From jsjolen at openjdk.org Tue Sep 2 11:28:03 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 11:28:03 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v6] In-Reply-To: References: Message-ID: > Hi, > > The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. Johan Sj?len has updated the pull request incrementally with one additional commit since the last revision: It's const ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27003/files - new: https://git.openjdk.org/jdk/pull/27003/files/69c65fe1..7deb9a1b Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=04-05 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/27003.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27003/head:pull/27003 PR: https://git.openjdk.org/jdk/pull/27003 From jsjolen at openjdk.org Tue Sep 2 11:33:21 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 11:33:21 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v7] In-Reply-To: References: Message-ID: > Hi, > > The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. Johan Sj?len has updated the pull request incrementally with one additional commit since the last revision: Rename ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27003/files - new: https://git.openjdk.org/jdk/pull/27003/files/7deb9a1b..7c3f1a41 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=06 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=05-06 Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/27003.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27003/head:pull/27003 PR: https://git.openjdk.org/jdk/pull/27003 From jsjolen at openjdk.org Tue Sep 2 11:44:01 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 11:44:01 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v8] In-Reply-To: References: Message-ID: > Hi, > > The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. Johan Sj?len has updated the pull request incrementally with two additional commits since the last revision: - Aha, missing include - Wait, the VMATree is wrong? ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27003/files - new: https://git.openjdk.org/jdk/pull/27003/files/7c3f1a41..1cceebf2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=07 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=06-07 Stats: 3 lines in 2 files changed: 3 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/27003.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27003/head:pull/27003 PR: https://git.openjdk.org/jdk/pull/27003 From coleenp at openjdk.org Tue Sep 2 11:49:44 2025 From: coleenp at openjdk.org (Coleen Phillimore) Date: Tue, 2 Sep 2025 11:49:44 GMT Subject: RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* In-Reply-To: References: Message-ID: <8XfA1QxtYcE7-4O3qTGtgktxCYg5HpvZtFWrRR0Rt4I=.7468c92f-edf9-4934-94b6-84a0db503781@github.com> On Tue, 2 Sep 2025 04:59:09 GMT, David Holmes wrote: >> By adding an `InstanceKlass* InstanceKlass::super()` method to shadow `Klass* Klass:super()`, this PR makes it possible to simplify the following code >> >> >> InstanceKlass* ik; >> InstanceKlass* s; >> s = InstanceKlass::cast(ik->super()); // before JDK-8366024 >> s = ik->java_super(); // after JDK-8366024 >> >> >> to >> >> >> s = k->super(); >> >> >> So you no longer need to do casting or need to understand what `java_super()` is. > > src/hotspot/share/oops/instanceKlass.hpp line 924: > >> 922: // always an InstanceKlass (or nullptr) >> 923: InstanceKlass* super() const { >> 924: return (Klass::super() == nullptr) ? nullptr : InstanceKlass::cast(Klass::super()); > > Is it better/simpler/cleaner to just do: > > return static_cast(Klass::super()); > > ? I think the term is "hides" not "shadows". InstanceKlass::cast() is better - one additional check that super is always another InstanceKlass. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27037#discussion_r2315826675 From coleenp at openjdk.org Tue Sep 2 11:49:45 2025 From: coleenp at openjdk.org (Coleen Phillimore) Date: Tue, 2 Sep 2025 11:49:45 GMT Subject: RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* In-Reply-To: <8XfA1QxtYcE7-4O3qTGtgktxCYg5HpvZtFWrRR0Rt4I=.7468c92f-edf9-4934-94b6-84a0db503781@github.com> References: <8XfA1QxtYcE7-4O3qTGtgktxCYg5HpvZtFWrRR0Rt4I=.7468c92f-edf9-4934-94b6-84a0db503781@github.com> Message-ID: On Tue, 2 Sep 2025 11:43:01 GMT, Coleen Phillimore wrote: >> src/hotspot/share/oops/instanceKlass.hpp line 924: >> >>> 922: // always an InstanceKlass (or nullptr) >>> 923: InstanceKlass* super() const { >>> 924: return (Klass::super() == nullptr) ? nullptr : InstanceKlass::cast(Klass::super()); >> >> Is it better/simpler/cleaner to just do: >> >> return static_cast(Klass::super()); >> >> ? > > I think the term is "hides" not "shadows". InstanceKlass::cast() is better - one additional check that super is always another InstanceKlass. Do we still need java_super ? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27037#discussion_r2315827420 From jsjolen at openjdk.org Tue Sep 2 11:54:19 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 11:54:19 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v9] In-Reply-To: References: Message-ID: > Hi, > > The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. Johan Sj?len has updated the pull request incrementally with three additional commits since the last revision: - Yup - Some more ugly casts - Aha, _root is typed as an IntrusiveRBNode ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27003/files - new: https://git.openjdk.org/jdk/pull/27003/files/1cceebf2..04b5a99b Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=08 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=07-08 Stats: 3 lines in 1 file changed: 1 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/27003.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27003/head:pull/27003 PR: https://git.openjdk.org/jdk/pull/27003 From jsjolen at openjdk.org Tue Sep 2 11:56:43 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 11:56:43 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v8] In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 11:44:01 GMT, Johan Sj?len wrote: >> Hi, >> >> The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. > > Johan Sj?len has updated the pull request incrementally with two additional commits since the last revision: > > - Aha, missing include > - Wait, the VMATree is wrong? Sorry about the ridiculous amount of commits. For each one I thought "this is the last one". I've created a temp branch that I'll push to so you don't have to see this WIP. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27003#issuecomment-3245001621 From coleenp at openjdk.org Tue Sep 2 12:09:46 2025 From: coleenp at openjdk.org (Coleen Phillimore) Date: Tue, 2 Sep 2025 12:09:46 GMT Subject: RFR: 8277444: Data race between JvmtiClassFileReconstituter::copy_bytecodes and class linking [v4] In-Reply-To: References: Message-ID: <1JIJRz2n7-MCQDwQhqWAMC5o1VQ0gYwLZ1jgkjQH8YU=.c06407bf-e13b-4e35-84f9-ab2f4154f754@github.com> On Fri, 29 Aug 2025 22:48:06 GMT, Evgeny Astigeevich wrote: >> There is a race between `JvmtiClassFileReconstituter::copy_bytecodes` and `InstanceKlass::link_class_impl`. `InstanceKlass::link_class_impl` can be rewriting bytecodes. `JvmtiClassFileReconstituter::copy_bytecodes` will not restore them to the original ones because the flag `rewritten` is `false`. This will result in invalid bytecode. >> >> This PR adds linking a class before the `copy_bytecodes` method is called. >> The PR also adds a regression test. >> >> Tested fastdebug and release builds: Linux x86_64 and arm64 >> - The reproducer from JDK-8277444 passed. >> - The regression test passed. >> - Tier1 - tier3 passed. > > Evgeny Astigeevich has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision: > > - Merge branch 'master' into JDK-8277444 > - Link classes before copy_bytecodes; Add regression test > - Symplify comments; Get JavaThread::current in variable > - Add missing include runtime/synchronizer.hpp > - 8277444: Race condition on Instrumentation.retransformClasses() and class linking I had a couple of minor comments but otherwise looks good. Is the test now reliable? Thank you for adding a test. src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp line 35: > 33: #include "runtime/handles.inline.hpp" > 34: #include "runtime/signature.hpp" > 35: #include "runtime/synchronizer.hpp" You don't need this include anymore. src/hotspot/share/prims/jvmtiEnv.cpp line 3446: > 3444: current_thread->clear_pending_exception(); > 3445: return JVMTI_ERROR_INVALID_CLASS; > 3446: } Can you use the pattern: JavaThread* THREAD = current_thread; ... link_class(THREAD); if (HAS_PENDING_EXCEPTION) etc. ------------- PR Review: https://git.openjdk.org/jdk/pull/26863#pullrequestreview-3176231981 PR Review Comment: https://git.openjdk.org/jdk/pull/26863#discussion_r2315873660 PR Review Comment: https://git.openjdk.org/jdk/pull/26863#discussion_r2315880585 From phubner at openjdk.org Tue Sep 2 13:08:50 2025 From: phubner at openjdk.org (Paul =?UTF-8?B?SMO8Ym5lcg==?=) Date: Tue, 2 Sep 2025 13:08:50 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v9] In-Reply-To: References: Message-ID: <1C3jv85vHI3m7JZV-XC8PCwUyvBVzwvbibuETkvGHBQ=.89d69791-8270-4164-82d4-44acee14aa67@github.com> On Tue, 2 Sep 2025 11:54:19 GMT, Johan Sj?len wrote: >> Hi, >> >> The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. > > Johan Sj?len has updated the pull request incrementally with three additional commits since the last revision: > > - Yup > - Some more ugly casts > - Aha, _root is typed as an IntrusiveRBNode src/hotspot/share/utilities/rbTree.hpp line 464: > 462: struct node_pair { const RBNode* current; RBNode* other_parent; Dir d; }; > 463: struct stack { > 464: node_pair s[64]; Could you clarify the choice of 64 as an upper bound? It's not immediately obvious to me if we guarantee (or if we don't care about) the maximum visitation size in the code below. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27003#discussion_r2316036406 From jsjolen at openjdk.org Tue Sep 2 13:18:44 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 13:18:44 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v9] In-Reply-To: <1C3jv85vHI3m7JZV-XC8PCwUyvBVzwvbibuETkvGHBQ=.89d69791-8270-4164-82d4-44acee14aa67@github.com> References: <1C3jv85vHI3m7JZV-XC8PCwUyvBVzwvbibuETkvGHBQ=.89d69791-8270-4164-82d4-44acee14aa67@github.com> Message-ID: <0QdMYssbmrxll76glB1s9PS55PFbkULHq-ezpr5b5B4=.2b8d7971-14d5-4cf4-bc5f-41a2aaa89d5d@github.com> On Tue, 2 Sep 2025 13:06:02 GMT, Paul H?bner wrote: >> Johan Sj?len has updated the pull request incrementally with three additional commits since the last revision: >> >> - Yup >> - Some more ugly casts >> - Aha, _root is typed as an IntrusiveRBNode > > src/hotspot/share/utilities/rbTree.hpp line 464: > >> 462: struct node_pair { const RBNode* current; RBNode* other_parent; Dir d; }; >> 463: struct stack { >> 464: node_pair s[64]; > > Could you clarify the choice of 64 as an upper bound? It's not immediately obvious to me if we guarantee (or if we don't care about) the maximum visitation size in the code below. It's an arbitrary depth (it's used in other parts of the RBTree code as well). The maximum length of the stack represents the maximum depth of the tree that we support. A perfectly balanced binary tree of depth 64 has 2**64 - 1 nodes, so in practice this will never be reached. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27003#discussion_r2316065902 From bmaillard at openjdk.org Tue Sep 2 13:30:38 2025 From: bmaillard at openjdk.org (=?UTF-8?B?QmVub8OudA==?= Maillard) Date: Tue, 2 Sep 2025 13:30:38 GMT Subject: RFR: 8360389: Support printing from C2 compiled code [v9] In-Reply-To: References: Message-ID: > This PR adds support for printf-style debugging from C2 compiled code. This is implemented as a runtime call to a C++ method that prints the values of the nodes passed as arguments. The runtime C++ method is implemented with the help of variadic templates, as it is expected to support various combinations of argument types. > > ## Usage > > Suppose we have this piece of Java code, that simply computes an arithmetic operation, and > that we compile `square` with C2. > > class Square { > static int square(int a) { > return a * a; > } > > public static void main(String[] args) { > square(9); > } > } > > > We would like to inspect the node that contains the value returned in this method. > We can add a call to `Compile::make_debug_print` and pass a message, the IGVN instance, as well as the node(s) that we would like to inspect. > > ```c++ > void Compile::return_values(JVMState* jvms) { > GraphKit kit(jvms); > Node* ret = new ReturnNode(TypeFunc::Parms, > kit.control(), > kit.i_o(), > kit.reset_memory(), > kit.frameptr(), > kit.returnadr()); > // Add zero or 1 return values > int ret_size = tf()->range()->cnt() - TypeFunc::Parms; > > > Node* return_value; > if (ret_size > 0) { > kit.inc_sp(-ret_size); // pop the return value(s) > kit.sync_jvms(); > return_value = kit.argument(0); > ret->add_req(return_value); > > // <-------------------- Simply insert this > C->make_debug_print("return: ", initial_gvn(), return_value); > } > > // bind it to root > root()->add_req(ret); > record_for_igvn(ret); > initial_gvn()->transform(ret); > } > > > We can then call run our code with `-XX:CompileCommand="compileonly,Square::square` > and we get the following output: > > > return: > int 81 > > > This case is of course trivial, but more useful examples are shown later. > > ## Implementation > > The debugging capability is implemented as a runtime call to a C++ printing method. For this, `Compile::make_debug_print` inserts a `CallLeafNode` into the graph and rewires control flow as needed. > > The actual printing is handled by the `SharedRuntime::debug_print` method, written with a variadic template to support various argument type combinations. A pointer to this runtime method is obtained at compile time and is passed to the `CallLeafNode` constructor. > > The first argument to the runtime printing method is the printing message, a static string encoded as a `... Beno?t Maillard has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 51 additional commits since the last revision: - Automatically insert placeholder nodes for jlong and jdouble - Merge branch 'master' into JDK-8360389 - Fix mismatch with #ifdef COMPILER2 between .hpp and .cpp - Avoid having root as control candidate to prevent issue when printing a constant - Fix missing candidates.size() == 0 case when constants are involved - Replace one more \n by print_cr - Add #ifdef COMPILER2 for runtime methods - Use print_cr instead of \n - Update src/hotspot/share/opto/compile.cpp Co-authored-by: Manuel H?ssig - Update src/hotspot/share/runtime/sharedRuntime.cpp Co-authored-by: Manuel H?ssig - ... and 41 more: https://git.openjdk.org/jdk/compare/fccb79ca...13da04e1 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26475/files - new: https://git.openjdk.org/jdk/pull/26475/files/233c89a0..13da04e1 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26475&range=08 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26475&range=07-08 Stats: 88672 lines in 2189 files changed: 55916 ins; 22598 del; 10158 mod Patch: https://git.openjdk.org/jdk/pull/26475.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26475/head:pull/26475 PR: https://git.openjdk.org/jdk/pull/26475 From jsjolen at openjdk.org Tue Sep 2 13:30:59 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 13:30:59 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v10] In-Reply-To: References: Message-ID: > Hi, > > The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. Johan Sj?len has updated the pull request incrementally with one additional commit since the last revision: After a lot of casting ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27003/files - new: https://git.openjdk.org/jdk/pull/27003/files/04b5a99b..76ec83f9 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=09 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=08-09 Stats: 55 lines in 2 files changed: 42 ins; 1 del; 12 mod Patch: https://git.openjdk.org/jdk/pull/27003.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27003/head:pull/27003 PR: https://git.openjdk.org/jdk/pull/27003 From bmaillard at openjdk.org Tue Sep 2 13:35:43 2025 From: bmaillard at openjdk.org (=?UTF-8?B?QmVub8OudA==?= Maillard) Date: Tue, 2 Sep 2025 13:35:43 GMT Subject: RFR: 8360389: Support printing from C2 compiled code [v8] In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 14:38:59 GMT, Emanuel Peter wrote: > Ah, I see! Could you verify that somehow in your function, to catch it early? Or is there any way we could drop the need for these place-holders? I have made modifications so that placeholder nodes are automatically inserted for `long` and `int` nodes @eme64. Thanks for the suggestion! > FYI: I have it working now, great! ? The sequence of different prints can be a little messed up, but that's probably due to the controls. Just an observation, but I'm fine with that. Yes, this is due to the controls. As suggested on slack, in the future it would be nice if the user could optionally provide a control to attach the call to instead of using the automatic procedure. This would probably help make it more predictable when needed. > Sadly: it seems that the printing scares the bug away I'm trying to reproduce. This will probably always be an inherent limitation unfortunately. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26475#issuecomment-3245371745 From ayang at openjdk.org Tue Sep 2 13:40:41 2025 From: ayang at openjdk.org (Albert Mingkun Yang) Date: Tue, 2 Sep 2025 13:40:41 GMT Subject: RFR: 8365190: Remove LockingMode related code from share In-Reply-To: <4pmrLv9G-kotkKQ_B1wEyXSAJ9Vm3cnxditElz641_E=.23c81f11-ece2-4894-ae2f-8763ad343a4d@github.com> References: <4pmrLv9G-kotkKQ_B1wEyXSAJ9Vm3cnxditElz641_E=.23c81f11-ece2-4894-ae2f-8763ad343a4d@github.com> Message-ID: On Tue, 2 Sep 2025 08:24:10 GMT, Fredrik Bredberg wrote: > Since the integration of [JDK-8359437](https://bugs.openjdk.org/browse/JDK-8359437) the `LockingMode` flag can no longer be set by the user. After that, a number of PRs has been integrated which has removed all `LockingMode` related code from all platforms (except from zero, which is done in this PR). > > This PR removes `LockingMode` related code from the shared (non-platform specific) files. It also removes the `LockingMode` variable itself. > > Passes tier1-tier5 with no added problems. Marked as reviewed by ayang (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/27041#pullrequestreview-3176613129 From rcastanedalo at openjdk.org Tue Sep 2 13:48:45 2025 From: rcastanedalo at openjdk.org (Roberto =?UTF-8?B?Q2FzdGHDsWVkYQ==?= Lozano) Date: Tue, 2 Sep 2025 13:48:45 GMT Subject: RFR: 8365190: Remove LockingMode related code from share In-Reply-To: <4pmrLv9G-kotkKQ_B1wEyXSAJ9Vm3cnxditElz641_E=.23c81f11-ece2-4894-ae2f-8763ad343a4d@github.com> References: <4pmrLv9G-kotkKQ_B1wEyXSAJ9Vm3cnxditElz641_E=.23c81f11-ece2-4894-ae2f-8763ad343a4d@github.com> Message-ID: On Tue, 2 Sep 2025 08:24:10 GMT, Fredrik Bredberg wrote: > Since the integration of [JDK-8359437](https://bugs.openjdk.org/browse/JDK-8359437) the `LockingMode` flag can no longer be set by the user. After that, a number of PRs has been integrated which has removed all `LockingMode` related code from all platforms (except from zero, which is done in this PR). > > This PR removes `LockingMode` related code from the shared (non-platform specific) files. It also removes the `LockingMode` variable itself. > > Passes tier1-tier5 with no added problems. src/hotspot/share/opto/phaseX.cpp line 1672: > 1670: // Found (linux x64 only?) with: > 1671: // serviceability/sa/ClhsdbThreadContext.java > 1672: // -XX:+UnlockExperimentalVMOptions -XX:LockingMode=1 -XX:+IgnoreUnrecognizedVMOptions -XX:VerifyIterativeGVN=1110 For traceability, I suggest leaving this line untouched and adding a comment in the next line clarifying that `-XX:LockingMode` is not available anymore. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2316150051 From azafari at openjdk.org Tue Sep 2 13:58:10 2025 From: azafari at openjdk.org (Afshin Zafari) Date: Tue, 2 Sep 2025 13:58:10 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v10] In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 13:30:59 GMT, Johan Sj?len wrote: >> Hi, >> >> The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. > > Johan Sj?len has updated the pull request incrementally with one additional commit since the last revision: > > After a lot of casting src/hotspot/share/nmt/memBaseline.cpp line 175: > 173: VirtualMemoryAllocationSite* site; > 174: bool failed_oom = false; > 175: _vma_allocs_replacement->visit_reserved_regions([&](ReservedMemoryRegion& rgn) { The `_vma_allocs_replacement` is used only locally here. Instead of creating a copy of the VMATree, we can do our loop here within a lock. Can't we? Then we save one tree traverse. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27003#discussion_r2316165798 From jsjolen at openjdk.org Tue Sep 2 13:58:10 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 13:58:10 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v10] In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 13:51:47 GMT, Afshin Zafari wrote: >> Johan Sj?len has updated the pull request incrementally with one additional commit since the last revision: >> >> After a lot of casting > > src/hotspot/share/nmt/memBaseline.cpp line 175: > >> 173: VirtualMemoryAllocationSite* site; >> 174: bool failed_oom = false; >> 175: _vma_allocs_replacement->visit_reserved_regions([&](ReservedMemoryRegion& rgn) { > > The `_vma_allocs_replacement` is used only locally here. Instead of creating a copy of the VMATree, we can do our loop here within a lock. Can't we? > Then we save one tree traverse. It's used here: ```c++ void MemDetailReporter::report_virtual_memory_map() { // Virtual memory map always in base address order output()->print_cr("Virtual memory map:"); _baseline.virtual_memory_allocations()->visit_reserved_regions([&](ReservedMemoryRegion& rgn) { report_virtual_memory_region(&rgn); return true; }); } ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27003#discussion_r2316171652 From jsjolen at openjdk.org Tue Sep 2 13:58:10 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Tue, 2 Sep 2025 13:58:10 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v11] In-Reply-To: References: Message-ID: > Hi, > > The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. Johan Sj?len has updated the pull request incrementally with one additional commit since the last revision: Rename to _vma_allocations ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27003/files - new: https://git.openjdk.org/jdk/pull/27003/files/76ec83f9..ac24b5e2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=10 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=09-10 Stats: 11 lines in 2 files changed: 0 ins; 0 del; 11 mod Patch: https://git.openjdk.org/jdk/pull/27003.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27003/head:pull/27003 PR: https://git.openjdk.org/jdk/pull/27003 From sjohanss at openjdk.org Tue Sep 2 13:59:37 2025 From: sjohanss at openjdk.org (Stefan Johansson) Date: Tue, 2 Sep 2025 13:59:37 GMT Subject: RFR: 8366434: THP not working properly with G1 after JDK-8345655 Message-ID: Please review this fix to enable transparent huge pages for G1, **Summary** In [JDK-8345655](https://bugs.openjdk.org/browse/JDK-8345655) we refactored the memory reservation code to be more maintainable and easier to follow. When doing this one of the code paths changed to always pass in `os::vm_page_size()` where it previously had used a page size provided by the caller. Even if the alignment for `ReservedSpaces` created this way show that they should be aligned to support large pages the page size member for the `ReservedSpace` does not convey that we want large pages for the space. In G1 when using `G1PageBaseVirtualSpace` we use the above mentioned page size as the alignment for the reservation. This leads to reservations (made using the API) not being THP eligible even if `-XX:+UseTransparentHugePages` is specified. This is only an issue when the system is configured with the THP mode `madvise`. If the mode is `always`, we will get THP eligible reservations. So a fairly simple workaround for this issue (given you have access to configuring your system) is to configure the THP mode to always. The fix is to simply change back to the old behavior and pass in the user provided page size to the `ReservedSpace`. We've also added a test that verifies that we try to back the heap with transparent huge pages when `-XX:+UseTransparentHugePages` is specified on the command-line. **Testing** * Mach5 testing tier1-tier5 * Manual testing of the new test both locally and on mach5. Making sure it has been executed on system with both `madvise` and `always` configured. Also made sure the test actually failed without the fix. ------------- Commit messages: - Typo - StefanK review - Test parsing smaps in process - 8366434: THP not working properly with G1 after JDK-8345655 Changes: https://git.openjdk.org/jdk/pull/27051/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27051&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8366434 Stats: 156 lines in 3 files changed: 154 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/27051.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27051/head:pull/27051 PR: https://git.openjdk.org/jdk/pull/27051 From asmehra at openjdk.org Tue Sep 2 14:57:52 2025 From: asmehra at openjdk.org (Ashutosh Mehra) Date: Tue, 2 Sep 2025 14:57:52 GMT Subject: RFR: 8365501: Remove special AdapterHandlerEntry for abstract methods [v3] In-Reply-To: <3Rdyz0i6XIKqcVC5Rbw1eDU4qZyawLb5JYWws3UARIw=.68cf8962-f5d5-47de-8cc3-d9b18b1453f0@github.com> References: <3Rdyz0i6XIKqcVC5Rbw1eDU4qZyawLb5JYWws3UARIw=.68cf8962-f5d5-47de-8cc3-d9b18b1453f0@github.com> Message-ID: On Mon, 1 Sep 2025 10:28:02 GMT, Andrew Dinn wrote: >> Ashutosh Mehra has updated the pull request incrementally with one additional commit since the last revision: >> >> Address review comment - swap conditions >> >> Signed-off-by: Ashutosh Mehra > > src/hotspot/share/runtime/sharedRuntime.cpp line 2567: > >> 2565: { >> 2566: ResourceMark rm; >> 2567: MutexLocker mu(AdapterHandlerLibrary_lock); > > Why are we ok to drop this lock here? Was it unnecessary even before this change? This lock was required because `AdapterHandlerLibrary::create_abstract_method_handler` expected the lock to be held. Now that method is deleted, we don't need to acquire the lock. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26764#discussion_r2316342459 From asmehra at openjdk.org Tue Sep 2 14:57:53 2025 From: asmehra at openjdk.org (Ashutosh Mehra) Date: Tue, 2 Sep 2025 14:57:53 GMT Subject: Integrated: 8365501: Remove special AdapterHandlerEntry for abstract methods In-Reply-To: References: Message-ID: On Wed, 13 Aug 2025 18:45:54 GMT, Ashutosh Mehra wrote: > This PR removes the need for having AdapterHandlerEntry for abstract methods. The check for abstract method is now done in the accessor functions in Method such as Method::get_i2c_entry(). > Motivation for this change is described in the JBS issue. This pull request has now been integrated. Changeset: 444a8fa1 Author: Ashutosh Mehra URL: https://git.openjdk.org/jdk/commit/444a8fa14e8ab016b8aae018054c5dc1eb843fee Stats: 55 lines in 5 files changed: 11 ins; 38 del; 6 mod 8365501: Remove special AdapterHandlerEntry for abstract methods Reviewed-by: kvn, adinn ------------- PR: https://git.openjdk.org/jdk/pull/26764 From asmehra at openjdk.org Tue Sep 2 14:57:51 2025 From: asmehra at openjdk.org (Ashutosh Mehra) Date: Tue, 2 Sep 2025 14:57:51 GMT Subject: RFR: 8365501: Remove special AdapterHandlerEntry for abstract methods [v3] In-Reply-To: References: Message-ID: <1JlY7ZTfzvPEBEUK8q28muE1wNnTLALxi90fHzvAnbw=.3bca4f8e-cac4-45b8-937a-1caaa84585ab@github.com> On Fri, 29 Aug 2025 22:29:46 GMT, Vladimir Kozlov wrote: >> Ashutosh Mehra has updated the pull request incrementally with one additional commit since the last revision: >> >> Address review comment - swap conditions >> >> Signed-off-by: Ashutosh Mehra > > @adinn, please review these changes. @vnkozlov @adinn thanks for the review. Integrating it now. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26764#issuecomment-3245694023 From jwaters at openjdk.org Tue Sep 2 15:01:56 2025 From: jwaters at openjdk.org (Julian Waters) Date: Tue, 2 Sep 2025 15:01:56 GMT Subject: RFR: 8366699: Replace TestNoNULL with a simpler mechanism to forbid using NULL in HotSpot code Message-ID: TestNoNULL was introduced as a way to forbid using the raw NULL macro in HotSpot code. It works well, but a newer way to achieve the same result by poisoning the macro expansion itself would be more accurate given it could properly use the compiler's lexer and parser to detect NULL being introduced. Normally the way typically envisioned to poison macros by redefining them as an unusable sequence of tokens would be too strong and bleed over into third party code, but there is a way to do so in a controllable fashion. This proposes to implement a simple mechanism to replace TestNoNULL within HotSpot's source code itself, and retire TestNoNULL in favour of this new system. For Visual C++ this is simple, it contains support for using a pragma to poison a macro name, and poisoning a macro causes warnings when it is used. These warnings can be switched off by pragmas whenever we need them to be, making for a perfect disabling system when NULL is used in third party code. For the other 2 big compilers, there exists a similar pragma to disable using a macro, but it is too strong, and unlike Visual C++ is a compile error, meaning there is absolutely no way to turn it off whatsoever. Fortunately there is a simple trick one can leverage: Both compilers have a warning pragma that can be used in this case. All that has to be done is redefining the macro in question to expand into nullptr, but also expand into a pragma that contains this warning message. As for disabling it whenever third party code is around, both compilers conveniently have a push and pop macro pragma that can save and restore macro state, which they implemented for compatibility with Visual C++ and are handy for this purpose. Since redefining Standard header macros is not allowed in C++ we can instead target an implementation detail within the headers: NULL expands to __null, so we can define that as a macro for our purposes instead. Currently using GitHub Actions to test the changes, this is not the final state of the Pull Request. ------------- Commit messages: - Deprecate NULL in compilerWarnings_visCPP.hpp - Define __null in compilerWarnings_gcc.hpp - Delete test/hotspot/jtreg/sources/TestNoNULL.java Changes: https://git.openjdk.org/jdk/pull/27054/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27054&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8366699 Stats: 158 lines in 3 files changed: 4 ins; 153 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/27054.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27054/head:pull/27054 PR: https://git.openjdk.org/jdk/pull/27054 From shade at openjdk.org Tue Sep 2 15:13:42 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Tue, 2 Sep 2025 15:13:42 GMT Subject: RFR: 8366434: THP not working properly with G1 after JDK-8345655 In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 13:53:13 GMT, Stefan Johansson wrote: > Please review this fix to enable transparent huge pages for G1, > > **Summary** > In [JDK-8345655](https://bugs.openjdk.org/browse/JDK-8345655) we refactored the memory reservation code to be more maintainable and easier to follow. When doing this one of the code paths changed to always pass in `os::vm_page_size()` where it previously had used a page size provided by the caller. > > Even if the alignment for `ReservedSpaces` created this way show that they should be aligned to support large pages the page size member for the `ReservedSpace` does not convey that we want large pages for the space. In G1 when using `G1PageBaseVirtualSpace` we use the above mentioned page size as the alignment for the reservation. This leads to reservations (made using the API) not being THP eligible even if `-XX:+UseTransparentHugePages` is specified. > > This is only an issue when the system is configured with the THP mode `madvise`. If the mode is `always`, we will get THP eligible reservations. So a fairly simple workaround for this issue (given you have access to configuring your system) is to configure the THP mode to always. > > The fix is to simply change back to the old behavior and pass in the user provided page size to the `ReservedSpace`. We've also added a test that verifies that we try to back the heap with transparent huge pages when `-XX:+UseTransparentHugePages` is specified on the command-line. > > **Testing** > * Mach5 testing tier1-tier5 > * Manual testing of the new test both locally and on mach5. Making sure it has been executed on system with both `madvise` and `always` configured. Also made sure the test actually failed without the fix. test/hotspot/jtreg/gc/TestTransparentHugePagesHeap.java line 105: > 103: > 104: final Pattern heapSection = Pattern.compile("^" + heapAddress + ".*"); > 105: final Pattern thpEligible = Pattern.compile("THPeligible:\\s+(\\d)\\s*"); I thought we had the `smaps` parser somewhere, and here it is: https://github.com/openjdk/jdk/blob/444a8fa14e8ab016b8aae018054c5dc1eb843fee/test/hotspot/jtreg/runtime/os/TestTracePageSizes.java#L149 -- maybe yank it from there to some testlib location, and use it? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27051#discussion_r2316393324 From vlivanov at openjdk.org Tue Sep 2 16:00:48 2025 From: vlivanov at openjdk.org (Vladimir Ivanov) Date: Tue, 2 Sep 2025 16:00:48 GMT Subject: RFR: 8365407: Race condition in MethodTrainingData::verify() [v8] In-Reply-To: References: <0795hrryFZveQb4GgjNhdGJSYwIz98RHoJx3JX8LSDY=.dae4d10e-5a1f-49da-bec7-e77360f8026e@github.com> Message-ID: On Tue, 26 Aug 2025 22:59:54 GMT, Igor Veresov wrote: >> This change fixes multiple issue with training data verification. While the current state of things in the mainline will not cause any issues (because of the absence of the call to `TD::verify()` during the shutdown) it does problems in the leyden repo. This change strengthens verification in the mainline (by adding the shutdown verify call), and fixes the problems that prevent it from working reliably. > > Igor Veresov has updated the pull request incrementally with one additional commit since the last revision: > > Relax verification invariant src/hotspot/share/oops/trainingData.cpp line 635: > 633: int init_deps_left2 = compute_init_deps_left(); > 634: > 635: bool invariant = (init_deps_left1 >= init_deps_left2); I assume this check takes concurrent class initialization into account and init notification events are processed on a dedicated thread. Can we strengthen the check by repeatedly performing it and ensuring the value converges? Also, maybe take event queue into account? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26866#discussion_r2316527758 From iveresov at openjdk.org Tue Sep 2 16:19:44 2025 From: iveresov at openjdk.org (Igor Veresov) Date: Tue, 2 Sep 2025 16:19:44 GMT Subject: RFR: 8365407: Race condition in MethodTrainingData::verify() [v8] In-Reply-To: References: <0795hrryFZveQb4GgjNhdGJSYwIz98RHoJx3JX8LSDY=.dae4d10e-5a1f-49da-bec7-e77360f8026e@github.com> Message-ID: On Tue, 2 Sep 2025 15:57:42 GMT, Vladimir Ivanov wrote: >> Igor Veresov has updated the pull request incrementally with one additional commit since the last revision: >> >> Relax verification invariant > > src/hotspot/share/oops/trainingData.cpp line 635: > >> 633: int init_deps_left2 = compute_init_deps_left(); >> 634: >> 635: bool invariant = (init_deps_left1 >= init_deps_left2); > > I assume this check takes concurrent class initialization into account and init notification events are processed on a dedicated thread. Can we strengthen the check by repeatedly performing it and ensuring the value converges? Also, maybe take event queue into account? It's very hard to do reliably given the way the vm shutdown currently works. There is no way to ensure that all the java threads are stopped, so checking the convergence is problematic. So, the best I can do right now is prove the `>=` property. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26866#discussion_r2316575038 From iveresov at openjdk.org Tue Sep 2 16:19:45 2025 From: iveresov at openjdk.org (Igor Veresov) Date: Tue, 2 Sep 2025 16:19:45 GMT Subject: RFR: 8365407: Race condition in MethodTrainingData::verify() [v8] In-Reply-To: References: <0795hrryFZveQb4GgjNhdGJSYwIz98RHoJx3JX8LSDY=.dae4d10e-5a1f-49da-bec7-e77360f8026e@github.com> Message-ID: On Tue, 2 Sep 2025 16:15:42 GMT, Igor Veresov wrote: >> src/hotspot/share/oops/trainingData.cpp line 635: >> >>> 633: int init_deps_left2 = compute_init_deps_left(); >>> 634: >>> 635: bool invariant = (init_deps_left1 >= init_deps_left2); >> >> I assume this check takes concurrent class initialization into account and init notification events are processed on a dedicated thread. Can we strengthen the check by repeatedly performing it and ensuring the value converges? Also, maybe take event queue into account? > > It's very hard to do reliably given the way the vm shutdown currently works. There is no way to ensure that all the java threads are stopped, so checking the convergence is problematic. So, the best I can do right now is prove the `>=` property. I mean, I tired, but gave up on the convergence for now. Perhaps we'd make a stab at it another time. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26866#discussion_r2316577781 From vlivanov at openjdk.org Tue Sep 2 16:59:43 2025 From: vlivanov at openjdk.org (Vladimir Ivanov) Date: Tue, 2 Sep 2025 16:59:43 GMT Subject: RFR: 8365407: Race condition in MethodTrainingData::verify() [v8] In-Reply-To: References: <0795hrryFZveQb4GgjNhdGJSYwIz98RHoJx3JX8LSDY=.dae4d10e-5a1f-49da-bec7-e77360f8026e@github.com> Message-ID: On Tue, 26 Aug 2025 22:59:54 GMT, Igor Veresov wrote: >> This change fixes multiple issue with training data verification. While the current state of things in the mainline will not cause any issues (because of the absence of the call to `TD::verify()` during the shutdown) it does problems in the leyden repo. This change strengthens verification in the mainline (by adding the shutdown verify call), and fixes the problems that prevent it from working reliably. > > Igor Veresov has updated the pull request incrementally with one additional commit since the last revision: > > Relax verification invariant Looks good. ------------- Marked as reviewed by vlivanov (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26866#pullrequestreview-3177412360 From vlivanov at openjdk.org Tue Sep 2 16:59:44 2025 From: vlivanov at openjdk.org (Vladimir Ivanov) Date: Tue, 2 Sep 2025 16:59:44 GMT Subject: RFR: 8365407: Race condition in MethodTrainingData::verify() [v8] In-Reply-To: References: <0795hrryFZveQb4GgjNhdGJSYwIz98RHoJx3JX8LSDY=.dae4d10e-5a1f-49da-bec7-e77360f8026e@github.com> Message-ID: On Tue, 2 Sep 2025 16:16:41 GMT, Igor Veresov wrote: >> It's very hard to do reliably given the way the vm shutdown currently works. There is no way to ensure that all the java threads are stopped, so checking the convergence is problematic. So, the best I can do right now is prove the `>=` property. > > I mean, I tired, but gave up on the convergence for now. Perhaps we'd make a stab at it another time. Ok, sounds good. Thanks for the clarifications. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26866#discussion_r2316665607 From sjohanss at openjdk.org Tue Sep 2 17:02:45 2025 From: sjohanss at openjdk.org (Stefan Johansson) Date: Tue, 2 Sep 2025 17:02:45 GMT Subject: RFR: 8366434: THP not working properly with G1 after JDK-8345655 In-Reply-To: References: Message-ID: <2YdaC6jCEz-e3ipYY5XxVDtqSw0c8eoiFo1Z9sEzNIk=.a1ad51ad-dee1-4f50-a15c-81acdcf163bf@github.com> On Tue, 2 Sep 2025 15:10:48 GMT, Aleksey Shipilev wrote: >> Please review this fix to enable transparent huge pages for G1, >> >> **Summary** >> In [JDK-8345655](https://bugs.openjdk.org/browse/JDK-8345655) we refactored the memory reservation code to be more maintainable and easier to follow. When doing this one of the code paths changed to always pass in `os::vm_page_size()` where it previously had used a page size provided by the caller. >> >> Even if the alignment for `ReservedSpaces` created this way show that they should be aligned to support large pages the page size member for the `ReservedSpace` does not convey that we want large pages for the space. In G1 when using `G1PageBaseVirtualSpace` we use the above mentioned page size as the alignment for the reservation. This leads to reservations (made using the API) not being THP eligible even if `-XX:+UseTransparentHugePages` is specified. >> >> This is only an issue when the system is configured with the THP mode `madvise`. If the mode is `always`, we will get THP eligible reservations. So a fairly simple workaround for this issue (given you have access to configuring your system) is to configure the THP mode to always. >> >> The fix is to simply change back to the old behavior and pass in the user provided page size to the `ReservedSpace`. We've also added a test that verifies that we try to back the heap with transparent huge pages when `-XX:+UseTransparentHugePages` is specified on the command-line. >> >> **Testing** >> * Mach5 testing tier1-tier5 >> * Manual testing of the new test both locally and on mach5. Making sure it has been executed on system with both `madvise` and `always` configured. Also made sure the test actually failed without the fix. > > test/hotspot/jtreg/gc/TestTransparentHugePagesHeap.java line 105: > >> 103: >> 104: final Pattern heapSection = Pattern.compile("^" + heapAddress + ".*"); >> 105: final Pattern thpEligible = Pattern.compile("THPeligible:\\s+(\\d)\\s*"); > > I thought we had the `smaps` parser somewhere, and here it is: https://github.com/openjdk/jdk/blob/444a8fa14e8ab016b8aae018054c5dc1eb843fee/test/hotspot/jtreg/runtime/os/TestTracePageSizes.java#L149 -- maybe yank it from there to some testlib location, and use it? I agree that this is what we want long-term, we talked about this internally as well. At one point we also just extended the `TestTracePageSizes.java` test to ensure THP for the heap to avoid some duplication. In the end we felt creating a new test was the best approach right now, to also allow for small and safe backport to 25u. Created [JDK-8366716](https://bugs.openjdk.org/browse/JDK-8366716) to keep track of this. Are you good with this approach? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27051#discussion_r2316672407 From shade at openjdk.org Tue Sep 2 17:34:42 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Tue, 2 Sep 2025 17:34:42 GMT Subject: RFR: 8366434: THP not working properly with G1 after JDK-8345655 In-Reply-To: <2YdaC6jCEz-e3ipYY5XxVDtqSw0c8eoiFo1Z9sEzNIk=.a1ad51ad-dee1-4f50-a15c-81acdcf163bf@github.com> References: <2YdaC6jCEz-e3ipYY5XxVDtqSw0c8eoiFo1Z9sEzNIk=.a1ad51ad-dee1-4f50-a15c-81acdcf163bf@github.com> Message-ID: On Tue, 2 Sep 2025 16:59:50 GMT, Stefan Johansson wrote: >> test/hotspot/jtreg/gc/TestTransparentHugePagesHeap.java line 105: >> >>> 103: >>> 104: final Pattern heapSection = Pattern.compile("^" + heapAddress + ".*"); >>> 105: final Pattern thpEligible = Pattern.compile("THPeligible:\\s+(\\d)\\s*"); >> >> I thought we had the `smaps` parser somewhere, and here it is: https://github.com/openjdk/jdk/blob/444a8fa14e8ab016b8aae018054c5dc1eb843fee/test/hotspot/jtreg/runtime/os/TestTracePageSizes.java#L149 -- maybe yank it from there to some testlib location, and use it? > > I agree that this is what we want long-term, we talked about this internally as well. At one point we also just extended the `TestTracePageSizes.java` test to ensure THP for the heap to avoid some duplication. In the end we felt creating a new test was the best approach right now, to also allow for small and safe backport to 25u. > > Created [JDK-8366716](https://bugs.openjdk.org/browse/JDK-8366716) to keep track of this. > > Are you good with this approach? Yes, OK. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27051#discussion_r2316739575 From duke at openjdk.org Tue Sep 2 17:38:24 2025 From: duke at openjdk.org (Rui Li) Date: Tue, 2 Sep 2025 17:38:24 GMT Subject: RFR: 8246037: Shenandoah: update man pages to mention -XX:+UseShenandoahGC [v7] In-Reply-To: References: Message-ID: > Add documentation of Shenandoah to java man page > > Aside from `-XX:+UseShenandoahGC`, I picked flags from [shenandoah_globals.hpp](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp) that are at product level but not experimental / diagnostic to avoid overwhelming info. Two additional flags match: `ShenandoahGCMode` and `ShenandoahGCHeuristics` Rui Li has updated the pull request incrementally with one additional commit since the last revision: update for threshold wording ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26907/files - new: https://git.openjdk.org/jdk/pull/26907/files/1c8d334a..1c25fbbb Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26907&range=06 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26907&range=05-06 Stats: 3 lines in 1 file changed: 1 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/26907.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26907/head:pull/26907 PR: https://git.openjdk.org/jdk/pull/26907 From ysr at openjdk.org Tue Sep 2 17:41:44 2025 From: ysr at openjdk.org (Y. Srinivas Ramakrishna) Date: Tue, 2 Sep 2025 17:41:44 GMT Subject: RFR: 8246037: Shenandoah: update man pages to mention -XX:+UseShenandoahGC [v7] In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 17:38:24 GMT, Rui Li wrote: >> Add documentation of Shenandoah to java man page >> >> Aside from `-XX:+UseShenandoahGC`, I picked flags from [shenandoah_globals.hpp](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp) that are at product level but not experimental / diagnostic to avoid overwhelming info. Two additional flags match: `ShenandoahGCMode` and `ShenandoahGCHeuristics` > > Rui Li has updated the pull request incrementally with one additional commit since the last revision: > > update for threshold wording Re-reviewed. ? (Apologies for all the bike-shedding!) ------------- Marked as reviewed by ysr (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26907#pullrequestreview-3177542864 From iklam at openjdk.org Tue Sep 2 18:10:43 2025 From: iklam at openjdk.org (Ioi Lam) Date: Tue, 2 Sep 2025 18:10:43 GMT Subject: RFR: 8365407: Race condition in MethodTrainingData::verify() [v8] In-Reply-To: References: <0795hrryFZveQb4GgjNhdGJSYwIz98RHoJx3JX8LSDY=.dae4d10e-5a1f-49da-bec7-e77360f8026e@github.com> Message-ID: On Tue, 26 Aug 2025 22:59:54 GMT, Igor Veresov wrote: >> This change fixes multiple issue with training data verification. While the current state of things in the mainline will not cause any issues (because of the absence of the call to `TD::verify()` during the shutdown) it does problems in the leyden repo. This change strengthens verification in the mainline (by adding the shutdown verify call), and fixes the problems that prevent it from working reliably. > > Igor Veresov has updated the pull request incrementally with one additional commit since the last revision: > > Relax verification invariant LGTM ------------- Marked as reviewed by iklam (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26866#pullrequestreview-3177620970 From kdnilsen at openjdk.org Tue Sep 2 18:37:42 2025 From: kdnilsen at openjdk.org (Kelvin Nilsen) Date: Tue, 2 Sep 2025 18:37:42 GMT Subject: RFR: 8364936: Shenandoah: Switch nmethod entry barriers to conc_instruction_and_data_patch In-Reply-To: References: Message-ID: On Fri, 29 Aug 2025 00:02:42 GMT, Cesar Soares Lucas wrote: > Please, review this patch to make nmethod entry barriers use `conc-instruction-and-data-patch` fence mechanics when ShenandoahGC is being used on AArch64. The patch also removes (including from JVMCI interface) the old constant that was being used only by Shenandoah on AArch64. > > The patch has been tested with functional and performance benchmarks on AArch64. Improvements in DaCapo and Renaissance benchmarks can be as high as 30%. Maximum critical Jops in SPEC improved by ~10%. Thank you for doing this. Looks good to me. ------------- Marked as reviewed by kdnilsen (Committer). PR Review: https://git.openjdk.org/jdk/pull/26999#pullrequestreview-3177693651 From dlong at openjdk.org Tue Sep 2 19:27:37 2025 From: dlong at openjdk.org (Dean Long) Date: Tue, 2 Sep 2025 19:27:37 GMT Subject: RFR: 8366461: Remove obsolete method handle invoke logic Message-ID: At one time, JSR292 support needed special logic to save and restore SP across method handle instrinsic calls, but that is no longer the case. The only platform that still does the save/restore is arm32, which is no longer necessary. The save/restore can be removed along with related APIs and logic. Note that the arm32 port is largely based on the x86 port, which stopped doing the save/restore in jdk9 ([JDK-8068945](https://bugs.openjdk.org/browse/JDK-8068945)). ------------- Commit messages: - Merge branch 'openjdk:master' into 8366461-mh-invoke - first pass Changes: https://git.openjdk.org/jdk/pull/27059/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27059&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8366461 Stats: 538 lines in 68 files changed: 7 ins; 487 del; 44 mod Patch: https://git.openjdk.org/jdk/pull/27059.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27059/head:pull/27059 PR: https://git.openjdk.org/jdk/pull/27059 From wkemper at openjdk.org Tue Sep 2 19:37:42 2025 From: wkemper at openjdk.org (William Kemper) Date: Tue, 2 Sep 2025 19:37:42 GMT Subject: RFR: 8364936: Shenandoah: Switch nmethod entry barriers to conc_instruction_and_data_patch In-Reply-To: References: Message-ID: On Fri, 29 Aug 2025 00:02:42 GMT, Cesar Soares Lucas wrote: > Please, review this patch to make nmethod entry barriers use `conc-instruction-and-data-patch` fence mechanics when ShenandoahGC is being used on AArch64. The patch also removes (including from JVMCI interface) the old constant that was being used only by Shenandoah on AArch64. > > The patch has been tested with functional and performance benchmarks on AArch64. Improvements in DaCapo and Renaissance benchmarks can be as high as 30%. Maximum critical Jops in SPEC improved by ~10%. LGTM ------------- Marked as reviewed by wkemper (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26999#pullrequestreview-3177866470 From iklam at openjdk.org Tue Sep 2 19:47:41 2025 From: iklam at openjdk.org (Ioi Lam) Date: Tue, 2 Sep 2025 19:47:41 GMT Subject: RFR: 8366474: Rename MetaspaceObj::is_shared() to MetaspaceObj::in_aot_cache() [v2] In-Reply-To: References: Message-ID: <6d7OZxH790nUKN0jvkQ2kQjt_6sCTq336F9BrymQrQI=.bb547056-0167-41a4-b4af-cd4decd2e318@github.com> On Mon, 1 Sep 2025 06:58:15 GMT, David Holmes wrote: > Maybe the JBS title should be a bit more generic as you seem to be renaming many occurrences of "shared" not just the one listed. The majority of the changes are about `is_shared` -> `in_aot_cache`. There are other changes like `_shared_metaspace_static_top` -> `_aot_metaspace_static_top`, but these are just implementation details. This PR is one of the (many) subtasks for the "CDS" -> "AOT" renaming (main issue is [JDK-8366473](https://bugs.openjdk.org/browse/JDK-8366473)). My plan is to name each subtask to indicate its main purpose. Otherwise it will be difficult to be both precise and concise in the JBS title. - I.e., in this step I renamed some "shared" but left others, so I can't precisely describe that without writing a long essay. - If I used a generic title then it's difficult to tell the difference with other subtasks. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27016#issuecomment-3246575519 From dlong at openjdk.org Tue Sep 2 19:55:58 2025 From: dlong at openjdk.org (Dean Long) Date: Tue, 2 Sep 2025 19:55:58 GMT Subject: RFR: 8366461: Remove obsolete method handle invoke logic [v2] In-Reply-To: References: Message-ID: > At one time, JSR292 support needed special logic to save and restore SP across method handle instrinsic calls, but that is no longer the case. The only platform that still does the save/restore is arm32, which is no longer necessary. The save/restore can be removed along with related APIs and logic. Note that the arm32 port is largely based on the x86 port, which stopped doing the save/restore in jdk9 ([JDK-8068945](https://bugs.openjdk.org/browse/JDK-8068945)). Dean Long has updated the pull request incrementally with one additional commit since the last revision: arm32 build ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27059/files - new: https://git.openjdk.org/jdk/pull/27059/files/4998cacc..303305ae Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27059&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27059&range=00-01 Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/27059.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27059/head:pull/27059 PR: https://git.openjdk.org/jdk/pull/27059 From coleenp at openjdk.org Tue Sep 2 20:35:48 2025 From: coleenp at openjdk.org (Coleen Phillimore) Date: Tue, 2 Sep 2025 20:35:48 GMT Subject: RFR: 8365190: Remove LockingMode related code from share In-Reply-To: <4pmrLv9G-kotkKQ_B1wEyXSAJ9Vm3cnxditElz641_E=.23c81f11-ece2-4894-ae2f-8763ad343a4d@github.com> References: <4pmrLv9G-kotkKQ_B1wEyXSAJ9Vm3cnxditElz641_E=.23c81f11-ece2-4894-ae2f-8763ad343a4d@github.com> Message-ID: On Tue, 2 Sep 2025 08:24:10 GMT, Fredrik Bredberg wrote: > Since the integration of [JDK-8359437](https://bugs.openjdk.org/browse/JDK-8359437) the `LockingMode` flag can no longer be set by the user. After that, a number of PRs has been integrated which has removed all `LockingMode` related code from all platforms (except from zero, which is done in this PR). > > This PR removes `LockingMode` related code from the shared (non-platform specific) files. It also removes the `LockingMode` variable itself. > > Passes tier1-tier5 with no added problems. A few comments and suggestions for your next RFE. src/hotspot/share/jvmci/vmStructs_jvmci.cpp line 344: > 342: volatile_nonstatic_field(ObjectMonitor, _entry_list, ObjectWaiter*) \ > 343: volatile_nonstatic_field(ObjectMonitor, _succ, int64_t) \ > 344: volatile_nonstatic_field(ObjectMonitor, _stack_locker, BasicLock*) \ There are some jvmci tests that check that the java side of jvmci matches, ie: make test TEST=compiler/jvmci src/hotspot/share/runtime/basicLock.hpp line 51: > 49: void set_bad_metadata_deopt() { set_metadata(badDispHeaderDeopt); } > 50: > 51: static int displaced_header_offset_in_bytes() { return metadata_offset_in_bytes(); } Also delete line 51 ? src/hotspot/share/runtime/javaThread.cpp line 2007: > 2005: #ifdef SUPPORT_MONITOR_COUNT > 2006: // Nothing to do. Just do some sanity check. > 2007: assert(_held_monitor_count == 0, "counter should not be used"); In further cleanup, can we now remove _held_monitor_count next? src/hotspot/share/runtime/lightweightSynchronizer.cpp line 769: > 767: > 768: // LightweightSynchronizer::inflate_locked_or_imse is used to to get an inflated > 769: // ObjectMonitor* when lightweight locking is used. It is used from contexts I guess you don't need the phrase "when lightweight locking is used". src/hotspot/share/runtime/lightweightSynchronizer.cpp line 823: > 821: ObjectMonitor* LightweightSynchronizer::inflate_into_object_header(oop object, ObjectSynchronizer::InflateCause cause, JavaThread* locking_thread, Thread* current) { > 822: > 823: // The JavaThread* locking_thread parameter is only used by lightweight locking and Same here. suggestion: // The JavaThread* locking parameter requires that the locking_thread == JavaThread::current, or is suspended // throughout the call by some other mechanism. src/hotspot/share/runtime/synchronizer.cpp line 542: > 540: } > 541: ObjectMonitor* monitor; > 542: monitor = LightweightSynchronizer::inflate_locked_or_imse(obj(), inflate_cause_notify, CHECK); Declare and initialize on the same line: ObjectMonitor* monitor = LightwightSynchronizer::inflate_locked_or_imse(obj...); src/hotspot/share/runtime/synchronizer.cpp line 557: > 555: > 556: ObjectMonitor* monitor; > 557: monitor = LightweightSynchronizer::inflate_locked_or_imse(obj(), inflate_cause_notify, CHECK); same here with ObjectMonitor* monitor = LIght ... I think we should have another RFE to look at eliminating the middle call. Call these in LIghtweightSynchronizer::notify, notifyAll and waitInterruptably directly and remove these functions. src/hotspot/share/runtime/synchronizer.inline.hpp line 48: > 46: assert(current == Thread::current(), "must be"); > 47: > 48: LightweightSynchronizer::enter(obj, lock, current); In the further RFE, we should remove these dispatch functions too. ------------- PR Review: https://git.openjdk.org/jdk/pull/27041#pullrequestreview-3177963667 PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2317054927 PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2317063086 PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2317069783 PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2317072241 PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2317077253 PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2317084869 PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2317088830 PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2317095107 From dlong at openjdk.org Tue Sep 2 20:52:32 2025 From: dlong at openjdk.org (Dean Long) Date: Tue, 2 Sep 2025 20:52:32 GMT Subject: RFR: 8366461: Remove obsolete method handle invoke logic [v3] In-Reply-To: References: Message-ID: <_pqvEs0LIlAc7RjFUwg-bpxS3D2v5U7c6In2sG8XLhQ=.57e3aead-6ac4-4a42-89d2-385d7e6ecedf@github.com> > At one time, JSR292 support needed special logic to save and restore SP across method handle instrinsic calls, but that is no longer the case. The only platform that still does the save/restore is arm32, which is no longer necessary. The save/restore can be removed along with related APIs and logic. Note that the arm32 port is largely based on the x86 port, which stopped doing the save/restore in jdk9 ([JDK-8068945](https://bugs.openjdk.org/browse/JDK-8068945)). Dean Long has updated the pull request incrementally with three additional commits since the last revision: - revert whitespace change - undo debug changes - cleanup ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27059/files - new: https://git.openjdk.org/jdk/pull/27059/files/303305ae..eac482a5 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27059&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27059&range=01-02 Stats: 7 lines in 4 files changed: 1 ins; 6 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/27059.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27059/head:pull/27059 PR: https://git.openjdk.org/jdk/pull/27059 From iklam at openjdk.org Tue Sep 2 21:02:36 2025 From: iklam at openjdk.org (Ioi Lam) Date: Tue, 2 Sep 2025 21:02:36 GMT Subject: RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* [v2] In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 04:56:50 GMT, David Holmes wrote: >> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision: >> >> Added assert in heapInspection.cpp > > src/hotspot/share/memory/heapInspection.cpp line 405: > >> 403: bool print_subclasses) { >> 404: // Set do_print for all superclasses of this class. >> 405: InstanceKlass* super = InstanceKlass::cast(cie->klass())->super(); > > Pre-existing, but if this cast is safe then `KlassInfoEntry::_klass` should be declared `InstanceKlass`. Otherwise this cast is not safe! Separate RFE for that. I looked at the `KlassHierarchy` code and it looks at only instance klasses. https://github.com/openjdk/jdk/blob/80fb7088a10136080d23ea93b4840f17d738500c/src/hotspot/share/memory/heapInspection.cpp#L318-L319 I added an assert to make this more apparent. The `KlassInfoEntry` is used by other code that could sometimes store a non-instance klass. I'll leave it as is for now. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27037#discussion_r2317161232 From iklam at openjdk.org Tue Sep 2 21:02:37 2025 From: iklam at openjdk.org (Ioi Lam) Date: Tue, 2 Sep 2025 21:02:37 GMT Subject: RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* [v2] In-Reply-To: References: <8XfA1QxtYcE7-4O3qTGtgktxCYg5HpvZtFWrRR0Rt4I=.7468c92f-edf9-4934-94b6-84a0db503781@github.com> Message-ID: <01xQytgY2qniZkDfORqEoOeJ-PzOgU5-QLg-qumdzic=.99d732bb-9872-480e-9d2b-311069275ba3@github.com> On Tue, 2 Sep 2025 11:43:22 GMT, Coleen Phillimore wrote: >> I think the term is "hides" not "shadows". InstanceKlass::cast() is better - one additional check that super is always another InstanceKlass. > > Do we still need java_super ? There are a few places that use it. Maybe we should look at these again in the future. compiler dependencies: ./share/code/dependencies.cpp: for (InstanceKlass* super = k->java_super(); super != nullptr; super = super->java_super()) { ./share/code/dependencies.cpp: _klass = _klass->java_super(); subklass and sibling: ./share/oops/instanceKlass.cpp: _current = _current->java_super(); // backtrack; no more sibling subclasses left ./share/oops/klass.cpp: InstanceKlass* super = java_super(); ./share/oops/klass.cpp: && (super->java_super() == nullptr || !is_interface())), Some general cases where you have a Klass but wants same super as in java.lang.Class::getSuperClass ./share/oops/klassVtable.cpp: InstanceKlass* super = _klass->java_super(); ./share/prims/jni.cpp: // Rules of Class.getSuperClass as implemented by KLass::java_super: ./share/prims/jni.cpp: Klass* super = k->java_super(); ./share/prims/jni.cpp: "java_super computation depends on interface, array, other super"); ./share/services/heapDumper.cpp: InstanceKlass* java_super = k->java_super(); ./share/services/heapDumper.cpp: assert(java_super != nullptr, "checking"); ./share/services/heapDumper.cpp: writer->write_classID(java_super); ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27037#discussion_r2317159260 From iklam at openjdk.org Tue Sep 2 21:02:35 2025 From: iklam at openjdk.org (Ioi Lam) Date: Tue, 2 Sep 2025 21:02:35 GMT Subject: RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* [v2] In-Reply-To: References: Message-ID: > By adding an `InstanceKlass* InstanceKlass::super()` method to shadow `Klass* Klass:super()`, this PR makes it possible to simplify the following code > > > InstanceKlass* ik; > InstanceKlass* s; > s = InstanceKlass::cast(ik->super()); // before JDK-8366024 > s = ik->java_super(); // after JDK-8366024 > > > to > > > s = k->super(); > > > So you no longer need to do casting or need to understand what `java_super()` is. Ioi Lam has updated the pull request incrementally with one additional commit since the last revision: Added assert in heapInspection.cpp ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27037/files - new: https://git.openjdk.org/jdk/pull/27037/files/54236678..e1bac273 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27037&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27037&range=00-01 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/27037.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27037/head:pull/27037 PR: https://git.openjdk.org/jdk/pull/27037 From iklam at openjdk.org Tue Sep 2 21:08:25 2025 From: iklam at openjdk.org (Ioi Lam) Date: Tue, 2 Sep 2025 21:08:25 GMT Subject: RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* [v3] In-Reply-To: References: Message-ID: > By adding an `InstanceKlass* InstanceKlass::super()` method to shadow `Klass* Klass:super()`, this PR makes it possible to simplify the following code > > > InstanceKlass* ik; > InstanceKlass* s; > s = InstanceKlass::cast(ik->super()); // before JDK-8366024 > s = ik->java_super(); // after JDK-8366024 > > > to > > > s = k->super(); > > > So you no longer need to do casting or need to understand what `java_super()` is. Ioi Lam has updated the pull request incrementally with one additional commit since the last revision: @dholmes-ora and @coleep comments ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27037/files - new: https://git.openjdk.org/jdk/pull/27037/files/e1bac273..dd0a3c5a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27037&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27037&range=01-02 Stats: 3 lines in 2 files changed: 0 ins; 1 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/27037.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27037/head:pull/27037 PR: https://git.openjdk.org/jdk/pull/27037 From iklam at openjdk.org Tue Sep 2 21:08:25 2025 From: iklam at openjdk.org (Ioi Lam) Date: Tue, 2 Sep 2025 21:08:25 GMT Subject: RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* [v3] In-Reply-To: <01xQytgY2qniZkDfORqEoOeJ-PzOgU5-QLg-qumdzic=.99d732bb-9872-480e-9d2b-311069275ba3@github.com> References: <8XfA1QxtYcE7-4O3qTGtgktxCYg5HpvZtFWrRR0Rt4I=.7468c92f-edf9-4934-94b6-84a0db503781@github.com> <01xQytgY2qniZkDfORqEoOeJ-PzOgU5-QLg-qumdzic=.99d732bb-9872-480e-9d2b-311069275ba3@github.com> Message-ID: <7fhuHDv6auOGm7Kj_QANCQ_eUB8ky4NRPAOxa-Gcn-M=.426a74ba-a359-4a6d-a796-aec9000001ff@github.com> On Tue, 2 Sep 2025 20:57:26 GMT, Ioi Lam wrote: >> Do we still need java_super ? > > There are a few places that use it. Maybe we should look at these again in the future. > > > compiler dependencies: > > ./share/code/dependencies.cpp: for (InstanceKlass* super = k->java_super(); super != nullptr; super = super->java_super()) { > ./share/code/dependencies.cpp: _klass = _klass->java_super(); > > subklass and sibling: > > ./share/oops/instanceKlass.cpp: _current = _current->java_super(); // backtrack; no more sibling subclasses left > ./share/oops/klass.cpp: InstanceKlass* super = java_super(); > ./share/oops/klass.cpp: && (super->java_super() == nullptr || !is_interface())), > > Some general cases where you have a Klass but wants same super as in java.lang.Class::getSuperClass > > ./share/oops/klassVtable.cpp: InstanceKlass* super = _klass->java_super(); > ./share/prims/jni.cpp: // Rules of Class.getSuperClass as implemented by KLass::java_super: > ./share/prims/jni.cpp: Klass* super = k->java_super(); > ./share/prims/jni.cpp: "java_super computation depends on interface, array, other super"); > ./share/services/heapDumper.cpp: InstanceKlass* java_super = k->java_super(); > ./share/services/heapDumper.cpp: assert(java_super != nullptr, "checking"); > ./share/services/heapDumper.cpp: writer->write_classID(java_super); I changed to `hides`. There are mentions of both `shadows` and `hides` in our comments. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27037#discussion_r2317171136 From iklam at openjdk.org Tue Sep 2 21:08:26 2025 From: iklam at openjdk.org (Ioi Lam) Date: Tue, 2 Sep 2025 21:08:26 GMT Subject: RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* [v3] In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 05:31:30 GMT, David Holmes wrote: >> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision: >> >> @dholmes-ora and @coleep comments > > src/hotspot/share/oops/klassVtable.cpp line 1574: > >> 1572: Klass* super = _klass->super(); >> 1573: if (super != nullptr) { >> 1574: InstanceKlass* sk = InstanceKlass::cast(super); // why are we sure this is InstanceKlass?? > > I don't think it is guaranteed to be an IK. But AFAICS we don't actually need an IK here anyway, we should be able to use `super` directly. Fixed. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27037#discussion_r2317170011 From vlivanov at openjdk.org Tue Sep 2 21:11:46 2025 From: vlivanov at openjdk.org (Vladimir Ivanov) Date: Tue, 2 Sep 2025 21:11:46 GMT Subject: RFR: 8366461: Remove obsolete method handle invoke logic [v3] In-Reply-To: <_pqvEs0LIlAc7RjFUwg-bpxS3D2v5U7c6In2sG8XLhQ=.57e3aead-6ac4-4a42-89d2-385d7e6ecedf@github.com> References: <_pqvEs0LIlAc7RjFUwg-bpxS3D2v5U7c6In2sG8XLhQ=.57e3aead-6ac4-4a42-89d2-385d7e6ecedf@github.com> Message-ID: On Tue, 2 Sep 2025 20:52:32 GMT, Dean Long wrote: >> At one time, JSR292 support needed special logic to save and restore SP across method handle instrinsic calls, but that is no longer the case. The only platform that still does the save/restore is arm32, which is no longer necessary. The save/restore can be removed along with related APIs and logic. Note that the arm32 port is largely based on the x86 port, which stopped doing the save/restore in jdk9 ([JDK-8068945](https://bugs.openjdk.org/browse/JDK-8068945)). > > Dean Long has updated the pull request incrementally with three additional commits since the last revision: > > - revert whitespace change > - undo debug changes > - cleanup Nice cleanup! Looks good. ------------- Marked as reviewed by vlivanov (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27059#pullrequestreview-3178139499 From iveresov at openjdk.org Tue Sep 2 21:30:52 2025 From: iveresov at openjdk.org (Igor Veresov) Date: Tue, 2 Sep 2025 21:30:52 GMT Subject: Integrated: 8365407: Race condition in MethodTrainingData::verify() In-Reply-To: <0795hrryFZveQb4GgjNhdGJSYwIz98RHoJx3JX8LSDY=.dae4d10e-5a1f-49da-bec7-e77360f8026e@github.com> References: <0795hrryFZveQb4GgjNhdGJSYwIz98RHoJx3JX8LSDY=.dae4d10e-5a1f-49da-bec7-e77360f8026e@github.com> Message-ID: On Wed, 20 Aug 2025 18:19:25 GMT, Igor Veresov wrote: > This change fixes multiple issue with training data verification. While the current state of things in the mainline will not cause any issues (because of the absence of the call to `TD::verify()` during the shutdown) it does problems in the leyden repo. This change strengthens verification in the mainline (by adding the shutdown verify call), and fixes the problems that prevent it from working reliably. This pull request has now been integrated. Changeset: 991ac9e6 Author: Igor Veresov URL: https://git.openjdk.org/jdk/commit/991ac9e6168b2573f78772e2d7936792a43fe336 Stats: 90 lines in 6 files changed: 32 ins; 17 del; 41 mod 8365407: Race condition in MethodTrainingData::verify() Reviewed-by: kvn, vlivanov, iklam ------------- PR: https://git.openjdk.org/jdk/pull/26866 From eastigeevich at openjdk.org Tue Sep 2 21:45:03 2025 From: eastigeevich at openjdk.org (Evgeny Astigeevich) Date: Tue, 2 Sep 2025 21:45:03 GMT Subject: RFR: 8277444: Data race between JvmtiClassFileReconstituter::copy_bytecodes and class linking [v5] In-Reply-To: References: Message-ID: > There is a race between `JvmtiClassFileReconstituter::copy_bytecodes` and `InstanceKlass::link_class_impl`. `InstanceKlass::link_class_impl` can be rewriting bytecodes. `JvmtiClassFileReconstituter::copy_bytecodes` will not restore them to the original ones because the flag `rewritten` is `false`. This will result in invalid bytecode. > > This PR adds linking a class before the `copy_bytecodes` method is called. > The PR also adds a regression test. > > Tested fastdebug and release builds: Linux x86_64 and arm64 > - The reproducer from JDK-8277444 passed. > - The regression test passed. > - Tier1 - tier3 passed. Evgeny Astigeevich has updated the pull request incrementally with one additional commit since the last revision: Switch to macros HAS_PENDING_EXCEPTION, CLEAR_PENDING_EXCEPTION ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26863/files - new: https://git.openjdk.org/jdk/pull/26863/files/f5019d97..05207c6c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26863&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26863&range=03-04 Stats: 9 lines in 2 files changed: 2 ins; 1 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/26863.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26863/head:pull/26863 PR: https://git.openjdk.org/jdk/pull/26863 From eastigeevich at openjdk.org Tue Sep 2 21:45:05 2025 From: eastigeevich at openjdk.org (Evgeny Astigeevich) Date: Tue, 2 Sep 2025 21:45:05 GMT Subject: RFR: 8277444: Data race between JvmtiClassFileReconstituter::copy_bytecodes and class linking [v4] In-Reply-To: <1JIJRz2n7-MCQDwQhqWAMC5o1VQ0gYwLZ1jgkjQH8YU=.c06407bf-e13b-4e35-84f9-ab2f4154f754@github.com> References: <1JIJRz2n7-MCQDwQhqWAMC5o1VQ0gYwLZ1jgkjQH8YU=.c06407bf-e13b-4e35-84f9-ab2f4154f754@github.com> Message-ID: On Tue, 2 Sep 2025 12:04:01 GMT, Coleen Phillimore wrote: >> Evgeny Astigeevich has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision: >> >> - Merge branch 'master' into JDK-8277444 >> - Link classes before copy_bytecodes; Add regression test >> - Symplify comments; Get JavaThread::current in variable >> - Add missing include runtime/synchronizer.hpp >> - 8277444: Race condition on Instrumentation.retransformClasses() and class linking > > src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp line 35: > >> 33: #include "runtime/handles.inline.hpp" >> 34: #include "runtime/signature.hpp" >> 35: #include "runtime/synchronizer.hpp" > > You don't need this include anymore. Removed. > src/hotspot/share/prims/jvmtiEnv.cpp line 3446: > >> 3444: current_thread->clear_pending_exception(); >> 3445: return JVMTI_ERROR_INVALID_CLASS; >> 3446: } > > Can you use the pattern: > > > JavaThread* THREAD = current_thread; > ... link_class(THREAD); > if (HAS_PENDING_EXCEPTION) > etc. Switched to macros. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26863#discussion_r2317234764 PR Review Comment: https://git.openjdk.org/jdk/pull/26863#discussion_r2317235161 From dlong at openjdk.org Tue Sep 2 22:16:44 2025 From: dlong at openjdk.org (Dean Long) Date: Tue, 2 Sep 2025 22:16:44 GMT Subject: RFR: 8366461: Remove obsolete method handle invoke logic [v3] In-Reply-To: References: <_pqvEs0LIlAc7RjFUwg-bpxS3D2v5U7c6In2sG8XLhQ=.57e3aead-6ac4-4a42-89d2-385d7e6ecedf@github.com> Message-ID: On Tue, 2 Sep 2025 21:09:27 GMT, Vladimir Ivanov wrote: >> Dean Long has updated the pull request incrementally with three additional commits since the last revision: >> >> - revert whitespace change >> - undo debug changes >> - cleanup > > Nice cleanup! Looks good. Thanks @iwanowww ! ------------- PR Comment: https://git.openjdk.org/jdk/pull/27059#issuecomment-3246957430 From duke at openjdk.org Tue Sep 2 22:34:44 2025 From: duke at openjdk.org (duke) Date: Tue, 2 Sep 2025 22:34:44 GMT Subject: RFR: 8246037: Shenandoah: update man pages to mention -XX:+UseShenandoahGC [v7] In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 17:38:24 GMT, Rui Li wrote: >> Add documentation of Shenandoah to java man page >> >> Aside from `-XX:+UseShenandoahGC`, I picked flags from [shenandoah_globals.hpp](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp) that are at product level but not experimental / diagnostic to avoid overwhelming info. Two additional flags match: `ShenandoahGCMode` and `ShenandoahGCHeuristics` > > Rui Li has updated the pull request incrementally with one additional commit since the last revision: > > update for threshold wording @rgithubli Your change (at version 1c25fbbb0cd5f8fc882a11fa5089e9492c80085d) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26907#issuecomment-3247007501 From sviswanathan at openjdk.org Tue Sep 2 22:54:42 2025 From: sviswanathan at openjdk.org (Sandhya Viswanathan) Date: Tue, 2 Sep 2025 22:54:42 GMT Subject: RFR: 8363858: [perf] OptimizeFill may use wide set of intrinsics In-Reply-To: References: Message-ID: On Wed, 27 Aug 2025 23:56:40 GMT, Vladimir Ivanov wrote: > Default mode should use OptimizeFill=true option for the SRF platform. Looks good to me. ------------- Marked as reviewed by sviswanathan (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26974#pullrequestreview-3178386830 From sviswanathan at openjdk.org Tue Sep 2 23:00:43 2025 From: sviswanathan at openjdk.org (Sandhya Viswanathan) Date: Tue, 2 Sep 2025 23:00:43 GMT Subject: RFR: 8365290: [perf] x86 ArrayFill intrinsic generates SPLIT_STORE for unaligned arrays [v4] In-Reply-To: References: Message-ID: On Sat, 30 Aug 2025 16:04:00 GMT, Vladimir Ivanov wrote: >> On the SRF platform for runs with intrinsic scores for the ArrayFill test reports ~2x drop for several sizes due to a lot of the 'MEM_UOPS_RETIRED.SPLIT_STORES' events. The 'good' case for the ArraysFill.testCharFill with size=8195 reports numbers like >> MEM_UOPS_RETIRED.SPLIT_LOADS | 22.6711 >> MEM_UOPS_RETIRED.SPLIT_STORES | 4.0859 >> while for 'bad' case these metrics are >> MEM_UOPS_RETIRED.SPLIT_LOADS | 69.1785 >> MEM_UOPS_RETIRED.SPLIT_STORES | 259200.3659 >> >> With alignment on the cache size no score drops due to split_stores but small reduction may be reported due to extra >> SRF 6740E | Size | orig | pathed | pO/orig >> -- | -- | -- | -- | -- >> ArraysFill.testByteFill | 16 | 152031.2 | 157001.2 | 1.03 >> ArraysFill.testByteFill | 31 | 125795.9 | 177399.2 | 1.41 >> ArraysFill.testByteFill | 250 | 57961.69 | 120981.9 | 2.09 >> ArraysFill.testByteFill | 266 | 44900.15 | 147893.8 | 3.29 >> ArraysFill.testByteFill | 511 | 61908.17 | 129830.1 | 2.10 >> ArraysFill.testByteFill | 2047 | 32255.51 | 41986.6 | 1.30 >> ArraysFill.testByteFill | 2048 | 31928.97 | 42154.3 | 1.32 >> ArraysFill.testByteFill | 8195 | 10690.15 | 11036.3 | 1.03 >> ArraysFill.testIntFill | 16 | 145030.7 | 318796.9 | 2.20 >> ArraysFill.testIntFill | 31 | 134138.4 | 212487 | 1.58 >> ArraysFill.testIntFill | 250 | 74179.23 | 79522.66 | 1.07 >> ArraysFill.testIntFill | 266 | 68112.72 | 60116.49 | 0.88 >> ArraysFill.testIntFill | 511 | 39693.28 | 36225.09 | 0.91 >> ArraysFill.testIntFill | 2047 | 11504.14 | 10616.91 | 0.92 >> ArraysFill.testIntFill | 2048 | 11244.71 | 10969.14 | 0.98 >> ArraysFill.testIntFill | 8195 | 2751.289 | 2692.216 | 0.98 >> ArraysFill.testLongFill | 16 | 212532.5 | 212526 | 1.00 >> ArraysFill.testLongFill | 31 | 137432.4 | 137283.3 | 1.00 >> ArraysFill.testLongFill | 250 | 43185 | 43159.78 | 1.00 >> ArraysFill.testLongFill | 266 | 42172.22 | 42170.5 | 1.00 >> ArraysFill.testLongFill | 511 | 23370.15 | 23370.86 | 1.00 >> ArraysFill.testLongFill | 2047 | 6123.008 | 6122.73 | 1.00 >> ArraysFill.testLongFill | 2048 | 5793.722 | 5792.855 | 1.00 >> ArraysFill.testLongFill | 8195 | 616.552 | 616.585 | 1.00 >> ArraysFill.testShortFill | 16 | 152088.6 | 265646.1 | 1.75 >> ArraysFill.testShortFill | 31 | 137369.8 | 185596.4 | 1.35 >> ArraysFill.testShortFill | 250 | 58872.03 | 99621.15 | 1.69 >> ArraysFill.testShortFill | 266 | 91085.31 | 93746.62 | 1.03 >> ArraysFill.testShortFill | 511 | 65331.96 | 78003.83 | 1.19 >> ArraysFill.testShortFill | 2047 | 21716.32 | 21216.81 | 0.98 >> ArraysFill.testShortFill... > > Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision: > > JDK-8365290 [perf] x86 ArrayFill intrinsic generates SPLIT_STORE for unaligned arrays src/hotspot/cpu/x86/macroAssembler_x86.cpp line 5931: > 5929: addptr(to, 4); > 5930: subptr(count, 1< 5931: jmpb(L_align_64_bytes); This should be a conditional jump. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26747#discussion_r2317357146 From kbarrett at openjdk.org Tue Sep 2 23:33:17 2025 From: kbarrett at openjdk.org (Kim Barrett) Date: Tue, 2 Sep 2025 23:33:17 GMT Subject: RFR: 8300080: offset_of for GCC/Clang exhibits undefined behavior and is not always a compile-time constant Message-ID: Please review this change to offset_of to just use offsetof as it's implementation. The rationale for this is (1) Despite being UB for some cases that we use (through C++14), none of the compilers we use actually treat it as such, other than some compilers issuing warnings. (Surprisingly, the UB doesn't appear to disable constexpr evaluation?) (2) C++17 changed it to be conditionally defined in those formerly UB cases, and we'll be switching over to C++17 soon (JDK-8314488). Until we make the switch to C++17 we need to suppress warnings from some compilers for such uses. We can remove that warning suppression later. See the JBS issue for more discussion. Testing: mach5 tier1 ------------- Commit messages: - offset_of just uses offsetof Changes: https://git.openjdk.org/jdk/pull/27061/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27061&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8300080 Stats: 26 lines in 4 files changed: 5 ins; 20 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/27061.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27061/head:pull/27061 PR: https://git.openjdk.org/jdk/pull/27061 From kbarrett at openjdk.org Tue Sep 2 23:33:17 2025 From: kbarrett at openjdk.org (Kim Barrett) Date: Tue, 2 Sep 2025 23:33:17 GMT Subject: RFR: 8300080: offset_of for GCC/Clang exhibits undefined behavior and is not always a compile-time constant In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 23:25:43 GMT, Kim Barrett wrote: > Please review this change to offset_of to just use offsetof as it's > implementation. The rationale for this is > > (1) Despite being UB for some cases that we use (through C++14), none of the > compilers we use actually treat it as such, other than some compilers issuing > warnings. (Surprisingly, the UB doesn't appear to disable constexpr evaluation?) > > (2) C++17 changed it to be conditionally defined in those formerly UB cases, > and we'll be switching over to C++17 soon (JDK-8314488). > > Until we make the switch to C++17 we need to suppress warnings from some > compilers for such uses. We can remove that warning suppression later. > > See the JBS issue for more discussion. > > Testing: mach5 tier1 Assuming this gets approved, there should be followup issues to (1) remove the unnecessary warning suppression once we're using C++17, and (2) update uses of offset_of to instead use offsetof directly. I'll file those issues once this gets approved. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27061#issuecomment-3247131522 From duke at openjdk.org Tue Sep 2 23:51:47 2025 From: duke at openjdk.org (Rui Li) Date: Tue, 2 Sep 2025 23:51:47 GMT Subject: Integrated: 8246037: Shenandoah: update man pages to mention -XX:+UseShenandoahGC In-Reply-To: References: Message-ID: On Fri, 22 Aug 2025 18:36:04 GMT, Rui Li wrote: > Add documentation of Shenandoah to java man page > > Aside from `-XX:+UseShenandoahGC`, I picked flags from [shenandoah_globals.hpp](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp) that are at product level but not experimental / diagnostic to avoid overwhelming info. Two additional flags match: `ShenandoahGCMode` and `ShenandoahGCHeuristics` This pull request has now been integrated. Changeset: 5052a7ee Author: Rui Li Committer: Kelvin Nilsen URL: https://git.openjdk.org/jdk/commit/5052a7eee57e9d145950a0ab1ca71edc02bfe0be Stats: 44 lines in 2 files changed: 42 ins; 0 del; 2 mod 8246037: Shenandoah: update man pages to mention -XX:+UseShenandoahGC Reviewed-by: ysr, wkemper, cslucas ------------- PR: https://git.openjdk.org/jdk/pull/26907 From cslucas at openjdk.org Wed Sep 3 00:23:05 2025 From: cslucas at openjdk.org (Cesar Soares Lucas) Date: Wed, 3 Sep 2025 00:23:05 GMT Subject: RFR: 8364936: Shenandoah: Switch nmethod entry barriers to conc_instruction_and_data_patch [v2] In-Reply-To: References: Message-ID: > Please, review this patch to make nmethod entry barriers use `conc-instruction-and-data-patch` fence mechanics when ShenandoahGC is being used on AArch64. The patch also removes (including from JVMCI interface) the old constant that was being used only by Shenandoah on AArch64. > > The patch has been tested with functional and performance benchmarks on AArch64. Improvements in DaCapo and Renaissance benchmarks can be as high as 30%. Maximum critical Jops in SPEC improved by ~10%. Cesar Soares Lucas has updated the pull request incrementally with one additional commit since the last revision: Change shenandoah nmethod entry barrier fence for RISC-V (cherry picked from commit 495b07fe690ef7e3fe828fd2be27c4259c739c23) ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26999/files - new: https://git.openjdk.org/jdk/pull/26999/files/62da55fb..3276b586 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26999&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26999&range=00-01 Stats: 9 lines in 4 files changed: 0 ins; 7 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/26999.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26999/head:pull/26999 PR: https://git.openjdk.org/jdk/pull/26999 From cslucas at openjdk.org Wed Sep 3 00:37:59 2025 From: cslucas at openjdk.org (Cesar Soares Lucas) Date: Wed, 3 Sep 2025 00:37:59 GMT Subject: RFR: 8364936: Shenandoah: Switch nmethod entry barriers to conc_instruction_and_data_patch [v3] In-Reply-To: References: Message-ID: > Please, review this patch to make nmethod entry barriers use `conc-instruction-and-data-patch` fence mechanics when ShenandoahGC is being used on AArch64. The patch also removes (including from JVMCI interface) the old constant that was being used only by Shenandoah on AArch64. > > The patch has been tested with functional and performance benchmarks on AArch64. Improvements in DaCapo and Renaissance benchmarks can be as high as 30%. Maximum critical Jops in SPEC improved by ~10%. Cesar Soares Lucas has updated the pull request incrementally with one additional commit since the last revision: Make PPC backend to also use concurrent code patching. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26999/files - new: https://git.openjdk.org/jdk/pull/26999/files/3276b586..4da31385 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26999&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26999&range=01-02 Stats: 3 lines in 2 files changed: 0 ins; 1 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/26999.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26999/head:pull/26999 PR: https://git.openjdk.org/jdk/pull/26999 From fyang at openjdk.org Wed Sep 3 01:30:44 2025 From: fyang at openjdk.org (Fei Yang) Date: Wed, 3 Sep 2025 01:30:44 GMT Subject: RFR: 8364936: Shenandoah: Switch nmethod entry barriers to conc_instruction_and_data_patch [v3] In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 00:37:59 GMT, Cesar Soares Lucas wrote: >> Please, review this patch to make nmethod entry barriers use `conc-instruction-and-data-patch` fence mechanics when ShenandoahGC is being used on AArch64. The patch also removes (including from JVMCI interface) the old constant that was being used only by Shenandoah on AArch64. >> >> The patch has been tested with functional and performance benchmarks on AArch64. Improvements in DaCapo and Renaissance benchmarks can be as high as 30%. Maximum critical Jops in SPEC improved by ~10%. > > Cesar Soares Lucas has updated the pull request incrementally with one additional commit since the last revision: > > Make PPC backend to also use concurrent code patching. I just checked the RISC-V part. LGTM. Thanks. ------------- Marked as reviewed by fyang (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26999#pullrequestreview-3178669201 From dzhang at openjdk.org Wed Sep 3 02:15:50 2025 From: dzhang at openjdk.org (Dingli Zhang) Date: Wed, 3 Sep 2025 02:15:50 GMT Subject: RFR: 8364936: Shenandoah: Switch nmethod entry barriers to conc_instruction_and_data_patch [v3] In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 00:37:59 GMT, Cesar Soares Lucas wrote: >> Please, review this patch to make nmethod entry barriers use `conc-instruction-and-data-patch` fence mechanics when ShenandoahGC is being used on AArch64. The patch also removes (including from JVMCI interface) the old constant that was being used only by Shenandoah on AArch64. >> >> The patch has been tested with functional and performance benchmarks on AArch64. Improvements in DaCapo and Renaissance benchmarks can be as high as 30%. Maximum critical Jops in SPEC improved by ~10%. > > Cesar Soares Lucas has updated the pull request incrementally with one additional commit since the last revision: > > Make PPC backend to also use concurrent code patching. LGTM, thanks! ------------- Marked as reviewed by dzhang (Author). PR Review: https://git.openjdk.org/jdk/pull/26999#pullrequestreview-3178728761 From cslucas at openjdk.org Wed Sep 3 04:29:50 2025 From: cslucas at openjdk.org (Cesar Soares Lucas) Date: Wed, 3 Sep 2025 04:29:50 GMT Subject: RFR: 8364936: Shenandoah: Switch nmethod entry barriers to conc_instruction_and_data_patch [v3] In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 00:37:59 GMT, Cesar Soares Lucas wrote: >> Please, review this patch to make nmethod entry barriers use `conc-instruction-and-data-patch` fence mechanics when ShenandoahGC is being used on AArch64. The patch also removes (including from JVMCI interface) the old constant that was being used only by Shenandoah on AArch64. >> >> The patch has been tested with functional and performance benchmarks on AArch64. Improvements in DaCapo and Renaissance benchmarks can be as high as 30%. Maximum critical Jops in SPEC improved by ~10%. > > Cesar Soares Lucas has updated the pull request incrementally with one additional commit since the last revision: > > Make PPC backend to also use concurrent code patching. @TheRealMDoerr - @shipilev mentioned in private that you have access to PPC machines; could you please help testing this patch on PPC? ------------- PR Comment: https://git.openjdk.org/jdk/pull/26999#issuecomment-3247640930 From dholmes at openjdk.org Wed Sep 3 07:06:46 2025 From: dholmes at openjdk.org (David Holmes) Date: Wed, 3 Sep 2025 07:06:46 GMT Subject: RFR: 8328306: AArch64: MacOS lazy JIT "write xor execute" switching [v4] In-Reply-To: References: <3IdZZGAKHVuMXfeM10Z-VSDNlJmcu5XFilLQfEKb9OY=.5213f5ca-2bca-41eb-b7ce-7621510552be@github.com> Message-ID: <6Cc8PqkykKjVxXlBOyoEpX_MJgiqbqt93ljPtbDpZ2Y=.26f0f6de-ab9f-4e3d-a80c-7ddfa43aabf2@github.com> On Tue, 2 Sep 2025 11:03:33 GMT, Andrew Dinn wrote: >>> We change mode when we're _all but certain_ that we need to. That seems right to me. If the mode doesn't need changing because it's already set, that's OK. Why do you think this might be a problem? >> >> My concern is that if we have code that needs a specific mode, but it is not obvious at that piece of code that this is the case, then things will work fine if somewhere on the path to that code we set the right mode. But if we introduce a new path to that code that might not be the case and so we will introduce a new place where we switch modes. That can lead to redundancy. The whole thing (as it has from day one) seems ad-hoc. >> >> But if the proposed scheme performs better in general, and is not obviously "worse" from the ad-hoc perspective then ... > > @dholmes-ora I accept that this approach is not fully robust in the face of changes to the code base. However, in mitigation of that risk, the approach of targeting the major gateway calls that precede most subsequent code updates (e.g. creating an assembler instance) means that only a relatively small number of code paths which bypass those known gateways currently are, or will ever be, susceptible to such failure. > > Furthermore, weighed against that risk are 1) a mechanism we can use both to catch failures during testing and to avoid any danger when something escapes into production and 2) a significant gain in performance from avoiding (literally) millions of unnecessary transitions. > > I don't normally support pushing changes which are inherently fragile in the face of code updates. However, in this case I think the mechanisms in place to mitigate the risk and limit any damage and the performance gains to be had make it worth adopting. @adinn and @theRealAph in case it was not clear I am okay with this proceeding. I will leave the actual approvals to others who know the specific code locations better. Thanks for the discussion. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26562#issuecomment-3247952549 From mhaessig at openjdk.org Wed Sep 3 07:17:44 2025 From: mhaessig at openjdk.org (Manuel =?UTF-8?B?SMOkc3NpZw==?=) Date: Wed, 3 Sep 2025 07:17:44 GMT Subject: RFR: 8366461: Remove obsolete method handle invoke logic [v3] In-Reply-To: <_pqvEs0LIlAc7RjFUwg-bpxS3D2v5U7c6In2sG8XLhQ=.57e3aead-6ac4-4a42-89d2-385d7e6ecedf@github.com> References: <_pqvEs0LIlAc7RjFUwg-bpxS3D2v5U7c6In2sG8XLhQ=.57e3aead-6ac4-4a42-89d2-385d7e6ecedf@github.com> Message-ID: On Tue, 2 Sep 2025 20:52:32 GMT, Dean Long wrote: >> At one time, JSR292 support needed special logic to save and restore SP across method handle instrinsic calls, but that is no longer the case. The only platform that still does the save/restore is arm32, which is no longer necessary. The save/restore can be removed along with related APIs and logic. Note that the arm32 port is largely based on the x86 port, which stopped doing the save/restore in jdk9 ([JDK-8068945](https://bugs.openjdk.org/browse/JDK-8068945)). > > Dean Long has updated the pull request incrementally with three additional commits since the last revision: > > - revert whitespace change > - undo debug changes > - cleanup Thank you for cleaning this up, @dean-long. I just have a drive-by comment. src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/aarch64/AARCH64Frame.java line 372: > 370: // DEBUG_ONLY(verifyDeoptriginalPc(senderNm, raw_unextendedSp)); > 371: } > 372: } `Frame.java adjustUnextendedSP()` do not seem to do anything? Perhaps these could be cleaned up as well? ------------- PR Review: https://git.openjdk.org/jdk/pull/27059#pullrequestreview-3179245014 PR Review Comment: https://git.openjdk.org/jdk/pull/27059#discussion_r2317990499 From stefank at openjdk.org Wed Sep 3 07:18:48 2025 From: stefank at openjdk.org (Stefan Karlsson) Date: Wed, 3 Sep 2025 07:18:48 GMT Subject: RFR: 8366434: THP not working properly with G1 after JDK-8345655 In-Reply-To: References: Message-ID: <1z_yWIewPSSx_9qgtQCJM2L7iSXl-dKVYG7MWfsdDes=.034424cf-514f-4c79-96ec-418dc5fefe26@github.com> On Tue, 2 Sep 2025 13:53:13 GMT, Stefan Johansson wrote: > Please review this fix to enable transparent huge pages for G1, > > **Summary** > In [JDK-8345655](https://bugs.openjdk.org/browse/JDK-8345655) we refactored the memory reservation code to be more maintainable and easier to follow. When doing this one of the code paths changed to always pass in `os::vm_page_size()` where it previously had used a page size provided by the caller. > > Even if the alignment for `ReservedSpaces` created this way show that they should be aligned to support large pages the page size member for the `ReservedSpace` does not convey that we want large pages for the space. In G1 when using `G1PageBaseVirtualSpace` we use the above mentioned page size as the alignment for the reservation. This leads to reservations (made using the API) not being THP eligible even if `-XX:+UseTransparentHugePages` is specified. > > This is only an issue when the system is configured with the THP mode `madvise`. If the mode is `always`, we will get THP eligible reservations. So a fairly simple workaround for this issue (given you have access to configuring your system) is to configure the THP mode to always. > > The fix is to simply change back to the old behavior and pass in the user provided page size to the `ReservedSpace`. We've also added a test that verifies that we try to back the heap with transparent huge pages when `-XX:+UseTransparentHugePages` is specified on the command-line. > > **Testing** > * Mach5 testing tier1-tier5 > * Manual testing of the new test both locally and on mach5. Making sure it has been executed on system with both `madvise` and `always` configured. Also made sure the test actually failed without the fix. Marked as reviewed by stefank (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/27051#pullrequestreview-3179254656 From stefank at openjdk.org Wed Sep 3 07:31:44 2025 From: stefank at openjdk.org (Stefan Karlsson) Date: Wed, 3 Sep 2025 07:31:44 GMT Subject: RFR: 8300080: offset_of for GCC/Clang exhibits undefined behavior and is not always a compile-time constant In-Reply-To: References: Message-ID: <0T5Bpw4E7qu10pWz981nWwFgNet_sas0vPi4K5v70LU=.17e8d99a-3663-47ef-874b-1349bd919229@github.com> On Tue, 2 Sep 2025 23:25:43 GMT, Kim Barrett wrote: > Please review this change to offset_of to just use offsetof as it's > implementation. The rationale for this is > > (1) Despite being UB for some cases that we use (through C++14), none of the > compilers we use actually treat it as such, other than some compilers issuing > warnings. (Surprisingly, the UB doesn't appear to disable constexpr evaluation?) > > (2) C++17 changed it to be conditionally defined in those formerly UB cases, > and we'll be switching over to C++17 soon (JDK-8314488). > > Until we make the switch to C++17 we need to suppress warnings from some > compilers for such uses. We can remove that warning suppression later. > > See the JBS issue for more discussion. > > Testing: mach5 tier1 Nice. Is it worth pushing this so near the transition to compile with C++17 support? ------------- Marked as reviewed by stefank (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27061#pullrequestreview-3179298085 From jwaters at openjdk.org Wed Sep 3 08:23:55 2025 From: jwaters at openjdk.org (Julian Waters) Date: Wed, 3 Sep 2025 08:23:55 GMT Subject: Withdrawn: 8366699: Replace TestNoNULL with a simpler mechanism to forbid using NULL in HotSpot code In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 14:46:09 GMT, Julian Waters wrote: > TestNoNULL was introduced as a way to forbid using the raw NULL macro in HotSpot code. It works well, but a newer way to achieve the same result by poisoning the macro expansion itself would be more accurate given it could properly use the compiler's lexer and parser to detect NULL being introduced. Normally the way typically envisioned to poison macros by redefining them as an unusable sequence of tokens would be too strong and bleed over into third party code, but there is a way to do so in a controllable fashion. This proposes to implement a simple mechanism to replace TestNoNULL within HotSpot's source code itself, and retire TestNoNULL in favour of this new system. > > For Visual C++ this is simple, it contains support for using a pragma to poison a macro name, and poisoning a macro causes warnings when it is used. These warnings can be switched off by pragmas whenever we need them to be, making for a perfect disabling system when NULL is used in third party code. > > For the other 2 big compilers, there exists a similar pragma to disable using a macro, but it is too strong, and unlike Visual C++ is a compile error, meaning there is absolutely no way to turn it off whatsoever. Fortunately there is a simple trick one can leverage: Both compilers have a warning pragma that can be used in this case. All that has to be done is redefining the macro in question to expand into nullptr, but also expand into a pragma that contains this warning message. As for disabling it whenever third party code is around, both compilers conveniently have a push and pop macro pragma that can save and restore macro state, which they implemented for compatibility with Visual C++ and are handy for this purpose. Since redefining Standard header macros is not allowed in C++ we can instead target an implementation detail within the headers: NULL expands to __null, so we can define that as a macro for our purposes instead. > > Currently using GitHub Actions to test the changes, this is not the final state of the Pull Request. This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/27054 From shade at openjdk.org Wed Sep 3 08:54:43 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Wed, 3 Sep 2025 08:54:43 GMT Subject: RFR: 8366434: THP not working properly with G1 after JDK-8345655 In-Reply-To: References: Message-ID: <7omR7oA7xV-EybyZzMUBm1KismDS8zcmAiUz14WQK6g=.b822cecd-f75b-449f-b0ee-4051dd12b504@github.com> On Tue, 2 Sep 2025 13:53:13 GMT, Stefan Johansson wrote: > Please review this fix to enable transparent huge pages for G1, > > **Summary** > In [JDK-8345655](https://bugs.openjdk.org/browse/JDK-8345655) we refactored the memory reservation code to be more maintainable and easier to follow. When doing this one of the code paths changed to always pass in `os::vm_page_size()` where it previously had used a page size provided by the caller. > > Even if the alignment for `ReservedSpaces` created this way show that they should be aligned to support large pages the page size member for the `ReservedSpace` does not convey that we want large pages for the space. In G1 when using `G1PageBaseVirtualSpace` we use the above mentioned page size as the alignment for the reservation. This leads to reservations (made using the API) not being THP eligible even if `-XX:+UseTransparentHugePages` is specified. > > This is only an issue when the system is configured with the THP mode `madvise`. If the mode is `always`, we will get THP eligible reservations. So a fairly simple workaround for this issue (given you have access to configuring your system) is to configure the THP mode to always. > > The fix is to simply change back to the old behavior and pass in the user provided page size to the `ReservedSpace`. We've also added a test that verifies that we try to back the heap with transparent huge pages when `-XX:+UseTransparentHugePages` is specified on the command-line. > > **Testing** > * Mach5 testing tier1-tier5 > * Manual testing of the new test both locally and on mach5. Making sure it has been executed on system with both `madvise` and `always` configured. Also made sure the test actually failed without the fix. Marked as reviewed by shade (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/27051#pullrequestreview-3179634396 From jsjolen at openjdk.org Wed Sep 3 09:12:44 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Wed, 3 Sep 2025 09:12:44 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v12] In-Reply-To: References: Message-ID: > Hi, > > The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. Johan Sj?len has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 16 commits: - Merge remote-tracking branch 'openjdk/master' into cleanup-membaseline - Rename to _vma_allocations - After a lot of casting - Yup - Some more ugly casts - Aha, _root is typed as an IntrusiveRBNode - Aha, missing include - Wait, the VMATree is wrong? - Rename - It's const - ... and 6 more: https://git.openjdk.org/jdk/compare/6dda2f6f...82df750b ------------- Changes: https://git.openjdk.org/jdk/pull/27003/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27003&range=11 Stats: 226 lines in 11 files changed: 161 ins; 44 del; 21 mod Patch: https://git.openjdk.org/jdk/pull/27003.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27003/head:pull/27003 PR: https://git.openjdk.org/jdk/pull/27003 From jsjolen at openjdk.org Wed Sep 3 09:18:51 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Wed, 3 Sep 2025 09:18:51 GMT Subject: RFR: 8366363: MemBaseline accesses VMT without using lock [v12] In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 09:12:44 GMT, Johan Sj?len wrote: >> Hi, >> >> The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead. > > Johan Sj?len has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 16 commits: > > - Merge remote-tracking branch 'openjdk/master' into cleanup-membaseline > - Rename to _vma_allocations > - After a lot of casting > - Yup > - Some more ugly casts > - Aha, _root is typed as an IntrusiveRBNode > - Aha, missing include > - Wait, the VMATree is wrong? > - Rename > - It's const > - ... and 6 more: https://git.openjdk.org/jdk/compare/6dda2f6f...82df750b GHA is a bit borked. >Error: Failed to resolve action download info. Error: Failed to resolve action download info. I re-ran the failed tests of the previous GHA run on my local instance and those tests did not fail. Not sure if it was a fluke, or if we have an actual issue. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27003#issuecomment-3248401792 From duke at openjdk.org Wed Sep 3 09:42:17 2025 From: duke at openjdk.org (Francesco Andreuzzi) Date: Wed, 3 Sep 2025 09:42:17 GMT Subject: RFR: 8366778: Sort share/asm, share/gc, share/include includes Message-ID: Sort includes in `share/gc`, `share/asm`, `share/include` using `SortIncludes.java`, and remove some unnecessary ones. These are the last missing modules in `hotspot/share`. Passes `tier1`. ------------- Commit messages: - sort Changes: https://git.openjdk.org/jdk/pull/27067/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27067&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8366778 Stats: 40 lines in 15 files changed: 6 ins; 33 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/27067.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27067/head:pull/27067 PR: https://git.openjdk.org/jdk/pull/27067 From aboldtch at openjdk.org Wed Sep 3 09:51:45 2025 From: aboldtch at openjdk.org (Axel Boldt-Christmas) Date: Wed, 3 Sep 2025 09:51:45 GMT Subject: RFR: 8365190: Remove LockingMode related code from share In-Reply-To: <4pmrLv9G-kotkKQ_B1wEyXSAJ9Vm3cnxditElz641_E=.23c81f11-ece2-4894-ae2f-8763ad343a4d@github.com> References: <4pmrLv9G-kotkKQ_B1wEyXSAJ9Vm3cnxditElz641_E=.23c81f11-ece2-4894-ae2f-8763ad343a4d@github.com> Message-ID: <0CMB0g0_Ru1hF5l2NA194kD1ouNwMXrB1667Uvl9mFQ=.b6834c47-be53-41bb-b726-2e282517d6bc@github.com> On Tue, 2 Sep 2025 08:24:10 GMT, Fredrik Bredberg wrote: > Since the integration of [JDK-8359437](https://bugs.openjdk.org/browse/JDK-8359437) the `LockingMode` flag can no longer be set by the user. After that, a number of PRs has been integrated which has removed all `LockingMode` related code from all platforms (except from zero, which is done in this PR). > > This PR removes `LockingMode` related code from the shared (non-platform specific) files. It also removes the `LockingMode` variable itself. > > Passes tier1-tier5 with no added problems. Nothing obvious seems to be missing from the removal. And the changes look correct. As @coleenp already mentioned there is even more code now that is effectively unused. Mostly to do with legacy + loom interactions. But I think it is fine to remove that in a follow up RFE. Similarly there are some nomenclature that should be updated, but I know you have expressed wanting to do that in a follow up RFE as well. I think it the main refactoring that are left are cleaning up the Synchronizer APIs, unifying some functions etc. _As for unifying LightweightSynchronizer with the ObjectSynchronizer, there might be an opportunity to let ObjectSynchronizer define the general API used by the rest of the VM to interact with the locking subsystem. And let LightweightSynchronizer contain all of the implementation. This could including moving the locking specific implementation details of relocking, deopting etc. behind an interface, decoupling them, and avoiding leaking implementation._ src/hotspot/share/runtime/basicLock.hpp line 51: > 49: void set_bad_metadata_deopt() { set_metadata(badDispHeaderDeopt); } > 50: > 51: static int displaced_header_offset_in_bytes() { return metadata_offset_in_bytes(); } The `badDispHeaderDeopt` and `badDispHeaderOSR` constants should also be renamed. src/hotspot/share/runtime/synchronizer.cpp line 634: > 632: } > 633: > 634: static intptr_t install_hash_code(Thread* current, oop obj) { A future RFE could potentially simplify and unify this with `FastHashCode` ------------- Marked as reviewed by aboldtch (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27041#pullrequestreview-3179315618 PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2318059361 PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2318041555 From shade at openjdk.org Wed Sep 3 10:10:42 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Wed, 3 Sep 2025 10:10:42 GMT Subject: RFR: 8366778: Sort share/asm, share/gc, share/include includes In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 09:35:24 GMT, Francesco Andreuzzi wrote: > These are the last missing modules in hotspot/share. ? . Onto `cpu/`, `os/` and `os_cpu/`, I guess? ------------- Marked as reviewed by shade (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27067#pullrequestreview-3179930639 From duke at openjdk.org Wed Sep 3 10:13:44 2025 From: duke at openjdk.org (Francesco Andreuzzi) Date: Wed, 3 Sep 2025 10:13:44 GMT Subject: RFR: 8366778: Sort share/asm, share/gc, share/include includes In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 10:08:27 GMT, Aleksey Shipilev wrote: > > These are the last missing modules in hotspot/share. > > ? . Onto `cpu/`, `os/` and `os_cpu/`, I guess? ?? ------------- PR Comment: https://git.openjdk.org/jdk/pull/27067#issuecomment-3248602850 From qpzhang at openjdk.org Wed Sep 3 10:15:46 2025 From: qpzhang at openjdk.org (Patrick Zhang) Date: Wed, 3 Sep 2025 10:15:46 GMT Subject: RFR: 8365991: AArch64: Ignore BlockZeroingLowLimit when UseBlockZeroing is false [v3] In-Reply-To: References: Message-ID: > In AArch64 port, `UseBlockZeroing` is by default set to true and `BlockZeroingLowLimit` is initialized to 256. If `DC ZVA` is supported, `BlockZeroingLowLimit` is later updated to `4 * VM_Version::zva_length()`. When `UseBlockZeroing` is set to false, all related conditional checks should ignore `BlockZeroingLowLimit`. However, the function `MacroAssembler::zero_words(Register base, uint64_t cnt)` still evaluates the lower limit and bases its code generation logic on it, which appears to be an incomplete conditional check. > > This PR, > 1. In `MacroAssembler::zero_words(Register base, uint64_t cnt)`, added the checking of `UseBlockZeroing` to the if-cond `cnt > (uint64_t)BlockZeroingLowLimit / BytesPerWord`, strengthened the condition. > 2. In `MacroAssembler::zero_words(Register ptr, Register cnt)`, check `UseBlockZeroing` before checking the conditions of calling the stub function `zero_blocks`, which wraps the `DC ZVA` related instructions and works as the inner part of `zero_words`. Refined code and comments. > 3. For `generate_zero_blocks()`, removed the `UseBlockZeroing` checking and added an assertion, moved unrolled `STP` code-gen out to the caller side > 4. Added a warning message for if UseBlockZeroing is false and BlockZeroingLowLimit gets manually configured. > 5. Added more testing sizes to test/micro/org/openjdk/bench/vm/gc/RawAllocationRate.java > > These changes improved the if-conds in `zero_words` functions around `BlockZeroingLowLimit`, ignore it if `UseBlockZeroing` is false. Performance tests are done on the bundled JMH `vm.compiler.ClearMemory`, and `vm.gc.RawAllocationRate` including `arrayTest` and `instanceTest`. > > Tests include, > 1. The wall time of `zero_words_reg_imm` got significantly improved under a particularly designed test case: `-XX:-UseBlockZeroing -XX:BlockZeroingLowLimit=8`, `size=32` (`arrayTest` and `instanceTest`), the average wall time per call dropped from 309 ns (baseline) to 65 ns (patched), about -80%. The average call count also decreased from 335 to 202, in a 30s run. For example, `jdk/bin/java -jar images/test/micro/benchmarks.jar RawAllocationRate.arrayTest_C1 -bm thrpt -gc false -wi 0 -w 30 -i 1 -r 30 -t 1 -f 1 -tu s -jvmArgs "-XX:-UseBlockZeroing -XX:BlockZeroingLowLimit=8" -p size=32`. > 2. `JMH RawAllocationRate` shows no obvious regression results. In details, patched vs baseline shows average ~70% positive impact, but ratios are minor around +0.5%, since the generated instruction sequences got almost same as baseline, ... Patrick Zhang has updated the pull request incrementally with one additional commit since the last revision: Reset BlockZeroingLowLimit to 4 * _zva_length Signed-off-by: Patrick Zhang ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26917/files - new: https://git.openjdk.org/jdk/pull/26917/files/14c18f7f..22e72f49 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26917&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26917&range=01-02 Stats: 8 lines in 2 files changed: 6 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/26917.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26917/head:pull/26917 PR: https://git.openjdk.org/jdk/pull/26917 From ayang at openjdk.org Wed Sep 3 10:16:44 2025 From: ayang at openjdk.org (Albert Mingkun Yang) Date: Wed, 3 Sep 2025 10:16:44 GMT Subject: RFR: 8366778: Sort share/asm, share/gc, share/include includes In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 09:35:24 GMT, Francesco Andreuzzi wrote: > Sort includes in `share/gc`, `share/asm`, `share/include` using `SortIncludes.java`, and remove some unnecessary ones. These are the last missing modules in `hotspot/share`. > > Passes `tier1`. Marked as reviewed by ayang (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/27067#pullrequestreview-3179952589 From qpzhang at openjdk.org Wed Sep 3 10:30:42 2025 From: qpzhang at openjdk.org (Patrick Zhang) Date: Wed, 3 Sep 2025 10:30:42 GMT Subject: RFR: 8365991: AArch64: Ignore BlockZeroingLowLimit when UseBlockZeroing is false [v2] In-Reply-To: References: <79QlFmmh7CAbxtU89RNVbf8sRBE_u8TbDLA90FqWyEM=.4e8b48ac-21b5-4881-9ca0-29bc87bfe032@github.com> Message-ID: On Mon, 1 Sep 2025 10:11:49 GMT, Andrew Haley wrote: > To begin with, please add this short patch, then see if any of this PR provides an advantage. > > ``` > > diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp > index 9321dd0542e..14a584c5106 100644 > --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp > +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp > @@ -446,6 +446,11 @@ void VM_Version::initialize() { > FLAG_SET_DEFAULT(UseBlockZeroing, false); > } > > + if (!UseBlockZeroing && !FLAG_IS_DEFAULT(BlockZeroingLowLimit)) { > + warning("BlockZeroingLowLimit has been ignored because UseBlockZeroing is disabled"); > + FLAG_SET_DEFAULT(BlockZeroingLowLimit, 4 * VM_Version::zva_length()); > + } > + > if (VM_Version::supports_sve2()) { > if (FLAG_IS_DEFAULT(UseSVE)) { > FLAG_SET_DEFAULT(UseSVE, 2); > ``` Thanks for advice. Updated accordingly (commit 3 vs 2: https://github.com/openjdk/jdk/pull/26917/commits/22e72f49e82cc7febbcd44b01636f8cbdeaa4cca) to keep the shape of the generated code as unchanged as possible. My test case with `-XX:-UseBlockZeroing -XX:BlockZeroingLowLimit=8, size=32` also works as expected. I added some comments to better clarify the purpose of the if-condition inside the `zero_words` function to avoid future confusion upon. Please help review, thanks. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26917#issuecomment-3248661050 From mli at openjdk.org Wed Sep 3 10:56:44 2025 From: mli at openjdk.org (Hamlin Li) Date: Wed, 3 Sep 2025 10:56:44 GMT Subject: RFR: 8360000: RISC-V: implement aot [v5] In-Reply-To: References: <89lrKCDzl1QDpDGEMkE6WsdE9P7O4F6RrqEU02lZ9ZA=.c354663f-0cc0-472e-87ab-4954812c1384@github.com> Message-ID: <4iev5X4kwt8w8pis8dXsv2CcEYYH8_ZP5ajorpnT8Es=.2d2585ec-4701-41a5-9e62-c5a7d84b905f@github.com> On Mon, 14 Jul 2025 11:46:22 GMT, Hamlin Li wrote: >> Hi, >> Can you help to review this patch? >> >> https://openjdk.org/jeps/483 introduced aot (class loading/linking) and subsequent prs introduced more features related to it, like preserve adapters(c2i/i2c) and runtime blobs in AOT code cache. >> >> Riscv should support these features and resolve relative issues. >> >> ## Test >> >> ### jtreg >> >> run tier1/2/3 and hotspot_cds tests, no new failure found compared to master jdk. >> >> ### Performance >> >> perf command to run the simplest Hello world java program: >> * (perf stat -r 100 ${JAVA_HOME}/bin/java -XX:AOTCache=$AOT_CACHE -cp $CLASS_PATH Hello > /dev/null) 2>&1 | grep elapsed >> >> perf data: >> * (with patch): 0.181730 +- 0.000296 seconds time elapsed ( +- 0.16% ) >> * (without patch): 0.196627 +- 0.000227 seconds time elapsed ( +- 0.12% ) >> >> Thanks > > Hamlin Li has updated the pull request incrementally with one additional commit since the last revision: > > minor Latest patch based on leyden/premain works well, I'll wait for https://github.com/openjdk/jdk/pull/23573, https://github.com/openjdk/jdk/pull/26944 pushed in. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26101#issuecomment-3248740399 From jsikstro at openjdk.org Wed Sep 3 11:11:48 2025 From: jsikstro at openjdk.org (Joel =?UTF-8?B?U2lrc3Ryw7Zt?=) Date: Wed, 3 Sep 2025 11:11:48 GMT Subject: RFR: 8366778: Sort share/asm, share/gc, share/include includes In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 09:35:24 GMT, Francesco Andreuzzi wrote: > Sort includes in `share/gc`, `share/asm`, `share/include` using `SortIncludes.java`, and remove some unnecessary ones. These are the last missing modules in `hotspot/share`. > > Passes `tier1`. Marked as reviewed by jsikstro (Committer). ------------- PR Review: https://git.openjdk.org/jdk/pull/27067#pullrequestreview-3180144068 From coleenp at openjdk.org Wed Sep 3 11:36:46 2025 From: coleenp at openjdk.org (Coleen Phillimore) Date: Wed, 3 Sep 2025 11:36:46 GMT Subject: RFR: 8277444: Data race between JvmtiClassFileReconstituter::copy_bytecodes and class linking [v5] In-Reply-To: References: Message-ID: <8gZJSnHgfc8RwLlaObVBXJ7ubs9mI1MDq3ZL8ZbuQ9Q=.1f08be90-5896-4620-aed7-f7f81958beae@github.com> On Tue, 2 Sep 2025 21:45:03 GMT, Evgeny Astigeevich wrote: >> There is a race between `JvmtiClassFileReconstituter::copy_bytecodes` and `InstanceKlass::link_class_impl`. `InstanceKlass::link_class_impl` can be rewriting bytecodes. `JvmtiClassFileReconstituter::copy_bytecodes` will not restore them to the original ones because the flag `rewritten` is `false`. This will result in invalid bytecode. >> >> This PR adds linking a class before the `copy_bytecodes` method is called. >> The PR also adds a regression test. >> >> Tested fastdebug and release builds: Linux x86_64 and arm64 >> - The reproducer from JDK-8277444 passed. >> - The regression test passed. >> - Tier1 - tier3 passed. > > Evgeny Astigeevich has updated the pull request incrementally with one additional commit since the last revision: > > Switch to macros HAS_PENDING_EXCEPTION, CLEAR_PENDING_EXCEPTION This looks good now. Thank you for your patience while we found the right solution. ------------- Marked as reviewed by coleenp (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26863#pullrequestreview-3180219072 From coleenp at openjdk.org Wed Sep 3 11:41:44 2025 From: coleenp at openjdk.org (Coleen Phillimore) Date: Wed, 3 Sep 2025 11:41:44 GMT Subject: RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* [v3] In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 21:08:25 GMT, Ioi Lam wrote: >> By adding an `InstanceKlass* InstanceKlass::super()` method to shadow `Klass* Klass:super()`, this PR makes it possible to simplify the following code >> >> >> InstanceKlass* ik; >> InstanceKlass* s; >> s = InstanceKlass::cast(ik->super()); // before JDK-8366024 >> s = ik->java_super(); // after JDK-8366024 >> >> >> to >> >> >> s = k->super(); >> >> >> So you no longer need to do casting or need to understand what `java_super()` is. > > Ioi Lam has updated the pull request incrementally with one additional commit since the last revision: > > @dholmes-ora and @coleep comments Looks good. This will help with InstanceKlass casting. ------------- Marked as reviewed by coleenp (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27037#pullrequestreview-3180231376 From jsjolen at openjdk.org Wed Sep 3 12:20:41 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Wed, 3 Sep 2025 12:20:41 GMT Subject: RFR: 8300080: offset_of for GCC/Clang exhibits undefined behavior and is not always a compile-time constant In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 23:25:43 GMT, Kim Barrett wrote: > Please review this change to offset_of to just use offsetof as it's > implementation. The rationale for this is > > (1) Despite being UB for some cases that we use (through C++14), none of the > compilers we use actually treat it as such, other than some compilers issuing > warnings. (Surprisingly, the UB doesn't appear to disable constexpr evaluation?) > > (2) C++17 changed it to be conditionally defined in those formerly UB cases, > and we'll be switching over to C++17 soon (JDK-8314488). > > Until we make the switch to C++17 we need to suppress warnings from some > compilers for such uses. We can remove that warning suppression later. > > See the JBS issue for more discussion. > > Testing: mach5 tier1 Seems good to me. As Stefan hints at, maybe it's worth waiting until C++17 integration and then simplify the PR to only change the macro? ------------- Marked as reviewed by jsjolen (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27061#pullrequestreview-3180362344 From jsjolen at openjdk.org Wed Sep 3 12:21:46 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Wed, 3 Sep 2025 12:21:46 GMT Subject: RFR: 8366238: Improve RBTree API with stricter comparator semantics and pluggable validation/printing hooks. [v4] In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 13:40:28 GMT, Casper Norrbin wrote: >> Hi everyone, >> >> The current red-black tree can be made safer, and its inspection capabilities improved. >> >> As briefly discussed in #26904, `COMPARATOR::cmp` could be made clearer and more robust. In particular, its `int` return type invites unsafe `return a ? b` arithmetic, and the boolean validation function also named `cmp` is misleading. >> >> To address this, I?ve introduced the `RBTreeOrdering` enum, inspired by C++20?s `<=>`, which makes incorrect arithmetic impossible. The return type of `COMPARATOR::cmp` is now this enum, forcing users to write an explicit and safe comparison. From the discussion in that PR, I have also renamed the boolean `cmp` to `less`, making its purpose obvious and preventing confusion between the two functions. >> >> Inspection has also been improved, especially for intrusive trees. Previously, `verify_self` only verified core RB-tree properties, yet intrusive nodes often hold additional data with their own separate invariants. Users had to perform those checks in a second traversal, and if an error occurs `print_on` produced little diagnostic value by only printing node addresses. >> >> To solve this, the tree now accepts user-supplied verification and printing callables. This lets users validate their custom node data during the same walk and print richer information when errors occur. >> >> Everything is implemented via template parameters with set defaults, so existing code remains unchanged while new code can opt in to the expanded functionality. >> >> Testing: >> - Oracle tiers 1-3 > > Casper Norrbin has updated the pull request incrementally with one additional commit since the last revision: > > johan feedback Marked as reviewed by jsjolen (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/26981#pullrequestreview-3180371207 From jsjolen at openjdk.org Wed Sep 3 12:23:42 2025 From: jsjolen at openjdk.org (Johan =?UTF-8?B?U2rDtmxlbg==?=) Date: Wed, 3 Sep 2025 12:23:42 GMT Subject: RFR: 8366057: HotSpot Style Guide should permit trailing return types In-Reply-To: References: Message-ID: On Mon, 25 Aug 2025 10:07:00 GMT, Kim Barrett wrote: > Please review this change to the HotSpot Style Guide to permit trailing return > types for functions. > > This is a modification of the Style Guide, so rough consensus among the > HotSpot Group members is required to make this change. Only Group members > should vote for approval (via the github PR), though reasoned objections or > comments from anyone will be considered. A decision on this proposal will not > be made before Monday 8-September-2025 at 12h00 UTC. > > Since we're piggybacking on github PRs here, please use the PR review process > to approve (click on Review Changes > Approve), rather than sending a "vote: > yes" email reply that would be normal for a CFV. Marked as reviewed by jsjolen (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/26923#pullrequestreview-3180377406 From stuefe at openjdk.org Wed Sep 3 14:02:46 2025 From: stuefe at openjdk.org (Thomas Stuefe) Date: Wed, 3 Sep 2025 14:02:46 GMT Subject: RFR: 8364735: [asan] heap-use-after-free error detected in defaultStream::writer during VM shutdown [v2] In-Reply-To: References: <3TJnBvDoAPUf4p2e8Y0vpckfm3v8e31cKKwfOeyRnnM=.34c016f4-419d-4dd6-9102-b112a7423f7b@github.com> Message-ID: <9MccMrhJLB1DC6NP_9aYvnC9EhwqW_iko5Cxdbfxn_k=.4e1db66e-3ffb-4162-a3de-d17169212159@github.com> On Fri, 29 Aug 2025 01:02:43 GMT, David Holmes wrote: >> `ostream_exit` was deleting the stream underlying the `xtty` prior to nulling the `xtty` global variable, resulting in a use-after-free-error. Due to races during VM shutdown we cannot make use of `xtty` perfectly safe, but we can certainly narrow the window during which use-after-free is possible. >> >> Testing: >> - tiers 1-3 sanity >> >> Thanks > > David Holmes has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision: > > - Merge branch 'master' into 8364735-xtty > - 8364735: [asan] heap-use-after-free error detected in defaultStream::writer during VM shutdown I still am not sure how the OrderAccess helps. A concurrent thread can see xtty != null and start printing while the terminating thread deletes the defaultStream under xtty? Sorry if I am slow. ------------- PR Review: https://git.openjdk.org/jdk/pull/26832#pullrequestreview-3180819270 From vaivanov at openjdk.org Wed Sep 3 15:46:44 2025 From: vaivanov at openjdk.org (Vladimir Ivanov) Date: Wed, 3 Sep 2025 15:46:44 GMT Subject: RFR: 8363858: [perf] OptimizeFill may use wide set of intrinsics In-Reply-To: References: Message-ID: On Wed, 27 Aug 2025 23:56:40 GMT, Vladimir Ivanov wrote: > Default mode should use OptimizeFill=true option for the SRF platform. Thanks for your review! ------------- PR Comment: https://git.openjdk.org/jdk/pull/26974#issuecomment-3249784805 From duke at openjdk.org Wed Sep 3 15:46:44 2025 From: duke at openjdk.org (duke) Date: Wed, 3 Sep 2025 15:46:44 GMT Subject: RFR: 8363858: [perf] OptimizeFill may use wide set of intrinsics In-Reply-To: References: Message-ID: On Wed, 27 Aug 2025 23:56:40 GMT, Vladimir Ivanov wrote: > Default mode should use OptimizeFill=true option for the SRF platform. @IvaVladimir Your change (at version 8fca1903b9669d50c77a9fc895c44d303ddfd95d) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26974#issuecomment-3249787470 From lmesnik at openjdk.org Wed Sep 3 15:49:44 2025 From: lmesnik at openjdk.org (Leonid Mesnik) Date: Wed, 3 Sep 2025 15:49:44 GMT Subject: RFR: 8365190: Remove LockingMode related code from share In-Reply-To: <4pmrLv9G-kotkKQ_B1wEyXSAJ9Vm3cnxditElz641_E=.23c81f11-ece2-4894-ae2f-8763ad343a4d@github.com> References: <4pmrLv9G-kotkKQ_B1wEyXSAJ9Vm3cnxditElz641_E=.23c81f11-ece2-4894-ae2f-8763ad343a4d@github.com> Message-ID: On Tue, 2 Sep 2025 08:24:10 GMT, Fredrik Bredberg wrote: > Since the integration of [JDK-8359437](https://bugs.openjdk.org/browse/JDK-8359437) the `LockingMode` flag can no longer be set by the user. After that, a number of PRs has been integrated which has removed all `LockingMode` related code from all platforms (except from zero, which is done in this PR). > > This PR removes `LockingMode` related code from the shared (non-platform specific) files. It also removes the `LockingMode` variable itself. > > Passes tier1-tier5 with no added problems. svc part looks good. ------------- Marked as reviewed by lmesnik (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27041#pullrequestreview-3181274100 From duke at openjdk.org Wed Sep 3 15:54:22 2025 From: duke at openjdk.org (pf0n) Date: Wed, 3 Sep 2025 15:54:22 GMT Subject: RFR: 8366122: Shenandoah: Implement efficient support for object count after gc events Message-ID: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> ### Summary The new implementation of ObjectCountAfterGC for Shenandoah piggybacks off of the existing marking phases and records strongly marked objects in a histogram. If the event is disabled, the original marking closures are used. When enabled new mark-and-count closures are used by the worker threads. Each worker thread updates its local histogram as it marks an object. These local histograms are merged at the conclusion of the marking phase under a mutex. The event is emitted outside a safepoint. Because (most) Shenandoah's marking is done concurrently, so is the object counting work. ### Performance The performance test were ran using the Extremem benchmark on a default and stress workload. (will edit this section to include data after average time and test for GenShen) #### Default workload: ObjectCountAfterGC disabled (master branch): `[807.216s][info][gc,stats ] Pause Init Mark (G) = 0.003 s (a = 264 us)` `[807.216s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 91 us)` `[807.216s][info][gc,stats ] Concurrent Mark Roots = 0.041 s (a = 4099 us)` `[807.216s][info][gc,stats ] Concurrent Marking = 1.660 s (a = 166035 us)` `[807.216s][info][gc,stats ] Pause Final Mark (G) = 0.004 s (a = 446 us) ` `[807.216s][info][gc,stats ] Pause Final Mark (G) = 0.004 s (a = 446 us) ` `[807.216s][info][gc,stats ] Pause Final Mark (N) = 0.004 s (a = 357 us)` ObjectCountAfterGC disabled (feature branch): `[807.104s][info][gc,stats ] Pause Init Mark (G) = 0.003 s (a = 302 us)` `[807.104s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 92 us) ` `[807.104s][info][gc,stats ] Concurrent Mark Roots = 0.048 s (a = 4827 us)` `[807.104s][info][gc,stats ] Concurrent Marking = 1.666 s (a = 166638 us) ` `[807.104s][info][gc,stats ] Pause Final Mark (G) = 0.006 s (a = 603 us)` `[807.104s][info][gc,stats ] Pause Final Mark (N) = 0.005 s (a = 516 us)` ObjectCountAfterGC enabled (feature branch) `[807.299s][info][gc,stats ] Pause Init Mark (G) = 0.002 s (a = 227 us)` `[807.299s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 89 us) ` `[807.299s][info][gc,stats ] Concurrent Mark Roots = 0.053 s (a = 5279 us)` `[807.299s][info][gc,stats ] Concurrent Marking = 1.676 s (a = 167595 us)` `[807.299s][info][gc,stats ] Pause Final Mark (G) = 0.005 s (a = 537 us)` `[807.299s][info][gc,stats ] Pause Final Mark (N) = 0.004 s (a = 430 us)` #### Stress workload: ObjectCountAfterGC disabled (master branch): `[1213.361s][info][gc,stats ] Pause Init Mark (G) = 0.023 s (a = 232 us)` `[1213.361s][info][gc,stats ] Pause Init Mark (N) = 0.009 s (a = 85 us)` `[1213.361s][info][gc,stats ] Concurrent Mark Roots = 0.252 s (a = 2521 us)` `[1213.361s][info][gc,stats ] Concurrent Marking = 17.635 s (a = 176354 us) ` `[1213.361s][info][gc,stats ] Pause Final Mark (G) = 0.065 s (a = 651 us)` `[1213.361s][info][gc,stats ] Pause Final Mark (N) = 0.049 s (a = 493 us)` ObjectCountAfterGC disabled (feature branch): `[1213.626s][info][gc,stats ] Pause Init Mark (G) = 0.023 s (a = 234 us)` `[1213.626s][info][gc,stats ] Pause Init Mark (N) = 0.009 s (a = 86 us)` `[1213.626s][info][gc,stats ] Concurrent Mark Roots = 0.265 s (a = 2645 us)` `[1213.626s][info][gc,stats ] Concurrent Marking = 17.747 s (a = 177468 us)` `[1213.626s][info][gc,stats ] Pause Final Mark (G) = 0.043 s (a = 431 us)` `[1213.626s][info][gc,stats ] Pause Final Mark (N) = 0.036 s (a = 362 us)` ObjectCountAfterGC enabled (feature branch): `[1213.699s][info][gc,stats ] Pause Init Mark (G) = 0.020 s (a = 202 us) ` `[1213.699s][info][gc,stats ] Pause Init Mark (N) = 0.008 s (a = 83 us)` `[1213.699s][info][gc,stats ] Concurrent Mark Roots = 0.340 s (a = 3404 us)` `[1213.699s][info][gc,stats ] Concurrent Marking = 17.929 s (a = 179289 us)` `[1213.699s][info][gc,stats ] Pause Final Mark (G) = 0.049 s (a = 492 us)` `[1213.699s][info][gc,stats ] Pause Final Mark (N) = 0.040 s (a = 405 us)` ### Testing Tested changes with GHA, jtreg tier1 JFR, and hotspot_gc. CodePipeline internal perf and stress test succeeded. ------------- Commit messages: - Changed comment, included another guard - Removing whitespace - Merge master - Merge master - Merge branch 'master' of https://github.com/openjdk/jdk into test/shen-aggregate-closure - Comment on why return value was changed to bool - Deleted objectCountEventSender.inline.hpp - Merging master - Reverting changes back to original state for some files - Merge branch '8366122/shen-object-count-after-gc' into test/shen-aggregate-closure - ... and 121 more: https://git.openjdk.org/jdk/compare/efb81daf...9552c62b Changes: https://git.openjdk.org/jdk/pull/26977/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26977&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8366122 Stats: 307 lines in 24 files changed: 252 ins; 28 del; 27 mod Patch: https://git.openjdk.org/jdk/pull/26977.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26977/head:pull/26977 PR: https://git.openjdk.org/jdk/pull/26977 From kdnilsen at openjdk.org Wed Sep 3 15:54:22 2025 From: kdnilsen at openjdk.org (Kelvin Nilsen) Date: Wed, 3 Sep 2025 15:54:22 GMT Subject: RFR: 8366122: Shenandoah: Implement efficient support for object count after gc events In-Reply-To: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> References: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> Message-ID: On Thu, 28 Aug 2025 01:30:39 GMT, pf0n wrote: > ### Summary > > The new implementation of ObjectCountAfterGC for Shenandoah piggybacks off of the existing marking phases and records strongly marked objects in a histogram. If the event is disabled, the original marking closures are used. When enabled new mark-and-count closures are used by the worker threads. Each worker thread updates its local histogram as it marks an object. These local histograms are merged at the conclusion of the marking phase under a mutex. The event is emitted outside a safepoint. Because (most) Shenandoah's marking is done concurrently, so is the object counting work. > > ### Performance > The performance test were ran using the Extremem benchmark on a default and stress workload. (will edit this section to include data after average time and test for GenShen) > > #### Default workload: > ObjectCountAfterGC disabled (master branch): > `[807.216s][info][gc,stats ] Pause Init Mark (G) = 0.003 s (a = 264 us)` > `[807.216s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 91 us)` > `[807.216s][info][gc,stats ] Concurrent Mark Roots = 0.041 s (a = 4099 us)` > `[807.216s][info][gc,stats ] Concurrent Marking = 1.660 s (a = 166035 us)` > `[807.216s][info][gc,stats ] Pause Final Mark (G) = 0.004 s (a = 446 us) ` > `[807.216s][info][gc,stats ] Pause Final Mark (G) = 0.004 s (a = 446 us) ` > `[807.216s][info][gc,stats ] Pause Final Mark (N) = 0.004 s (a = 357 us)` > > ObjectCountAfterGC disabled (feature branch): > `[807.104s][info][gc,stats ] Pause Init Mark (G) = 0.003 s (a = 302 us)` > `[807.104s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 92 us) ` > `[807.104s][info][gc,stats ] Concurrent Mark Roots = 0.048 s (a = 4827 us)` > `[807.104s][info][gc,stats ] Concurrent Marking = 1.666 s (a = 166638 us) ` > `[807.104s][info][gc,stats ] Pause Final Mark (G) = 0.006 s (a = 603 us)` > `[807.104s][info][gc,stats ] Pause Final Mark (N) = 0.005 s (a = 516 us)` > > ObjectCountAfterGC enabled (feature branch) > `[807.299s][info][gc,stats ] Pause Init Mark (G) = 0.002 s (a = 227 us)` > `[807.299s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 89 us) ` > `[807.299s][info][gc,stats ] Concurrent Mark Roots = 0.053 s (a = 5279 us)` > `[807.299s][info][gc,st... I concur with comments by Ramki. Also, I wonder if you can add to the summary overview a description of how much additional memory is required to enable concurrent object counting. I believe there is a new thread-local table (how large is this?) for each GC worker thread. I think service threads do not need this table. Can you clarify? The performance numbers quoted in the performance summary above are for Shennadoah satb mode, or for generational mode? Maybe both should be reported. src/hotspot/share/gc/shared/gcTrace.inline.hpp line 12: > 10: > 11: // The ObjectCountEventSenderClosure will determine if only the ObjectCount > 12: // event will be emitted instead of ObjectCountAfterGC. If false, then both If "what" is false? This comment is not clear. Are you speaking of the SeparateEventEmission template parameter? I think the use of future-tense "will" also makes this comment confusing. Can you write this in present tense? ------------- PR Review: https://git.openjdk.org/jdk/pull/26977#pullrequestreview-3166929412 PR Comment: https://git.openjdk.org/jdk/pull/26977#issuecomment-3235270167 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2308805732 From wkemper at openjdk.org Wed Sep 3 15:54:23 2025 From: wkemper at openjdk.org (William Kemper) Date: Wed, 3 Sep 2025 15:54:23 GMT Subject: RFR: 8366122: Shenandoah: Implement efficient support for object count after gc events In-Reply-To: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> References: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> Message-ID: On Thu, 28 Aug 2025 01:30:39 GMT, pf0n wrote: > ### Summary > > The new implementation of ObjectCountAfterGC for Shenandoah piggybacks off of the existing marking phases and records strongly marked objects in a histogram. If the event is disabled, the original marking closures are used. When enabled new mark-and-count closures are used by the worker threads. Each worker thread updates its local histogram as it marks an object. These local histograms are merged at the conclusion of the marking phase under a mutex. The event is emitted outside a safepoint. Because (most) Shenandoah's marking is done concurrently, so is the object counting work. > > ### Performance > The performance test were ran using the Extremem benchmark on a default and stress workload. (will edit this section to include data after average time and test for GenShen) > > #### Default workload: > ObjectCountAfterGC disabled (master branch): > `[807.216s][info][gc,stats ] Pause Init Mark (G) = 0.003 s (a = 264 us)` > `[807.216s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 91 us)` > `[807.216s][info][gc,stats ] Concurrent Mark Roots = 0.041 s (a = 4099 us)` > `[807.216s][info][gc,stats ] Concurrent Marking = 1.660 s (a = 166035 us)` > `[807.216s][info][gc,stats ] Pause Final Mark (G) = 0.004 s (a = 446 us) ` > `[807.216s][info][gc,stats ] Pause Final Mark (G) = 0.004 s (a = 446 us) ` > `[807.216s][info][gc,stats ] Pause Final Mark (N) = 0.004 s (a = 357 us)` > > ObjectCountAfterGC disabled (feature branch): > `[807.104s][info][gc,stats ] Pause Init Mark (G) = 0.003 s (a = 302 us)` > `[807.104s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 92 us) ` > `[807.104s][info][gc,stats ] Concurrent Mark Roots = 0.048 s (a = 4827 us)` > `[807.104s][info][gc,stats ] Concurrent Marking = 1.666 s (a = 166638 us) ` > `[807.104s][info][gc,stats ] Pause Final Mark (G) = 0.006 s (a = 603 us)` > `[807.104s][info][gc,stats ] Pause Final Mark (N) = 0.005 s (a = 516 us)` > > ObjectCountAfterGC enabled (feature branch) > `[807.299s][info][gc,stats ] Pause Init Mark (G) = 0.002 s (a = 227 us)` > `[807.299s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 89 us) ` > `[807.299s][info][gc,stats ] Concurrent Mark Roots = 0.053 s (a = 5279 us)` > `[807.299s][info][gc,st... Left a few superficial suggestions. My big question is what work remains for this event to also work with the generational mode? src/hotspot/share/gc/shared/gcTrace.hpp line 136: > 134: void report_gc_reference_stats(const ReferenceProcessorStats& rp) const; > 135: void report_object_count_after_gc(BoolObjectClosure* object_filter, WorkerThreads* workers) NOT_SERVICES_RETURN; > 136: // Report object count by not performing a heap inspection. This method will s/by not/without src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp line 179: > 177: // Use object counting closure if ObjectCount or ObjectCountAfterGC event is enabled. > 178: const bool object_count_enabled = ObjectCountEventSender::should_send_event(); > 179: if (object_count_enabled && !ShenandoahHeap::heap()->mode()->is_generational()) { Can the generational mode support this? It can also perform a _global_ collection. src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp line 130: > 128: // Create the KlassInfoTable for Shenandoah only if JFR is enabled. > 129: #if INCLUDE_JFR > 130: KlassInfoTable cit(false); Might consider a `CADR` helper class here (Constructor Acquires, Destructor Releases). There are a lot of lines of code between the two `set_cit` calls (and the second one isn't guarded by `INCLUDE_JFR`). src/hotspot/share/memory/heapInspection.hpp line 33: > 31: #include "oops/objArrayOop.hpp" > 32: #include "oops/oop.hpp" > 33: #include "runtime/mutex.hpp" Does this need to be in the header? src/hotspot/share/runtime/mutexLocker.hpp line 90: > 88: extern Monitor* Notify_lock; // a lock used to synchronize the start-up of the vm > 89: extern Mutex* ExceptionCache_lock; // a lock used to synchronize exception cache updates > 90: extern Mutex* TableMerge_lock; // a lock used to synchronize merging a thread-local table into a global table Might call this `ObjectCountMerge_lock` and describe its usage as `merging a thread local object count`. There are many `Tables` in the JVM (SymbolTable, InternedStrings, etc.). test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithShenandoah.java line 11: > 9: * & vm.opt.ExplicitGCInvokesConcurrent != true > 10: * @library /test/lib /test/jdk > 11: * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -XX:+UseShenandoahGC -XX:MarkSweepDeadRatio=0 -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+IgnoreUnrecognizedVMOptions jdk.jfr.event.gc.objectcount.TestObjectCountAfterGCEventWithShenandoah Are all of these flags necessary to run this test? Can we pare any unnecessary options? ------------- Changes requested by wkemper (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26977#pullrequestreview-3178372422 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2317339492 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2317344826 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2317348710 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2317355707 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2317358657 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2317360739 From ysr at openjdk.org Wed Sep 3 15:54:24 2025 From: ysr at openjdk.org (Y. Srinivas Ramakrishna) Date: Wed, 3 Sep 2025 15:54:24 GMT Subject: RFR: 8366122: Shenandoah: Implement efficient support for object count after gc events In-Reply-To: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> References: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> Message-ID: On Thu, 28 Aug 2025 01:30:39 GMT, pf0n wrote: > ### Summary > > The new implementation of ObjectCountAfterGC for Shenandoah piggybacks off of the existing marking phases and records strongly marked objects in a histogram. If the event is disabled, the original marking closures are used. When enabled new mark-and-count closures are used by the worker threads. Each worker thread updates its local histogram as it marks an object. These local histograms are merged at the conclusion of the marking phase under a mutex. The event is emitted outside a safepoint. Because (most) Shenandoah's marking is done concurrently, so is the object counting work. > > ### Performance > The performance test were ran using the Extremem benchmark on a default and stress workload. (will edit this section to include data after average time and test for GenShen) > > #### Default workload: > ObjectCountAfterGC disabled (master branch): > `[807.216s][info][gc,stats ] Pause Init Mark (G) = 0.003 s (a = 264 us)` > `[807.216s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 91 us)` > `[807.216s][info][gc,stats ] Concurrent Mark Roots = 0.041 s (a = 4099 us)` > `[807.216s][info][gc,stats ] Concurrent Marking = 1.660 s (a = 166035 us)` > `[807.216s][info][gc,stats ] Pause Final Mark (G) = 0.004 s (a = 446 us) ` > `[807.216s][info][gc,stats ] Pause Final Mark (G) = 0.004 s (a = 446 us) ` > `[807.216s][info][gc,stats ] Pause Final Mark (N) = 0.004 s (a = 357 us)` > > ObjectCountAfterGC disabled (feature branch): > `[807.104s][info][gc,stats ] Pause Init Mark (G) = 0.003 s (a = 302 us)` > `[807.104s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 92 us) ` > `[807.104s][info][gc,stats ] Concurrent Mark Roots = 0.048 s (a = 4827 us)` > `[807.104s][info][gc,stats ] Concurrent Marking = 1.666 s (a = 166638 us) ` > `[807.104s][info][gc,stats ] Pause Final Mark (G) = 0.006 s (a = 603 us)` > `[807.104s][info][gc,stats ] Pause Final Mark (N) = 0.005 s (a = 516 us)` > > ObjectCountAfterGC enabled (feature branch) > `[807.299s][info][gc,stats ] Pause Init Mark (G) = 0.002 s (a = 227 us)` > `[807.299s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 89 us) ` > `[807.299s][info][gc,stats ] Concurrent Mark Roots = 0.053 s (a = 5279 us)` > `[807.299s][info][gc,st... @pf0n : 1. For the performance numbers, use the final summaries (in the gc log) of quartile and range of time distributions of the pauses and the phases to better reflect the impact on collections throughout the entire run, rather than for specific spot collections. 2. For completeness in the PR description and to help reviewers, please comment upon whether, when the event is enabled, the counting closures are used also for collections other than concurrent ones and where the events are emitted in those cases. Thanks! src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp line 129: > 127: if (gc_requested) { > 128: // Create the KlassInfoTable for Shenandoah only if JFR is enabled. > 129: #if INCLUDE_JFR Here and elsewhere: 1. for single line pre-proc directives, consider the use of `JFR_ONLY()`. 2. For multi-line pre-proc directives, unindent all the way to the zeroth column, in keeping with hotspot style precedent, even though newer pre-processors accept indented directives. src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp line 232: > 230: volatile size_t _committed; > 231: shenandoah_padding(1); > 232: KlassInfoTable* _cit; Move the comment from line 257 below to before this place. src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp line 256: > 254: void set_soft_max_capacity(size_t v); > 255: > 256: // Create Shenandoah's KlassInfoTable. Not create, but set? src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp line 260: > 258: inline void set_cit(KlassInfoTable* cit); > 259: > 260: // Return Shenandoah's KlassInfoTable. Put these together and use one comment like: // Setter & accessor for class histogram src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp line 653: > 651: inline void ShenandoahHeap::set_cit(KlassInfoTable* cit) { > 652: assert((_cit == nullptr && cit != nullptr) || > 653: (_cit != nullptr && cit == nullptr), "Initialize once & clear once"); The assert message isn't accurate for your current usage. Suggest splitting into two asserts with a suitable message: assert(_cit == nullptr || cit == nullptr, "Overwriting an existing histogram"); assert(_cit != nullptr || cit != nullptr, "Already cleared"); src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp line 658: > 656: > 657: inline KlassInfoTable* ShenandoahHeap::get_cit() { > 658: assert(_cit != nullptr, "KlassInfoTable for Shenandoah should be initialized"); Change the message to: "KlassInfoTable is null" (suggestion is to avoid "initialized" here, since the value is repeatedly toggled from a pointer to stack allocated klass info table to null and back). Essentially the heap is used as a post-office-box to pass a handle to a stack allocated object to worker threads using the object. src/hotspot/share/gc/shenandoah/shenandoahMark.cpp line 72: > 70: mark_loop_work(&cl, ld, w, t, req); > 71: } else { > 72: #if INCLUDE_JFR unindent (left-justify to 0th column) src/hotspot/share/gc/shenandoah/shenandoahMark.hpp line 60: > 58: public: > 59: template > 60: static inline bool mark_through_ref(T* p, ShenandoahObjToScanQueue* q, ShenandoahObjToScanQueue* old_q, ShenandoahMarkingContext* const mark_context, bool weak); document the semantics of the method's return value here and everywhere where a bool return replaces a previously void return. src/hotspot/share/runtime/mutexLocker.hpp line 90: > 88: extern Monitor* Notify_lock; // a lock used to synchronize the start-up of the vm > 89: extern Mutex* ExceptionCache_lock; // a lock used to synchronize exception cache updates > 90: extern Mutex* TableMerge_lock; // a lock used to synchronize merging of thread-local KlassInfoTables nit: `... merging a thread-local into a global table` ------------- PR Comment: https://git.openjdk.org/jdk/pull/26977#issuecomment-3235400211 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2308906242 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2308907269 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2308907857 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2308910727 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2308919955 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2308923148 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2308926296 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2308929362 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2308937729 From duke at openjdk.org Wed Sep 3 15:54:24 2025 From: duke at openjdk.org (pf0n) Date: Wed, 3 Sep 2025 15:54:24 GMT Subject: RFR: 8366122: Shenandoah: Implement efficient support for object count after gc events In-Reply-To: References: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> Message-ID: On Thu, 28 Aug 2025 23:49:20 GMT, Kelvin Nilsen wrote: >> ### Summary >> >> The new implementation of ObjectCountAfterGC for Shenandoah piggybacks off of the existing marking phases and records strongly marked objects in a histogram. If the event is disabled, the original marking closures are used. When enabled new mark-and-count closures are used by the worker threads. Each worker thread updates its local histogram as it marks an object. These local histograms are merged at the conclusion of the marking phase under a mutex. The event is emitted outside a safepoint. Because (most) Shenandoah's marking is done concurrently, so is the object counting work. >> >> ### Performance >> The performance test were ran using the Extremem benchmark on a default and stress workload. (will edit this section to include data after average time and test for GenShen) >> >> #### Default workload: >> ObjectCountAfterGC disabled (master branch): >> `[807.216s][info][gc,stats ] Pause Init Mark (G) = 0.003 s (a = 264 us)` >> `[807.216s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 91 us)` >> `[807.216s][info][gc,stats ] Concurrent Mark Roots = 0.041 s (a = 4099 us)` >> `[807.216s][info][gc,stats ] Concurrent Marking = 1.660 s (a = 166035 us)` >> `[807.216s][info][gc,stats ] Pause Final Mark (G) = 0.004 s (a = 446 us) ` >> `[807.216s][info][gc,stats ] Pause Final Mark (G) = 0.004 s (a = 446 us) ` >> `[807.216s][info][gc,stats ] Pause Final Mark (N) = 0.004 s (a = 357 us)` >> >> ObjectCountAfterGC disabled (feature branch): >> `[807.104s][info][gc,stats ] Pause Init Mark (G) = 0.003 s (a = 302 us)` >> `[807.104s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 92 us) ` >> `[807.104s][info][gc,stats ] Concurrent Mark Roots = 0.048 s (a = 4827 us)` >> `[807.104s][info][gc,stats ] Concurrent Marking = 1.666 s (a = 166638 us) ` >> `[807.104s][info][gc,stats ] Pause Final Mark (G) = 0.006 s (a = 603 us)` >> `[807.104s][info][gc,stats ] Pause Final Mark (N) = 0.005 s (a = 516 us)` >> >> ObjectCountAfterGC enabled (feature branch) >> `[807.299s][info][gc,stats ] Pause Init Mark (G) = 0.002 s (a = 227 us)` >> `[807.299s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 89 us) ` >> `[807.299s][info][gc,stats ] Concurrent Mark Roots ... > > src/hotspot/share/gc/shared/gcTrace.inline.hpp line 12: > >> 10: >> 11: // The ObjectCountEventSenderClosure will determine if only the ObjectCount >> 12: // event will be emitted instead of ObjectCountAfterGC. If false, then both > > If "what" is false? This comment is not clear. Are you speaking of the SeparateEventEmission template parameter? > > I think the use of future-tense "will" also makes this comment confusing. Can you write this in present tense? I'll remove this template parameter, since it won't be needed for the ObjectCountAfterGC PR. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2312857523 From duke at openjdk.org Wed Sep 3 15:54:24 2025 From: duke at openjdk.org (pf0n) Date: Wed, 3 Sep 2025 15:54:24 GMT Subject: RFR: 8366122: Shenandoah: Implement efficient support for object count after gc events In-Reply-To: References: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> Message-ID: On Tue, 2 Sep 2025 22:46:52 GMT, William Kemper wrote: >> ### Summary >> >> The new implementation of ObjectCountAfterGC for Shenandoah piggybacks off of the existing marking phases and records strongly marked objects in a histogram. If the event is disabled, the original marking closures are used. When enabled new mark-and-count closures are used by the worker threads. Each worker thread updates its local histogram as it marks an object. These local histograms are merged at the conclusion of the marking phase under a mutex. The event is emitted outside a safepoint. Because (most) Shenandoah's marking is done concurrently, so is the object counting work. >> >> ### Performance >> The performance test were ran using the Extremem benchmark on a default and stress workload. (will edit this section to include data after average time and test for GenShen) >> >> #### Default workload: >> ObjectCountAfterGC disabled (master branch): >> `[807.216s][info][gc,stats ] Pause Init Mark (G) = 0.003 s (a = 264 us)` >> `[807.216s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 91 us)` >> `[807.216s][info][gc,stats ] Concurrent Mark Roots = 0.041 s (a = 4099 us)` >> `[807.216s][info][gc,stats ] Concurrent Marking = 1.660 s (a = 166035 us)` >> `[807.216s][info][gc,stats ] Pause Final Mark (G) = 0.004 s (a = 446 us) ` >> `[807.216s][info][gc,stats ] Pause Final Mark (G) = 0.004 s (a = 446 us) ` >> `[807.216s][info][gc,stats ] Pause Final Mark (N) = 0.004 s (a = 357 us)` >> >> ObjectCountAfterGC disabled (feature branch): >> `[807.104s][info][gc,stats ] Pause Init Mark (G) = 0.003 s (a = 302 us)` >> `[807.104s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 92 us) ` >> `[807.104s][info][gc,stats ] Concurrent Mark Roots = 0.048 s (a = 4827 us)` >> `[807.104s][info][gc,stats ] Concurrent Marking = 1.666 s (a = 166638 us) ` >> `[807.104s][info][gc,stats ] Pause Final Mark (G) = 0.006 s (a = 603 us)` >> `[807.104s][info][gc,stats ] Pause Final Mark (N) = 0.005 s (a = 516 us)` >> >> ObjectCountAfterGC enabled (feature branch) >> `[807.299s][info][gc,stats ] Pause Init Mark (G) = 0.002 s (a = 227 us)` >> `[807.299s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 89 us) ` >> `[807.299s][info][gc,stats ] Concurrent Mark Roots ... > > src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp line 179: > >> 177: // Use object counting closure if ObjectCount or ObjectCountAfterGC event is enabled. >> 178: const bool object_count_enabled = ObjectCountEventSender::should_send_event(); >> 179: if (object_count_enabled && !ShenandoahHeap::heap()->mode()->is_generational()) { > > Can the generational mode support this? It can also perform a _global_ collection. It could be possible to extend the object counting closure for GenShen. I would have to look more deep into where the closure can be used. > src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp line 130: > >> 128: // Create the KlassInfoTable for Shenandoah only if JFR is enabled. >> 129: #if INCLUDE_JFR >> 130: KlassInfoTable cit(false); > > Might consider a `CADR` helper class here (Constructor Acquires, Destructor Releases). There are a lot of lines of code between the two `set_cit` calls (and the second one isn't guarded by `INCLUDE_JFR`). I'll look into that. Thanks for pointing out the unguarded `set_cit`. > src/hotspot/share/memory/heapInspection.hpp line 33: > >> 31: #include "oops/objArrayOop.hpp" >> 32: #include "oops/oop.hpp" >> 33: #include "runtime/mutex.hpp" > > Does this need to be in the header? I had an error in GHA during my early implementation, so I included that header. I'll remove and test to see if it is needed or not. > test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithShenandoah.java line 11: > >> 9: * & vm.opt.ExplicitGCInvokesConcurrent != true >> 10: * @library /test/lib /test/jdk >> 11: * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -XX:+UseShenandoahGC -XX:MarkSweepDeadRatio=0 -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+IgnoreUnrecognizedVMOptions jdk.jfr.event.gc.objectcount.TestObjectCountAfterGCEventWithShenandoah > > Are all of these flags necessary to run this test? Can we pare any unnecessary options? All of the collectors that test for the ObjectCountAfterGC event uses these flags. I thought it would be best to keep it consistent for the Shenandoah test. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2317633120 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2317630478 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2317545276 PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2317555401 From duke at openjdk.org Wed Sep 3 15:54:25 2025 From: duke at openjdk.org (pf0n) Date: Wed, 3 Sep 2025 15:54:25 GMT Subject: RFR: 8366122: Shenandoah: Implement efficient support for object count after gc events In-Reply-To: References: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> Message-ID: On Wed, 3 Sep 2025 02:58:42 GMT, pf0n wrote: >> src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp line 179: >> >>> 177: // Use object counting closure if ObjectCount or ObjectCountAfterGC event is enabled. >>> 178: const bool object_count_enabled = ObjectCountEventSender::should_send_event(); >>> 179: if (object_count_enabled && !ShenandoahHeap::heap()->mode()->is_generational()) { >> >> Can the generational mode support this? It can also perform a _global_ collection. > > It could be possible to extend the object counting closure for GenShen. I would have to look more deep into where the closure can be used. GenShen shares the same marking closure as Shenandoah, but it is templatized differently. At surface level, we would just have to replace the marking closure used for the global collection with the object counting closure, but there might be other work to be done. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2317645883 From pchilanomate at openjdk.org Wed Sep 3 15:59:51 2025 From: pchilanomate at openjdk.org (Patricio Chilano Mateo) Date: Wed, 3 Sep 2025 15:59:51 GMT Subject: RFR: 8365937: post_method_exit might incorrectly set was_popped_by_exception and value in the middle of stack unwinding [v4] In-Reply-To: References: Message-ID: On Fri, 29 Aug 2025 19:11:04 GMT, Leonid Mesnik wrote: >> The void `JvmtiExport::post_method_exit(JavaThread* thread, Method* method, frame current_frame) `calculates >> `bool exception_exit = state->is_exception_detected() && !state->is_exception_caught();` >> to find if method exit normally or by exception. >> However, JvmtiExport::post_method_exit( method is not called at all in the case of exception. See >> `void JvmtiExport::notice_unwind_due_to_exception(JavaThread *thread, Method* method, address location, oop exception, bool in_handler_frame)` >> where post_method_exit_inner is called directly. >> >> The `exception_exit` is true when exception is processed and the current method is called in the middle of stack unwinding. >> >> >> The fix was a part of >> https://github.com/openjdk/jdk/pull/26713 >> for >> https://bugs.openjdk.org/browse/JDK-8365192 > > Leonid Mesnik has updated the pull request incrementally with two additional commits since the last revision: > > - Apply suggestions from code review > > Co-authored-by: Patricio Chilano Mateo > - Update test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/PendingException/libTestMethodExitWithPendingException.cpp > > Co-authored-by: Patricio Chilano Mateo Marked as reviewed by pchilanomate (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/26886#pullrequestreview-3181311632 From duke at openjdk.org Wed Sep 3 16:49:03 2025 From: duke at openjdk.org (pf0n) Date: Wed, 3 Sep 2025 16:49:03 GMT Subject: RFR: 8366122: Shenandoah: Implement efficient support for object count after gc events [v2] In-Reply-To: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> References: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> Message-ID: > ### Summary > > The new implementation of ObjectCountAfterGC for Shenandoah piggybacks off of the existing marking phases and records strongly marked objects in a histogram. If the event is disabled, the original marking closures are used. When enabled new mark-and-count closures are used by the worker threads. Each worker thread updates its local histogram as it marks an object. These local histograms are merged at the conclusion of the marking phase under a mutex. The event is emitted outside a safepoint. Because (most) Shenandoah's marking is done concurrently, so is the object counting work. > > ### Performance > The performance test were ran using the Extremem benchmark on a default and stress workload. (will edit this section to include data after average time and test for GenShen) > > #### Default workload: > ObjectCountAfterGC disabled (master branch): > `[807.216s][info][gc,stats ] Pause Init Mark (G) = 0.003 s (a = 264 us)` > `[807.216s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 91 us)` > `[807.216s][info][gc,stats ] Concurrent Mark Roots = 0.041 s (a = 4099 us)` > `[807.216s][info][gc,stats ] Concurrent Marking = 1.660 s (a = 166035 us)` > `[807.216s][info][gc,stats ] Pause Final Mark (G) = 0.004 s (a = 446 us) ` > `[807.216s][info][gc,stats ] Pause Final Mark (G) = 0.004 s (a = 446 us) ` > `[807.216s][info][gc,stats ] Pause Final Mark (N) = 0.004 s (a = 357 us)` > > ObjectCountAfterGC disabled (feature branch): > `[807.104s][info][gc,stats ] Pause Init Mark (G) = 0.003 s (a = 302 us)` > `[807.104s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 92 us) ` > `[807.104s][info][gc,stats ] Concurrent Mark Roots = 0.048 s (a = 4827 us)` > `[807.104s][info][gc,stats ] Concurrent Marking = 1.666 s (a = 166638 us) ` > `[807.104s][info][gc,stats ] Pause Final Mark (G) = 0.006 s (a = 603 us)` > `[807.104s][info][gc,stats ] Pause Final Mark (N) = 0.005 s (a = 516 us)` > > ObjectCountAfterGC enabled (feature branch) > `[807.299s][info][gc,stats ] Pause Init Mark (G) = 0.002 s (a = 227 us)` > `[807.299s][info][gc,stats ] Pause Init Mark (N) = 0.001 s (a = 89 us) ` > `[807.299s][info][gc,stats ] Concurrent Mark Roots = 0.053 s (a = 5279 us)` > `[807.299s][info][gc,st... pf0n has updated the pull request incrementally with two additional commits since the last revision: - Using JFR_ONLY - Changed comment, included another guard ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26977/files - new: https://git.openjdk.org/jdk/pull/26977/files/9552c62b..6a3c6318 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26977&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26977&range=00-01 Stats: 3 lines in 1 file changed: 0 ins; 2 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/26977.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26977/head:pull/26977 PR: https://git.openjdk.org/jdk/pull/26977 From kbarrett at openjdk.org Wed Sep 3 18:03:45 2025 From: kbarrett at openjdk.org (Kim Barrett) Date: Wed, 3 Sep 2025 18:03:45 GMT Subject: RFR: 8314488: Compiling the JDK with C++17 [v4] In-Reply-To: References: Message-ID: On Mon, 25 Aug 2025 23:31:03 GMT, Kim Barrett wrote: >> Please review this change to use C++17 for building C++ parts of the JDK. In >> particular this affects HotSpot. This change also includes an update to the >> HotSpot Style Guide regarding C++17 features and their use in HotSpot code. >> >> Testing: mach5 tier1-8 >> >> This change includes a modification of the Style Guide. Rough consensus among >> the HotSpot Group members is required to make such a change. Only Group >> members should vote for approval (via the github PR), though reasoned >> objections or comments from anyone will be considered. A decision on this >> proposal will not be made before Friday 5-September-2025 at 12h00 UTC. >> >> Since we're piggybacking on github PRs here, please use the PR review process >> to approve (click on Review Changes > Approve), rather than sending a "vote: >> yes" email reply that would be normal for a CFV. > > Kim Barrett has updated the pull request incrementally with two additional commits since the last revision: > > - missing word > - stefank suggestions Any further comments or approvals? ------------- PR Comment: https://git.openjdk.org/jdk/pull/26884#issuecomment-3250230147 From ayang at openjdk.org Wed Sep 3 18:50:48 2025 From: ayang at openjdk.org (Albert Mingkun Yang) Date: Wed, 3 Sep 2025 18:50:48 GMT Subject: RFR: 8366155: Serial: Obsolete PretenureSizeThreshold In-Reply-To: References: Message-ID: On Tue, 26 Aug 2025 11:44:35 GMT, Albert Mingkun Yang wrote: > Remove obj-size checking before young/old-gen allocation -- an allocation succeeds iff there is enough free space. > > This simplifies the allocation logic: > 1. before attempting gc: `mem_allocate_work` does young-gen allocation then old-gen-no-expansion allocation > 2. after gc (still inside gc safepoint): `satisfy_failed_allocation` does young-gen allocation old-gen-with-expansion allocation > > Test: tier1-3 Thanks for review. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26941#issuecomment-3250368237 From ayang at openjdk.org Wed Sep 3 18:50:49 2025 From: ayang at openjdk.org (Albert Mingkun Yang) Date: Wed, 3 Sep 2025 18:50:49 GMT Subject: Integrated: 8366155: Serial: Obsolete PretenureSizeThreshold In-Reply-To: References: Message-ID: On Tue, 26 Aug 2025 11:44:35 GMT, Albert Mingkun Yang wrote: > Remove obj-size checking before young/old-gen allocation -- an allocation succeeds iff there is enough free space. > > This simplifies the allocation logic: > 1. before attempting gc: `mem_allocate_work` does young-gen allocation then old-gen-no-expansion allocation > 2. after gc (still inside gc safepoint): `satisfy_failed_allocation` does young-gen allocation old-gen-with-expansion allocation > > Test: tier1-3 This pull request has now been integrated. Changeset: 8d236615 Author: Albert Mingkun Yang URL: https://git.openjdk.org/jdk/commit/8d236615b7db2bd5a2a59002b79e59cf4e6a308a Stats: 86 lines in 7 files changed: 3 ins; 75 del; 8 mod 8366155: Serial: Obsolete PretenureSizeThreshold Reviewed-by: tschatzl ------------- PR: https://git.openjdk.org/jdk/pull/26941 From kbarrett at openjdk.org Wed Sep 3 18:52:42 2025 From: kbarrett at openjdk.org (Kim Barrett) Date: Wed, 3 Sep 2025 18:52:42 GMT Subject: RFR: 8300080: offset_of for GCC/Clang exhibits undefined behavior and is not always a compile-time constant In-Reply-To: <0T5Bpw4E7qu10pWz981nWwFgNet_sas0vPi4K5v70LU=.17e8d99a-3663-47ef-874b-1349bd919229@github.com> References: <0T5Bpw4E7qu10pWz981nWwFgNet_sas0vPi4K5v70LU=.17e8d99a-3663-47ef-874b-1349bd919229@github.com> Message-ID: On Wed, 3 Sep 2025 07:28:49 GMT, Stefan Karlsson wrote: > Nice. Is it worth pushing this so near the transition to compile with C++17 support? Including the warning suppression gives something that's usefully backportable, which would make it easier to backport changes that happen to include any future `offset_of` to `offsetof` changes. The warning suppression is harmless in C++17 mode, and can be removed at leisure once that mode is engaged. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27061#issuecomment-3250377743 From kvn at openjdk.org Wed Sep 3 18:54:47 2025 From: kvn at openjdk.org (Vladimir Kozlov) Date: Wed, 3 Sep 2025 18:54:47 GMT Subject: RFR: 8314488: Compiling the JDK with C++17 [v4] In-Reply-To: References: Message-ID: <-19Udqn-E9_D82hvJZaOCHz9mc-GK9G_PETnNNqSmxg=.968f5927-87f2-4174-93f3-1c296570ea0d@github.com> On Mon, 25 Aug 2025 23:31:03 GMT, Kim Barrett wrote: >> Please review this change to use C++17 for building C++ parts of the JDK. In >> particular this affects HotSpot. This change also includes an update to the >> HotSpot Style Guide regarding C++17 features and their use in HotSpot code. >> >> Testing: mach5 tier1-8 >> >> This change includes a modification of the Style Guide. Rough consensus among >> the HotSpot Group members is required to make such a change. Only Group >> members should vote for approval (via the github PR), though reasoned >> objections or comments from anyone will be considered. A decision on this >> proposal will not be made before Friday 5-September-2025 at 12h00 UTC. >> >> Since we're piggybacking on github PRs here, please use the PR review process >> to approve (click on Review Changes > Approve), rather than sending a "vote: >> yes" email reply that would be normal for a CFV. > > Kim Barrett has updated the pull request incrementally with two additional commits since the last revision: > > - missing word > - stefank suggestions Approved ------------- Marked as reviewed by kvn (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26884#pullrequestreview-3182008369 From vaivanov at openjdk.org Wed Sep 3 19:18:36 2025 From: vaivanov at openjdk.org (Vladimir Ivanov) Date: Wed, 3 Sep 2025 19:18:36 GMT Subject: RFR: 8363858: [perf] OptimizeFill may use wide set of intrinsics [v2] In-Reply-To: References: Message-ID: <5-yAlFxUHtE1TyZPS-EU-o_3QhkFdCVGTE7kY7vRabo=.eea74242-b669-47f4-8f87-cfbba15267f1@github.com> > Default mode should use OptimizeFill=true option for the SRF platform. Vladimir Ivanov has updated the pull request incrementally with 106 additional commits since the last revision: - 8366155: Serial: Obsolete PretenureSizeThreshold Reviewed-by: tschatzl - 8366401: JCK test api/java_text/DecimalFormatSymbols/serial/InputTests.html fails after JDK-8363972 Reviewed-by: naoto - 8366537: Test "java/util/TimeZone/DefaultTimeZoneTest.java" is not updating the zone ID as expected Reviewed-by: naoto, jlu - 8366768: Problemlist jdk/jshell/ToolSimpleTest.java Reviewed-by: jlahoda - 8366298: FDLeakTest sometimes takes minutes to complete on Linux Reviewed-by: lkorinth, rriggs, stuefe - 8363966: GHA: Switch cross-compiling sysroots to Debian trixie Reviewed-by: ayang, fyang, erikj - 8366803: Bump timeout on sun/tools/jhsdb/BasicLauncherTest.java Reviewed-by: stefank - 8366543: Clean up include headers in numberSeq Reviewed-by: tschatzl - 8366660: Sort share/nmt includes Reviewed-by: ayang, shade - 8329077: C2 SuperWord: Add MoveD2L, MoveL2D, MoveF2I, MoveI2F Reviewed-by: epeter, qamai - ... and 96 more: https://git.openjdk.org/jdk/compare/8fca1903...8b16a897 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26974/files - new: https://git.openjdk.org/jdk/pull/26974/files/8fca1903..8b16a897 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26974&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26974&range=00-01 Stats: 16895 lines in 809 files changed: 12117 ins; 2304 del; 2474 mod Patch: https://git.openjdk.org/jdk/pull/26974.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26974/head:pull/26974 PR: https://git.openjdk.org/jdk/pull/26974 From iklam at openjdk.org Wed Sep 3 19:36:51 2025 From: iklam at openjdk.org (Ioi Lam) Date: Wed, 3 Sep 2025 19:36:51 GMT Subject: RFR: 8356548: Avoid using ASM to parse latest class files in tests [v6] In-Reply-To: References: Message-ID: On Fri, 22 Aug 2025 15:06:46 GMT, Chen Liang wrote: >> For early eval; test by changing the ClassReader max accepted version of test ASM to 24 instead of 25 > > Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision: > > - Merge branch 'master' of https://github.com/openjdk/jdk into fix/asm-test-upgrade > - Merge branch 'fix/asm-test-upgrade' of github.com:liachmodded/jdk into fix/asm-test-upgrade > - Update test/hotspot/jtreg/compiler/calls/common/InvokeDynamicPatcher.java > > Co-authored-by: Andrew Haley > - Variable name improvements > - Merge branch 'master' of https://github.com/openjdk/jdk into fix/asm-test-upgrade > - Move other tier 4,5, etc tests to not use ClassReader > - Merge branch 'master' of https://github.com/openjdk/jdk into fix/asm-test-upgrade > - Merge branch 'master' of https://github.com/openjdk/jdk into fix/asm-test-upgrade > - Use classfile api instead of javac setting version > - Merge branch 'master' of https://github.com/openjdk/jdk into fix/asm-test-upgrade > - ... and 1 more: https://git.openjdk.org/jdk/compare/e0d5ae0b...a659f538 I looked at the diff with whitespace off and looked at all change. They seem reasonable to me. The bytecode changes seems to be 1-1 matching with the old code. I just have a few style nits. Since the changes are subtle, I think before integration, you should do a final run up to tier 6 just to be safe. test/hotspot/jtreg/compiler/jvmci/common/CTVMUtilities.java line 80: > 78: throw new Error("TEST BUG: cannot read " + binaryName, e); > 79: } > 80: ClassModel classModel = ClassFile.of().parse(fileBytes); Can you put these in a separate function, like `ClassModel getClassModel(Class class)`? test/hotspot/jtreg/compiler/jvmci/common/CTVMUtilities.java line 93: > 91: for (var methodModel : classModel.methods()) { > 92: if (methodModel.methodName().equalsString(methodName) > 93: && methodModel.methodType().isMethodType(methodType)) { For readability, I think we should put the above in a separate function, and then: var methodModel = findMethodInClass(classModel, m); Then we can potentially use findMethodInClass() in other test cases when we have a need to do so. test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/MissedStackMapFrames/MissedStackMapFrames.java line 64: > 62: var foundStackMapTable = method.code().flatMap(code -> code.findAttribute(Attributes.stackMapTable())); > 63: if (foundStackMapTable.isPresent()) { > 64: count += foundStackMapTable.get().entries().size(); The old logging should be preserved: log(" method " + name + " - " + methodFrames + " frames"); test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineAnnotations.java line 104: > 102: public void atEnd(ClassBuilder builder) { > 103: // Re-add dummy fields > 104: dummyFields.forEach(builder); Comment: `// Re-add dummy fields at the end of the class` ------------- Marked as reviewed by iklam (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25124#pullrequestreview-3182050159 PR Review Comment: https://git.openjdk.org/jdk/pull/25124#discussion_r2319959194 PR Review Comment: https://git.openjdk.org/jdk/pull/25124#discussion_r2319956360 PR Review Comment: https://git.openjdk.org/jdk/pull/25124#discussion_r2319921409 PR Review Comment: https://git.openjdk.org/jdk/pull/25124#discussion_r2319969688 From kbarrett at openjdk.org Wed Sep 3 19:48:42 2025 From: kbarrett at openjdk.org (Kim Barrett) Date: Wed, 3 Sep 2025 19:48:42 GMT Subject: RFR: 8364735: [asan] heap-use-after-free error detected in defaultStream::writer during VM shutdown [v2] In-Reply-To: <9MccMrhJLB1DC6NP_9aYvnC9EhwqW_iko5Cxdbfxn_k=.4e1db66e-3ffb-4162-a3de-d17169212159@github.com> References: <3TJnBvDoAPUf4p2e8Y0vpckfm3v8e31cKKwfOeyRnnM=.34c016f4-419d-4dd6-9102-b112a7423f7b@github.com> <9MccMrhJLB1DC6NP_9aYvnC9EhwqW_iko5Cxdbfxn_k=.4e1db66e-3ffb-4162-a3de-d17169212159@github.com> Message-ID: On Wed, 3 Sep 2025 14:00:05 GMT, Thomas Stuefe wrote: > I still am not sure how the OrderAccess helps. A concurrent thread can see xtty != null and start printing while the terminating thread deletes the defaultStream under xtty? Sorry if I am slow. I agree with @tstuefe - I'm not seeing how this actually helps. Esp. since the other side of these operations typically (universally?) doesn't have any memory ordering, and where there are null checks they are often of the form `if (global_x != nullptr) { ... use global_x ... }` ------------- PR Comment: https://git.openjdk.org/jdk/pull/26832#issuecomment-3250549019 From vaivanov at openjdk.org Wed Sep 3 22:11:17 2025 From: vaivanov at openjdk.org (Vladimir Ivanov) Date: Wed, 3 Sep 2025 22:11:17 GMT Subject: RFR: 8363858: [perf] OptimizeFill may use wide set of intrinsics [v3] In-Reply-To: References: Message-ID: > Default mode should use OptimizeFill=true option for the SRF platform. Vladimir Ivanov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit: 8363858: [perf] OptimizeFill may use wide set of intrinsics ------------- Changes: https://git.openjdk.org/jdk/pull/26974/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26974&range=02 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/26974.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26974/head:pull/26974 PR: https://git.openjdk.org/jdk/pull/26974 From sviswanathan at openjdk.org Wed Sep 3 23:46:42 2025 From: sviswanathan at openjdk.org (Sandhya Viswanathan) Date: Wed, 3 Sep 2025 23:46:42 GMT Subject: RFR: 8363858: [perf] OptimizeFill may use wide set of intrinsics [v3] In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 22:11:17 GMT, Vladimir Ivanov wrote: >> Default mode should use OptimizeFill=true option for the SRF platform. > > Vladimir Ivanov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit: > > 8363858: [perf] OptimizeFill may use wide set of intrinsics Looks good to me. ------------- Marked as reviewed by sviswanathan (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26974#pullrequestreview-3182905455 From ysr at openjdk.org Thu Sep 4 00:15:49 2025 From: ysr at openjdk.org (Y. Srinivas Ramakrishna) Date: Thu, 4 Sep 2025 00:15:49 GMT Subject: RFR: 8366122: Shenandoah: Implement efficient support for object count after gc events [v2] In-Reply-To: References: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> Message-ID: <_7YHL1mTJBL7b_EgdhbFJZ2hIFiOD0Tjqy0APNy-h2g=.16b48215-3ac0-4964-9ce2-e8ee475109b3@github.com> On Wed, 3 Sep 2025 01:31:24 GMT, pf0n wrote: >> src/hotspot/share/memory/heapInspection.hpp line 33: >> >>> 31: #include "oops/objArrayOop.hpp" >>> 32: #include "oops/oop.hpp" >>> 33: #include "runtime/mutex.hpp" >> >> Does this need to be in the header? > > I had an error in GHA during my early implementation, so I included that header. I'll remove and test to see if it is needed or not. I believe you need it for this: https://github.com/pf0n/jdk/blob/f43e334bf76f878ec688cbd58a5ab1cb10deb0f9/src/hotspot/share/memory/heapInspection.hpp#L218 It probably happens to work at other places because of preceding includes that happen to satisfy this. Explicitly including it here makes sense for that reason. Not sure why it just started showing up, but likely a new use that didn't otherwise satisfy this include. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2320510893 From duke at openjdk.org Thu Sep 4 00:27:49 2025 From: duke at openjdk.org (pf0n) Date: Thu, 4 Sep 2025 00:27:49 GMT Subject: RFR: 8366122: Shenandoah: Implement efficient support for object count after gc events [v2] In-Reply-To: <_7YHL1mTJBL7b_EgdhbFJZ2hIFiOD0Tjqy0APNy-h2g=.16b48215-3ac0-4964-9ce2-e8ee475109b3@github.com> References: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> <_7YHL1mTJBL7b_EgdhbFJZ2hIFiOD0Tjqy0APNy-h2g=.16b48215-3ac0-4964-9ce2-e8ee475109b3@github.com> Message-ID: On Thu, 4 Sep 2025 00:12:48 GMT, Y. Srinivas Ramakrishna wrote: >> I had an error in GHA during my early implementation, so I included that header. I'll remove and test to see if it is needed or not. > > I believe you need it for this: https://github.com/pf0n/jdk/blob/f43e334bf76f878ec688cbd58a5ab1cb10deb0f9/src/hotspot/share/memory/heapInspection.hpp#L218 > > It probably happens to work at other places because of preceding includes that happen to satisfy this. Explicitly including it here makes sense for that reason. Not sure why it just started showing up, but likely a new use that didn't otherwise satisfy this include. I forgot to circle back on this, but there are files that I created that includes `heapInspection.hpp`. I get an incomplete type for the Mutex class if I don't include `mutex.hpp`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2320521485 From dlong at openjdk.org Thu Sep 4 00:31:42 2025 From: dlong at openjdk.org (Dean Long) Date: Thu, 4 Sep 2025 00:31:42 GMT Subject: RFR: 8366461: Remove obsolete method handle invoke logic [v3] In-Reply-To: References: <_pqvEs0LIlAc7RjFUwg-bpxS3D2v5U7c6In2sG8XLhQ=.57e3aead-6ac4-4a42-89d2-385d7e6ecedf@github.com> Message-ID: On Wed, 3 Sep 2025 07:12:20 GMT, Manuel H?ssig wrote: >> Dean Long has updated the pull request incrementally with three additional commits since the last revision: >> >> - revert whitespace change >> - undo debug changes >> - cleanup > > src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/aarch64/AARCH64Frame.java line 372: > >> 370: // DEBUG_ONLY(verifyDeoptriginalPc(senderNm, raw_unextendedSp)); >> 371: } >> 372: } > > `Frame.java adjustUnextendedSP()` do not seem to do anything? Perhaps these could be cleaned up as well? Yes, it's tempting to want to clean these up, but I noticed that SA code really tries to mirror the C++ code, so I'm inclined to leave it. Is there a Serviceability expert that would like to see this code cleaned up further? @plummercj , what do you think? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27059#discussion_r2320526360 From dholmes at openjdk.org Thu Sep 4 00:43:41 2025 From: dholmes at openjdk.org (David Holmes) Date: Thu, 4 Sep 2025 00:43:41 GMT Subject: RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* [v3] In-Reply-To: References: Message-ID: <38qyt72puP7IM-UHRTFW8PF17T1V-w3gHMRDkkNF1NY=.40073263-bf18-4726-9101-9710868e20d7@github.com> On Tue, 2 Sep 2025 21:08:25 GMT, Ioi Lam wrote: >> By adding an `InstanceKlass* InstanceKlass::super()` method to shadow `Klass* Klass:super()`, this PR makes it possible to simplify the following code >> >> >> InstanceKlass* ik; >> InstanceKlass* s; >> s = InstanceKlass::cast(ik->super()); // before JDK-8366024 >> s = ik->java_super(); // after JDK-8366024 >> >> >> to >> >> >> s = k->super(); >> >> >> So you no longer need to do casting or need to understand what `java_super()` is. > > Ioi Lam has updated the pull request incrementally with one additional commit since the last revision: > > @dholmes-ora and @coleep comments Updates look good. Thanks ------------- Marked as reviewed by dholmes (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27037#pullrequestreview-3182970156 From dholmes at openjdk.org Thu Sep 4 00:57:48 2025 From: dholmes at openjdk.org (David Holmes) Date: Thu, 4 Sep 2025 00:57:48 GMT Subject: RFR: 8277444: Data race between JvmtiClassFileReconstituter::copy_bytecodes and class linking [v5] In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 21:45:03 GMT, Evgeny Astigeevich wrote: >> There is a race between `JvmtiClassFileReconstituter::copy_bytecodes` and `InstanceKlass::link_class_impl`. `InstanceKlass::link_class_impl` can be rewriting bytecodes. `JvmtiClassFileReconstituter::copy_bytecodes` will not restore them to the original ones because the flag `rewritten` is `false`. This will result in invalid bytecode. >> >> This PR adds linking a class before the `copy_bytecodes` method is called. >> The PR also adds a regression test. >> >> Tested fastdebug and release builds: Linux x86_64 and arm64 >> - The reproducer from JDK-8277444 passed. >> - The regression test passed. >> - Tier1 - tier3 passed. > > Evgeny Astigeevich has updated the pull request incrementally with one additional commit since the last revision: > > Switch to macros HAS_PENDING_EXCEPTION, CLEAR_PENDING_EXCEPTION Generally looks good. There are a few minor nits/typos. I'm not sure about the test, in particular the attempt to calculate `MIN_LINK_TIME_MS`. It is very hard to see/know that you will actually induce the desired race. But as the test doesn't actually have any explicit failure conditions, it at least won't generate false reports. Thanks src/hotspot/share/prims/jvmtiEnv.cpp line 454: > 452: if (ik->get_cached_class_file_bytes() == nullptr) { > 453: // Link the class to avoid races with the rewriter. This will call the verifier also > 454: // on the class. Linking is done already below in VM_RedefineClasses below, but we need Suggestion: // on the class. Linking is also done in VM_RedefineClasses below, but we need There are two "below"s test/jdk/java/lang/instrument/RetransformBigClassTest.java line 44: > 42: * in another thread. The test uses Class.forName("BigClass", false, classLoader) > 43: * which does not link the class. When the class is used, the linking process starts. > 44: * In another thread retransforming of the class is happening, Suggestion: * In another thread retransforming of the class is happening. test/jdk/java/lang/instrument/RetransformBigClassTest.java line 45: > 43: * which does not link the class. When the class is used, the linking process starts. > 44: * In another thread retransforming of the class is happening, > 45: * We generate a class with big methods. A number of methods and thier size are Suggestion: * We generate a class with big methods. A number of methods and their size are test/jdk/java/lang/instrument/RetransformBigClassTest.java line 46: > 44: * In another thread retransforming of the class is happening, > 45: * We generate a class with big methods. A number of methods and thier size are > 46: * chosen to make the linking and retransforming processes running concurrently. Suggestion: * chosen to make the linking and retransforming processes run concurrently. test/jdk/java/lang/instrument/RetransformBigClassTest.java line 54: > 52: private static final Object LOCK = new Object(); > 53: private static final int COUNTER_INC_COUNT = 2000; // A number of 'c+=1;' statements in methods of a class. > 54: private static final int MIN_LINK_TIME_MS = 60; // This time is chosen to be big enough the linking and retransforming processes are running in parallel. Suggestion: private static final int MIN_LINK_TIME_MS = 60; // Large enough so linking and retransforming run in parallel. test/jdk/java/lang/instrument/RetransformBigClassTest.java line 108: > 106: } > 107: > 108: // We calculate a number of methods the linking time to exceed MIN_LINK_TIME_MS. I can't quite parse this sentence. ------------- PR Review: https://git.openjdk.org/jdk/pull/26863#pullrequestreview-3182975103 PR Review Comment: https://git.openjdk.org/jdk/pull/26863#discussion_r2320540581 PR Review Comment: https://git.openjdk.org/jdk/pull/26863#discussion_r2320542950 PR Review Comment: https://git.openjdk.org/jdk/pull/26863#discussion_r2320543345 PR Review Comment: https://git.openjdk.org/jdk/pull/26863#discussion_r2320543595 PR Review Comment: https://git.openjdk.org/jdk/pull/26863#discussion_r2320544630 PR Review Comment: https://git.openjdk.org/jdk/pull/26863#discussion_r2320546835 From asmehra at openjdk.org Thu Sep 4 01:50:50 2025 From: asmehra at openjdk.org (Ashutosh Mehra) Date: Thu, 4 Sep 2025 01:50:50 GMT Subject: RFR: 8366475: Rename MetaspaceShared class to AOTMetaspace [v3] In-Reply-To: References: Message-ID: On Sat, 30 Aug 2025 18:17:42 GMT, Ioi Lam wrote: >> This PR is one (of many) steps in [JDK-8366473](https://bugs.openjdk.org/browse/JDK-8366473) (Refactor CDS source code with new AOT terminology): >> >> Rename this class to with a naming convention that's consistent with other new AOT classes such as AOTClassLinker. >> >> All changes are mechanical text replacement. Headers are resorted alphabetically. > > Ioi Lam has updated the pull request incrementally with one additional commit since the last revision: > > removed unnecessary includes src/hotspot/os/posix/vmError_posix.cpp line 27: > 25: > 26: #include "cds/cdsConfig.hpp" > 27: #include "cds/aotMetaspace.hpp" There are few places, like this, where the header files are no longer in sorted order. Can you please update them. src/hotspot/os/windows/vmError_windows.cpp line 26: > 24: > 25: #include "cds/cdsConfig.hpp" > 26: #include "cds/aotMetaspace.hpp" header files are not sorted src/hotspot/share/prims/jvm.cpp line 3507: > 3505: Handle file_handle(THREAD, JNIHandles::resolve_non_null(listFileName)); > 3506: char* file_name = java_lang_String::as_utf8_string(file_handle()); > 3507: AOTMetaspace::dump_loaded_classes(file_name, THREAD); Shouldn't this file include `aotMetaspace.hpp` directly? src/hotspot/share/prims/jvmtiRedefineClasses.cpp line 26: > 24: > 25: #include "cds/cdsConfig.hpp" > 26: #include "cds/aotMetaspace.hpp" headers are not sorted src/hotspot/share/prims/whitebox.cpp line 30: > 28: #include "cds/filemap.hpp" > 29: #include "cds/heapShared.hpp" > 30: #include "cds/aotMetaspace.hpp" header files are not sorted src/hotspot/share/runtime/java.cpp line 451: > 449: > 450: if (CDSConfig::is_dumping_preimage_static_archive()) { > 451: AOTMetaspace::preload_and_dump(thread); Shouldn't this file include `aotMetaspace.hpp` directly? src/hotspot/share/runtime/threads.cpp line 31: > 29: #include "cds/cdsConfig.hpp" > 30: #include "cds/heapShared.hpp" > 31: #include "cds/aotMetaspace.hpp" header files are not sorted ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27017#discussion_r2320608881 PR Review Comment: https://git.openjdk.org/jdk/pull/27017#discussion_r2320608974 PR Review Comment: https://git.openjdk.org/jdk/pull/27017#discussion_r2320609474 PR Review Comment: https://git.openjdk.org/jdk/pull/27017#discussion_r2320609545 PR Review Comment: https://git.openjdk.org/jdk/pull/27017#discussion_r2320609580 PR Review Comment: https://git.openjdk.org/jdk/pull/27017#discussion_r2320609638 PR Review Comment: https://git.openjdk.org/jdk/pull/27017#discussion_r2320609704 From ysr at openjdk.org Thu Sep 4 01:58:47 2025 From: ysr at openjdk.org (Y. Srinivas Ramakrishna) Date: Thu, 4 Sep 2025 01:58:47 GMT Subject: RFR: 8366122: Shenandoah: Implement efficient support for object count after gc events [v2] In-Reply-To: References: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> <_7YHL1mTJBL7b_EgdhbFJZ2hIFiOD0Tjqy0APNy-h2g=.16b48215-3ac0-4964-9ce2-e8ee475109b3@github.com> Message-ID: On Thu, 4 Sep 2025 00:24:37 GMT, pf0n wrote: >> I believe you need it for this: https://github.com/pf0n/jdk/blob/f43e334bf76f878ec688cbd58a5ab1cb10deb0f9/src/hotspot/share/memory/heapInspection.hpp#L218 >> >> It probably happens to work at other places because of preceding includes that happen to satisfy this. Explicitly including it here makes sense for that reason. Not sure why it just started showing up, but likely a new use that didn't otherwise satisfy this include. > > I forgot to circle back on this, but there are files that I created that includes `heapInspection.hpp`. I get an incomplete type for the Mutex class if I don't include `mutex.hpp`. Makes sense. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2320618033 From ysr at openjdk.org Thu Sep 4 02:07:52 2025 From: ysr at openjdk.org (Y. Srinivas Ramakrishna) Date: Thu, 4 Sep 2025 02:07:52 GMT Subject: RFR: 8366122: Shenandoah: Implement efficient support for object count after gc events [v2] In-Reply-To: References: <7KUQJooZsasGtVU-HaCj7h8_rMFBX13d4yW3T4PfpBw=.07a12734-af51-45cc-9bbb-d6573806478a@github.com> Message-ID: On Wed, 3 Sep 2025 01:41:15 GMT, pf0n wrote: >> test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithShenandoah.java line 11: >> >>> 9: * & vm.opt.ExplicitGCInvokesConcurrent != true >>> 10: * @library /test/lib /test/jdk >>> 11: * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -XX:+UseShenandoahGC -XX:MarkSweepDeadRatio=0 -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+IgnoreUnrecognizedVMOptions jdk.jfr.event.gc.objectcount.TestObjectCountAfterGCEventWithShenandoah >> >> Are all of these flags necessary to run this test? Can we pare any unnecessary options? > > All of the collectors that test for the ObjectCountAfterGC event uses these flags. I thought it would be best to keep it consistent for the Shenandoah test. Best practice is to remove flags that are no-ops, otherwise we accrue junk here. I'd urge removal of such cruft, in particular: MarkSweepDeadRatio, UseCompressedOops & UseCompressedClassPointers (which you may have added for debugging ease), and IgnoreUnrecognizedVMOptions (which should, I think, not be there in any tests unless there is an explicitly stated reason to include it). I am not sure we even need UseFastUnorderedTimeStamps either since the test does not, to my knowledge, examine the order of timestamped events in the JFR recording. If further constraint checking is added to the tests that requires this, it should be added back at that time. For the other collectors, we can consider a separate ticket to clean any unnecessary flags up (I suspect only MarkSweepDeadRatio may be needed for the cases where one is looking for a collection to necessarily move objects-- which I don't think these tests test for -- so even that flag appears unnecessary at least for these tests.) I vote for unburdening the flag load for the new Shenandoah test at least, as suggested by William. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26977#discussion_r2320627227 From liach at openjdk.org Thu Sep 4 02:19:47 2025 From: liach at openjdk.org (Chen Liang) Date: Thu, 4 Sep 2025 02:19:47 GMT Subject: RFR: 8366474: Rename MetaspaceObj::is_shared() to MetaspaceObj::in_aot_cache() [v2] In-Reply-To: References: Message-ID: <6zhlR-iAP-D-47ELJS2xd_eHm1De2raHknG1h9JibgY=.d6fc1d4e-8e54-4560-a9f4-70102fc432d3@github.com> On Sat, 30 Aug 2025 17:34:38 GMT, Ioi Lam wrote: >> This PR is one (of many) steps in [JDK-8366473](https://bugs.openjdk.org/browse/JDK-8366473) (Refactor CDS source code with new AOT terminology): >> >> Rename `is_shared()` in `Metaspace` (and various other classes) to `in_aot_cache()` to reflect its true meaning: >> - tests if an object is inside the AOT cache's metaspace region. >> >> Also various forms of "shared metaspace" are updated to "aot metaspace" >> >> Please start your review with allocations.hpp > > Ioi Lam has updated the pull request incrementally with one additional commit since the last revision: > > Removed MetaspaceShared -> AOTMetaspace changes that are intended for https://github.com/openjdk/jdk/pull/27017 This rename is absolutely clarifying. Did not review the technical aspects of hotspot. ------------- Marked as reviewed by liach (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27016#pullrequestreview-3183181361 From iklam at openjdk.org Thu Sep 4 02:33:52 2025 From: iklam at openjdk.org (Ioi Lam) Date: Thu, 4 Sep 2025 02:33:52 GMT Subject: RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* [v3] In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 11:38:49 GMT, Coleen Phillimore wrote: >> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision: >> >> @dholmes-ora and @coleep comments > > Looks good. This will help with InstanceKlass casting. Thanks @coleenp @dholmes-ora for the review ------------- PR Comment: https://git.openjdk.org/jdk/pull/27037#issuecomment-3251513937 From iklam at openjdk.org Thu Sep 4 02:33:52 2025 From: iklam at openjdk.org (Ioi Lam) Date: Thu, 4 Sep 2025 02:33:52 GMT Subject: Integrated: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 01:31:59 GMT, Ioi Lam wrote: > By adding an `InstanceKlass* InstanceKlass::super()` method to shadow `Klass* Klass:super()`, this PR makes it possible to simplify the following code > > > InstanceKlass* ik; > InstanceKlass* s; > s = InstanceKlass::cast(ik->super()); // before JDK-8366024 > s = ik->java_super(); // after JDK-8366024 > > > to > > > s = k->super(); > > > So you no longer need to do casting or need to understand what `java_super()` is. This pull request has now been integrated. Changeset: f4d73d2a Author: Ioi Lam URL: https://git.openjdk.org/jdk/commit/f4d73d2a3dbeccfd04d49c0cfd690086edd0544f Stats: 93 lines in 28 files changed: 9 ins; 3 del; 81 mod 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* Reviewed-by: dholmes, coleenp ------------- PR: https://git.openjdk.org/jdk/pull/27037 From dholmes at openjdk.org Thu Sep 4 02:35:49 2025 From: dholmes at openjdk.org (David Holmes) Date: Thu, 4 Sep 2025 02:35:49 GMT Subject: RFR: 8365190: Remove LockingMode related code from share In-Reply-To: <4pmrLv9G-kotkKQ_B1wEyXSAJ9Vm3cnxditElz641_E=.23c81f11-ece2-4894-ae2f-8763ad343a4d@github.com> References: <4pmrLv9G-kotkKQ_B1wEyXSAJ9Vm3cnxditElz641_E=.23c81f11-ece2-4894-ae2f-8763ad343a4d@github.com> Message-ID: On Tue, 2 Sep 2025 08:24:10 GMT, Fredrik Bredberg wrote: > Since the integration of [JDK-8359437](https://bugs.openjdk.org/browse/JDK-8359437) the `LockingMode` flag can no longer be set by the user. After that, a number of PRs has been integrated which has removed all `LockingMode` related code from all platforms (except from zero, which is done in this PR). > > This PR removes `LockingMode` related code from the shared (non-platform specific) files. It also removes the `LockingMode` variable itself. > > Passes tier1-tier5 with no added problems. Looks good. Great cleanup! A couple of nits/suggestions. Thanks src/hotspot/share/c1/c1_LIRGenerator.cpp line 638: > 636: LIR_Opr hdr = lock; > 637: lock = new_hdr; > 638: CodeStub* slow_path = new MonitorExitStub(lock, true, monitor_no); It seems all creators for `MonitorExitStub` now pass `true` so that parameter can be removed. src/hotspot/share/runtime/basicLock.hpp line 40: > 38: // Used as a cache of the ObjectMonitor* used when locking. Must either > 39: // be nullptr or the ObjectMonitor* used when locking. > 40: volatile uintptr_t _metadata; So this could now be a properly typed and named field. Future RFE. src/hotspot/share/runtime/basicLock.hpp line 53: > 51: static int displaced_header_offset_in_bytes() { return metadata_offset_in_bytes(); } > 52: > 53: // For lightweight locking If the following are for lightweight locking then what are the two previous for? ------------- PR Review: https://git.openjdk.org/jdk/pull/27041#pullrequestreview-3179255959 PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2317998409 PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2320634417 PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2320643671 From dholmes at openjdk.org Thu Sep 4 02:35:51 2025 From: dholmes at openjdk.org (David Holmes) Date: Thu, 4 Sep 2025 02:35:51 GMT Subject: RFR: 8365190: Remove LockingMode related code from share In-Reply-To: References: <4pmrLv9G-kotkKQ_B1wEyXSAJ9Vm3cnxditElz641_E=.23c81f11-ece2-4894-ae2f-8763ad343a4d@github.com> Message-ID: On Tue, 2 Sep 2025 20:15:51 GMT, Coleen Phillimore wrote: >> Since the integration of [JDK-8359437](https://bugs.openjdk.org/browse/JDK-8359437) the `LockingMode` flag can no longer be set by the user. After that, a number of PRs has been integrated which has removed all `LockingMode` related code from all platforms (except from zero, which is done in this PR). >> >> This PR removes `LockingMode` related code from the shared (non-platform specific) files. It also removes the `LockingMode` variable itself. >> >> Passes tier1-tier5 with no added problems. > > src/hotspot/share/runtime/basicLock.hpp line 51: > >> 49: void set_bad_metadata_deopt() { set_metadata(badDispHeaderDeopt); } >> 50: >> 51: static int displaced_header_offset_in_bytes() { return metadata_offset_in_bytes(); } > > Also delete line 51 ? Still appears used in LIRAssembler. But the assert in which it is used doesn't really make sense as it just checks the offset == 0. > src/hotspot/share/runtime/lightweightSynchronizer.cpp line 769: > >> 767: >> 768: // LightweightSynchronizer::inflate_locked_or_imse is used to to get an inflated >> 769: // ObjectMonitor* when lightweight locking is used. It is used from contexts > > I guess you don't need the phrase "when lightweight locking is used". Even calling it "lightweight locking" is no longer needed. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2320640694 PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2320651595 From iklam at openjdk.org Thu Sep 4 03:06:29 2025 From: iklam at openjdk.org (Ioi Lam) Date: Thu, 4 Sep 2025 03:06:29 GMT Subject: RFR: 8366474: Rename MetaspaceObj::is_shared() to MetaspaceObj::in_aot_cache() [v3] In-Reply-To: References: Message-ID: > This PR is one (of many) steps in [JDK-8366473](https://bugs.openjdk.org/browse/JDK-8366473) (Refactor CDS source code with new AOT terminology): > > Rename `is_shared()` in `Metaspace` (and various other classes) to `in_aot_cache()` to reflect its true meaning: > - tests if an object is inside the AOT cache's metaspace region. > > Also various forms of "shared metaspace" are updated to "aot metaspace" > > Please start your review with allocations.hpp Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits: - Also renamed ConstantPool::is_shared() because it shadows MetaspaceObj::is_shared() - Merge branch 'master' into 8366474-rename_metaspaceobj_is_shared_to_in_aot_cache - Removed MetaspaceShared -> AOTMetaspace changes that are intended for https://github.com/openjdk/jdk/pull/27017 - 8366474: Rename MetaspaceObj::is_shared() to MetaspaceObj::in_aot_cache() ------------- Changes: https://git.openjdk.org/jdk/pull/27016/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27016&range=02 Stats: 204 lines in 55 files changed: 3 ins; 0 del; 201 mod Patch: https://git.openjdk.org/jdk/pull/27016.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27016/head:pull/27016 PR: https://git.openjdk.org/jdk/pull/27016 From iklam at openjdk.org Thu Sep 4 03:06:29 2025 From: iklam at openjdk.org (Ioi Lam) Date: Thu, 4 Sep 2025 03:06:29 GMT Subject: RFR: 8366474: Rename MetaspaceObj::is_shared() to MetaspaceObj::in_aot_cache() [v2] In-Reply-To: References: Message-ID: On Sat, 30 Aug 2025 17:34:38 GMT, Ioi Lam wrote: >> This PR is one (of many) steps in [JDK-8366473](https://bugs.openjdk.org/browse/JDK-8366473) (Refactor CDS source code with new AOT terminology): >> >> Rename `is_shared()` in `Metaspace` (and various other classes) to `in_aot_cache()` to reflect its true meaning: >> - tests if an object is inside the AOT cache's metaspace region. >> >> Also various forms of "shared metaspace" are updated to "aot metaspace" >> >> Please start your review with allocations.hpp > > Ioi Lam has updated the pull request incrementally with one additional commit since the last revision: > > Removed MetaspaceShared -> AOTMetaspace changes that are intended for https://github.com/openjdk/jdk/pull/27017 I've merged with the mainline to resolve conflicts. I also made one extra fix: `ConstantPool::is_shared()` was shadowing `MetaspaceObj::is_shared()`, so I renamed it to `in_aot_cache()`, so that it will now shadow `MetaspaceObj::in_aot_cache()`. See [17f8c0b](https://github.com/openjdk/jdk/pull/27016/commits/17f8c0bfe302504cd027435fa92cdc58f3362f7c) @vnkozlov @liach could you re-review? ------------- PR Comment: https://git.openjdk.org/jdk/pull/27016#issuecomment-3251598867