Skip to content

Commit a5b1992

Browse files
Merge in jdk-24+31 (24.2)
PullRequest: labsjdk-ce/142
2 parents d70e22a + e6158e2 commit a5b1992

File tree

22 files changed

+234
-21
lines changed

22 files changed

+234
-21
lines changed

src/hotspot/share/cds/metaspaceShared.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,8 +986,10 @@ bool MetaspaceShared::try_link_class(JavaThread* current, InstanceKlass* ik) {
986986
ik->external_name());
987987
CLEAR_PENDING_EXCEPTION;
988988
SystemDictionaryShared::set_class_has_failed_verification(ik);
989+
} else {
990+
assert(!SystemDictionaryShared::has_class_failed_verification(ik), "sanity");
991+
ik->compute_has_loops_flag_for_methods();
989992
}
990-
ik->compute_has_loops_flag_for_methods();
991993
BytecodeVerificationLocal = saved;
992994
return true;
993995
} else {

src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ void ShenandoahGenerationalHeap::gc_threads_do(ThreadClosure* tcl) const {
180180
}
181181

182182
void ShenandoahGenerationalHeap::stop() {
183-
regulator_thread()->stop();
184183
ShenandoahHeap::stop();
184+
regulator_thread()->stop();
185185
}
186186

187187
void ShenandoahGenerationalHeap::evacuate_collection_set(bool concurrent) {

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,6 @@ ShenandoahHeap::ShenandoahHeap(ShenandoahCollectorPolicy* policy) :
538538
_pacer(nullptr),
539539
_verifier(nullptr),
540540
_phase_timings(nullptr),
541-
_mmu_tracker(),
542541
_monitoring_support(nullptr),
543542
_memory_pool(nullptr),
544543
_stw_memory_manager("Shenandoah Pauses"),
@@ -632,6 +631,8 @@ class ShenandoahInitWorkerGCLABClosure : public ThreadClosure {
632631

633632
void ShenandoahHeap::post_initialize() {
634633
CollectedHeap::post_initialize();
634+
635+
// Schedule periodic task to report on gc thread CPU utilization
635636
_mmu_tracker.initialize();
636637

637638
MutexLocker ml(Threads_lock);
@@ -2084,6 +2085,9 @@ void ShenandoahHeap::stop() {
20842085
// Step 0. Notify policy to disable event recording and prevent visiting gc threads during shutdown
20852086
_shenandoah_policy->record_shutdown();
20862087

2088+
// Step 0a. Stop reporting on gc thread cpu utilization
2089+
mmu_tracker()->stop();
2090+
20872091
// Step 1. Notify control thread that we are in shutdown.
20882092
// Note that we cannot do that with stop(), because stop() is blocking and waits for the actual shutdown.
20892093
// Doing stop() here would wait for the normal GC cycle to complete, never falling through to cancel below.

src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class ThreadTimeAccumulator : public ThreadClosure {
4848
size_t total_time;
4949
ThreadTimeAccumulator() : total_time(0) {}
5050
void do_thread(Thread* thread) override {
51+
assert(!thread->has_terminated(), "Cannot get cpu time for terminated thread: " UINTX_FORMAT, thread->osthread()->thread_id_for_printing());
5152
total_time += os::thread_cpu_time(thread);
5253
}
5354
};
@@ -65,7 +66,6 @@ ShenandoahMmuTracker::ShenandoahMmuTracker() :
6566
}
6667

6768
ShenandoahMmuTracker::~ShenandoahMmuTracker() {
68-
_mmu_periodic_task->disenroll();
6969
delete _mmu_periodic_task;
7070
}
7171

@@ -175,6 +175,10 @@ void ShenandoahMmuTracker::report() {
175175
log_debug(gc)("Periodic Sample: GCU = %.3f%%, MU = %.3f%% during most recent %.1fs", gcu * 100, mu * 100, time_delta);
176176
}
177177

178+
void ShenandoahMmuTracker::stop() const {
179+
_mmu_periodic_task->disenroll();
180+
}
181+
178182
void ShenandoahMmuTracker::initialize() {
179183
// initialize static data
180184
_active_processors = os::initial_active_processor_count();

src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ class ShenandoahMmuTracker {
101101
// GCPauseIntervalMillis and defaults to 5 seconds. This method computes
102102
// the MMU over the elapsed interval and records it in a running average.
103103
void report();
104+
105+
// Unenrolls the periodic task that collects CPU utilization for GC threads. This must happen _before_ the
106+
// gc threads are stopped and terminated.
107+
void stop() const;
104108
};
105109

106110
#endif //SHARE_GC_SHENANDOAH_SHENANDOAHMMUTRACKER_HPP

src/hotspot/share/opto/vectornode.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,9 @@ bool VectorCastNode::implemented(int opc, uint vlen, BasicType src_type, BasicTy
14661466
if (is_java_primitive(dst_type) &&
14671467
is_java_primitive(src_type) &&
14681468
(vlen > 1) && is_power_of_2(vlen) &&
1469+
// In rare case, the input to the VectorCast could be a Replicate node. We need to make sure creating is supported:
1470+
// check the src_type:
1471+
VectorNode::vector_size_supported_auto_vectorization(src_type, vlen) &&
14691472
VectorNode::vector_size_supported_auto_vectorization(dst_type, vlen)) {
14701473
int vopc = VectorCastNode::opcode(opc, src_type);
14711474
return vopc > 0 && Matcher::match_rule_supported_auto_vectorization(vopc, vlen, dst_type);

src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,17 @@ private NativeMemorySegmentImpl reinterpretInternal(Class<?> callerClass, long n
145145
Reflection.ensureNativeAccess(callerClass, MemorySegment.class, "reinterpret", false);
146146
Utils.checkNonNegativeArgument(newSize, "newSize");
147147
if (!isNative()) throw new UnsupportedOperationException("Not a native segment");
148-
Runnable action = cleanup != null ?
149-
() -> cleanup.accept(SegmentFactories.makeNativeSegmentUnchecked(address(), newSize)) :
150-
null;
148+
Runnable action = cleanupAction(address(), newSize, cleanup);
151149
return SegmentFactories.makeNativeSegmentUnchecked(address(), newSize, scope, readOnly, action);
152150
}
153151

152+
// Using a static helper method ensures there is no unintended lambda capturing of `this`
153+
private static Runnable cleanupAction(long address, long newSize, Consumer<MemorySegment> cleanup) {
154+
return cleanup != null ?
155+
() -> cleanup.accept(SegmentFactories.makeNativeSegmentUnchecked(address, newSize)) :
156+
null;
157+
}
158+
154159
private AbstractMemorySegmentImpl asSliceNoCheck(long offset, long newSize) {
155160
return dup(offset, newSize, readOnly, scope);
156161
}

src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/PrettyPrintHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*
55
* This code is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU General Public License version 2 only, as
7-
* published by the Free Software Foundation.
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
810
*
911
* This code is distributed in the hope that it will be useful, but WITHOUT
1012
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlConsumer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*
55
* This code is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU General Public License version 2 only, as
7-
* published by the Free Software Foundation.
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
810
*
911
* This code is distributed in the hope that it will be useful, but WITHOUT
1012
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*
55
* This code is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU General Public License version 2 only, as
7-
* published by the Free Software Foundation.
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
810
*
911
* This code is distributed in the hope that it will be useful, but WITHOUT
1012
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

0 commit comments

Comments
 (0)