Skip to content

Commit 6b8121b

Browse files
authored
Merge pull request #1970 from SAP/pr-jdk-21.0.8+4
Merge to tag jdk-21.0.8+4
2 parents 80917ca + a1e5891 commit 6b8121b

File tree

818 files changed

+11857
-9032
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

818 files changed

+11857
-9032
lines changed

make/modules/java.desktop/lib/Awt2dLibraries.gmk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBLCMS, \
309309
common/awt/debug \
310310
libawt/java2d, \
311311
HEADERS_FROM_SRC := $(LIBLCMS_HEADERS_FROM_SRC), \
312-
DISABLED_WARNINGS_gcc := format-nonliteral type-limits stringop-truncation, \
312+
DISABLED_WARNINGS_gcc := format-nonliteral stringop-truncation, \
313313
DISABLED_WARNINGS_clang := format-nonliteral, \
314314
LDFLAGS := $(LDFLAGS_JDKLIB) \
315315
$(call SET_SHARED_LIBRARY_ORIGIN), \

src/hotspot/os/aix/os_perf_aix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ enum {
7373
* Get info for requested PID from /proc/<pid>/psinfo file
7474
*/
7575
static bool read_psinfo(const u_longlong_t& pid, psinfo_t& psinfo) {
76-
static size_t BUF_LENGTH = 32 + sizeof(u_longlong_t);
76+
const size_t BUF_LENGTH = 32 + sizeof(u_longlong_t);
7777

7878
FILE* fp;
7979
char buf[BUF_LENGTH];

src/hotspot/share/compiler/compileBroker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2234,7 +2234,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
22342234
}
22352235
}
22362236
}
2237-
if (!task->is_success()) {
2237+
if (!task->is_success() && !JVMCI::in_shutdown()) {
22382238
handle_compile_error(thread, task, nullptr, compilable, failure_reason);
22392239
}
22402240
if (event.should_commit()) {

src/hotspot/share/gc/g1/g1RemSet.cpp

Lines changed: 81 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -760,27 +760,71 @@ class G1ScanAndCountCodeBlobClosure : public CodeBlobClosure {
760760

761761
// Heap region closure to be applied to all regions in the current collection set
762762
// increment to fix up non-card related roots.
763-
class G1ScanCollectionSetRegionClosure : public HeapRegionClosure {
763+
class G1ScanCodeRootsClosure : public HeapRegionClosure {
764764
G1ParScanThreadState* _pss;
765765
G1RemSetScanState* _scan_state;
766766

767-
G1GCPhaseTimes::GCParPhases _scan_phase;
768-
G1GCPhaseTimes::GCParPhases _code_roots_phase;
769-
770767
uint _worker_id;
771768

772769
size_t _code_roots_scanned;
773770

771+
public:
772+
G1ScanCodeRootsClosure(G1RemSetScanState* scan_state,
773+
G1ParScanThreadState* pss,
774+
uint worker_id) :
775+
_pss(pss),
776+
_scan_state(scan_state),
777+
_worker_id(worker_id),
778+
_code_roots_scanned(0) { }
779+
780+
bool do_heap_region(HeapRegion* r) {
781+
// Scan the code root list attached to the current region
782+
G1ScanAndCountCodeBlobClosure cl(_pss->closures()->weak_codeblobs());
783+
r->code_roots_do(&cl);
784+
_code_roots_scanned += cl.count();
785+
return false;
786+
}
787+
788+
size_t code_roots_scanned() const { return _code_roots_scanned; }
789+
};
790+
791+
void G1RemSet::scan_collection_set_code_roots(G1ParScanThreadState* pss,
792+
uint worker_id,
793+
G1GCPhaseTimes::GCParPhases coderoots_phase,
794+
G1GCPhaseTimes::GCParPhases objcopy_phase) {
795+
EventGCPhaseParallel event;
796+
797+
Tickspan code_root_scan_time;
798+
Tickspan code_root_trim_partially_time;
799+
G1EvacPhaseWithTrimTimeTracker timer(pss, code_root_scan_time, code_root_trim_partially_time);
800+
801+
G1GCPhaseTimes* p = _g1h->phase_times();
802+
803+
G1ScanCodeRootsClosure cl(_scan_state, pss, worker_id);
804+
// Code roots work distribution occurs inside the iteration method. So scan all collection
805+
// set regions for all threads.
806+
_g1h->collection_set_iterate_increment_from(&cl, worker_id);
807+
808+
p->record_or_add_time_secs(coderoots_phase, worker_id, code_root_scan_time.seconds());
809+
p->add_time_secs(objcopy_phase, worker_id, code_root_trim_partially_time.seconds());
810+
811+
p->record_or_add_thread_work_item(coderoots_phase, worker_id, cl.code_roots_scanned(), G1GCPhaseTimes::CodeRootsScannedNMethods);
812+
813+
event.commit(GCId::current(), worker_id, G1GCPhaseTimes::phase_name(coderoots_phase));
814+
}
815+
816+
class G1ScanOptionalRemSetRootsClosure : public HeapRegionClosure {
817+
G1ParScanThreadState* _pss;
818+
819+
uint _worker_id;
820+
821+
G1GCPhaseTimes::GCParPhases _scan_phase;
822+
774823
size_t _opt_roots_scanned;
824+
775825
size_t _opt_refs_scanned;
776826
size_t _opt_refs_memory_used;
777827

778-
Tickspan _code_root_scan_time;
779-
Tickspan _code_trim_partially_time;
780-
781-
Tickspan _rem_set_opt_root_scan_time;
782-
Tickspan _rem_set_opt_trim_partially_time;
783-
784828
void scan_opt_rem_set_roots(HeapRegion* r) {
785829
G1OopStarChunkedList* opt_rem_set_list = _pss->oops_into_optional_region(r);
786830

@@ -791,92 +835,58 @@ class G1ScanCollectionSetRegionClosure : public HeapRegionClosure {
791835
}
792836

793837
public:
794-
G1ScanCollectionSetRegionClosure(G1RemSetScanState* scan_state,
795-
G1ParScanThreadState* pss,
838+
G1ScanOptionalRemSetRootsClosure(G1ParScanThreadState* pss,
796839
uint worker_id,
797-
G1GCPhaseTimes::GCParPhases scan_phase,
798-
G1GCPhaseTimes::GCParPhases code_roots_phase) :
840+
G1GCPhaseTimes::GCParPhases scan_phase) :
799841
_pss(pss),
800-
_scan_state(scan_state),
801-
_scan_phase(scan_phase),
802-
_code_roots_phase(code_roots_phase),
803842
_worker_id(worker_id),
804-
_code_roots_scanned(0),
843+
_scan_phase(scan_phase),
805844
_opt_roots_scanned(0),
806845
_opt_refs_scanned(0),
807-
_opt_refs_memory_used(0),
808-
_code_root_scan_time(),
809-
_code_trim_partially_time(),
810-
_rem_set_opt_root_scan_time(),
811-
_rem_set_opt_trim_partially_time() { }
846+
_opt_refs_memory_used(0) { }
812847

813-
bool do_heap_region(HeapRegion* r) {
814-
// The individual references for the optional remembered set are per-worker, so we
815-
// always need to scan them.
848+
bool do_heap_region(HeapRegion* r) override {
816849
if (r->has_index_in_opt_cset()) {
817-
EventGCPhaseParallel event;
818-
G1EvacPhaseWithTrimTimeTracker timer(_pss, _rem_set_opt_root_scan_time, _rem_set_opt_trim_partially_time);
819850
scan_opt_rem_set_roots(r);
820-
821-
event.commit(GCId::current(), _worker_id, G1GCPhaseTimes::phase_name(_scan_phase));
822-
}
823-
824-
// Scan code root remembered sets.
825-
{
826-
EventGCPhaseParallel event;
827-
G1EvacPhaseWithTrimTimeTracker timer(_pss, _code_root_scan_time, _code_trim_partially_time);
828-
G1ScanAndCountCodeBlobClosure cl(_pss->closures()->weak_codeblobs());
829-
830-
// Scan the code root list attached to the current region
831-
r->code_roots_do(&cl);
832-
833-
_code_roots_scanned += cl.count();
834-
835-
event.commit(GCId::current(), _worker_id, G1GCPhaseTimes::phase_name(_code_roots_phase));
836851
}
837-
838852
return false;
839853
}
840854

841-
Tickspan code_root_scan_time() const { return _code_root_scan_time; }
842-
Tickspan code_root_trim_partially_time() const { return _code_trim_partially_time; }
843-
844-
size_t code_roots_scanned() const { return _code_roots_scanned; }
845-
846-
Tickspan rem_set_opt_root_scan_time() const { return _rem_set_opt_root_scan_time; }
847-
Tickspan rem_set_opt_trim_partially_time() const { return _rem_set_opt_trim_partially_time; }
848-
849855
size_t opt_roots_scanned() const { return _opt_roots_scanned; }
850856
size_t opt_refs_scanned() const { return _opt_refs_scanned; }
851857
size_t opt_refs_memory_used() const { return _opt_refs_memory_used; }
852858
};
853859

854-
void G1RemSet::scan_collection_set_regions(G1ParScanThreadState* pss,
855-
uint worker_id,
856-
G1GCPhaseTimes::GCParPhases scan_phase,
857-
G1GCPhaseTimes::GCParPhases coderoots_phase,
858-
G1GCPhaseTimes::GCParPhases objcopy_phase) {
859-
G1ScanCollectionSetRegionClosure cl(_scan_state, pss, worker_id, scan_phase, coderoots_phase);
860-
_g1h->collection_set_iterate_increment_from(&cl, worker_id);
860+
void G1RemSet::scan_collection_set_optional_roots(G1ParScanThreadState* pss,
861+
uint worker_id,
862+
G1GCPhaseTimes::GCParPhases scan_phase,
863+
G1GCPhaseTimes::GCParPhases objcopy_phase) {
864+
assert(scan_phase == G1GCPhaseTimes::OptScanHR, "must be");
865+
866+
EventGCPhaseParallel event;
867+
868+
Tickspan rem_set_opt_root_scan_time;
869+
Tickspan rem_set_opt_trim_partially_time;
870+
G1EvacPhaseWithTrimTimeTracker timer(pss, rem_set_opt_root_scan_time, rem_set_opt_trim_partially_time);
861871

862872
G1GCPhaseTimes* p = _g1h->phase_times();
863873

864-
p->record_or_add_time_secs(scan_phase, worker_id, cl.rem_set_opt_root_scan_time().seconds());
865-
p->record_or_add_time_secs(scan_phase, worker_id, cl.rem_set_opt_trim_partially_time().seconds());
874+
G1ScanOptionalRemSetRootsClosure cl(pss, worker_id, scan_phase);
875+
// The individual references for the optional remembered set are per-worker, so every worker
876+
// always need to scan all regions (no claimer).
877+
_g1h->collection_set_iterate_increment_from(&cl, worker_id);
866878

867-
p->record_or_add_time_secs(coderoots_phase, worker_id, cl.code_root_scan_time().seconds());
868-
p->record_or_add_thread_work_item(coderoots_phase, worker_id, cl.code_roots_scanned(), G1GCPhaseTimes::CodeRootsScannedNMethods);
879+
p->record_or_add_time_secs(scan_phase, worker_id, rem_set_opt_root_scan_time.seconds());
880+
p->record_or_add_time_secs(objcopy_phase, worker_id, rem_set_opt_trim_partially_time.seconds());
869881

870-
p->add_time_secs(objcopy_phase, worker_id, cl.code_root_trim_partially_time().seconds());
882+
p->record_or_add_thread_work_item(scan_phase, worker_id, cl.opt_roots_scanned(), G1GCPhaseTimes::ScanHRFoundRoots);
883+
p->record_or_add_thread_work_item(scan_phase, worker_id, cl.opt_refs_scanned(), G1GCPhaseTimes::ScanHRScannedOptRefs);
884+
p->record_or_add_thread_work_item(scan_phase, worker_id, cl.opt_refs_memory_used(), G1GCPhaseTimes::ScanHRUsedMemory);
871885

872-
// At this time we record some metrics only for the evacuations after the initial one.
873-
if (scan_phase == G1GCPhaseTimes::OptScanHR) {
874-
p->record_or_add_thread_work_item(scan_phase, worker_id, cl.opt_roots_scanned(), G1GCPhaseTimes::ScanHRFoundRoots);
875-
p->record_or_add_thread_work_item(scan_phase, worker_id, cl.opt_refs_scanned(), G1GCPhaseTimes::ScanHRScannedOptRefs);
876-
p->record_or_add_thread_work_item(scan_phase, worker_id, cl.opt_refs_memory_used(), G1GCPhaseTimes::ScanHRUsedMemory);
877-
}
886+
event.commit(GCId::current(), worker_id, G1GCPhaseTimes::phase_name(scan_phase));
878887
}
879888

889+
880890
#ifdef ASSERT
881891
void G1RemSet::assert_scan_top_is_null(uint hrm_index) {
882892
assert(_scan_state->scan_top(hrm_index) == nullptr,

src/hotspot/share/gc/g1/g1RemSet.hpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,15 @@ class G1RemSet: public CHeapObj<mtGC> {
113113

114114
// Do work for regions in the current increment of the collection set, scanning
115115
// non-card based (heap) roots.
116-
void scan_collection_set_regions(G1ParScanThreadState* pss,
117-
uint worker_id,
118-
G1GCPhaseTimes::GCParPhases scan_phase,
119-
G1GCPhaseTimes::GCParPhases coderoots_phase,
120-
G1GCPhaseTimes::GCParPhases objcopy_phase);
116+
void scan_collection_set_code_roots(G1ParScanThreadState* pss,
117+
uint worker_id,
118+
G1GCPhaseTimes::GCParPhases coderoots_phase,
119+
G1GCPhaseTimes::GCParPhases objcopy_phase);
120+
121+
void scan_collection_set_optional_roots(G1ParScanThreadState* pss,
122+
uint worker_id,
123+
G1GCPhaseTimes::GCParPhases scan_phase,
124+
G1GCPhaseTimes::GCParPhases objcopy_phase);
121125

122126
// Two methods for concurrent refinement support, executed concurrently to
123127
// the mutator:

src/hotspot/share/gc/g1/g1YoungCollector.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,10 @@ class G1EvacuateRegionsBaseTask : public WorkerTask {
573573
protected:
574574
G1CollectedHeap* _g1h;
575575
G1ParScanThreadStateSet* _per_thread_states;
576+
576577
G1ScannerTasksQueueSet* _task_queues;
577578
TaskTerminator _terminator;
579+
578580
uint _num_workers;
579581

580582
void evacuate_live_objects(G1ParScanThreadState* pss,
@@ -649,7 +651,22 @@ class G1EvacuateRegionsTask : public G1EvacuateRegionsBaseTask {
649651
void scan_roots(G1ParScanThreadState* pss, uint worker_id) {
650652
_root_processor->evacuate_roots(pss, worker_id);
651653
_g1h->rem_set()->scan_heap_roots(pss, worker_id, G1GCPhaseTimes::ScanHR, G1GCPhaseTimes::ObjCopy, _has_optional_evacuation_work);
652-
_g1h->rem_set()->scan_collection_set_regions(pss, worker_id, G1GCPhaseTimes::ScanHR, G1GCPhaseTimes::CodeRoots, G1GCPhaseTimes::ObjCopy);
654+
_g1h->rem_set()->scan_collection_set_code_roots(pss, worker_id, G1GCPhaseTimes::CodeRoots, G1GCPhaseTimes::ObjCopy);
655+
// There are no optional roots to scan right now.
656+
#ifdef ASSERT
657+
class VerifyOptionalCollectionSetRootsEmptyClosure : public HeapRegionClosure {
658+
G1ParScanThreadState* _pss;
659+
660+
public:
661+
VerifyOptionalCollectionSetRootsEmptyClosure(G1ParScanThreadState* pss) : _pss(pss) { }
662+
663+
bool do_heap_region(HeapRegion* r) override {
664+
assert(!r->has_index_in_opt_cset(), "must be");
665+
return false;
666+
}
667+
} cl(pss);
668+
_g1h->collection_set_iterate_increment_from(&cl, worker_id);
669+
#endif
653670
}
654671

655672
void evacuate_live_objects(G1ParScanThreadState* pss, uint worker_id) {
@@ -718,7 +735,8 @@ class G1EvacuateOptionalRegionsTask : public G1EvacuateRegionsBaseTask {
718735

719736
void scan_roots(G1ParScanThreadState* pss, uint worker_id) {
720737
_g1h->rem_set()->scan_heap_roots(pss, worker_id, G1GCPhaseTimes::OptScanHR, G1GCPhaseTimes::OptObjCopy, true /* remember_already_scanned_cards */);
721-
_g1h->rem_set()->scan_collection_set_regions(pss, worker_id, G1GCPhaseTimes::OptScanHR, G1GCPhaseTimes::OptCodeRoots, G1GCPhaseTimes::OptObjCopy);
738+
_g1h->rem_set()->scan_collection_set_code_roots(pss, worker_id, G1GCPhaseTimes::OptCodeRoots, G1GCPhaseTimes::OptObjCopy);
739+
_g1h->rem_set()->scan_collection_set_optional_roots(pss, worker_id, G1GCPhaseTimes::OptScanHR, G1GCPhaseTimes::ObjCopy);
722740
}
723741

724742
void evacuate_live_objects(G1ParScanThreadState* pss, uint worker_id) {

src/java.base/unix/native/libjava/java_props_md.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -521,11 +521,14 @@ GetJavaProperties(JNIEnv *env)
521521
{
522522
char buf[MAXPATHLEN];
523523
errno = 0;
524-
if (getcwd(buf, sizeof(buf)) == NULL)
524+
if (getcwd(buf, sizeof(buf)) == NULL) {
525525
JNU_ThrowByName(env, "java/lang/Error",
526-
"Properties init: Could not determine current working directory.");
527-
else
526+
"Properties init: Could not determine current working directory.");
527+
return NULL;
528+
}
529+
else {
528530
sprops.user_dir = strdup(buf);
531+
}
529532
}
530533

531534
sprops.file_separator = "/";

src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
33
*/
44
/*
55
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -57,7 +57,7 @@
5757
* @author G. Todd Miller
5858
* @author Morten Jorgensen
5959
* @author John Howard (johnh@schemasoft.com)
60-
* @LastModified: Jan 2022
60+
* @LastModified: Feb 2025
6161
*/
6262
public final class XSLTC {
6363

@@ -730,7 +730,6 @@ public boolean setDestDirectory(String dstDirName) {
730730
*/
731731
public void setPackageName(String packageName) {
732732
_packageName = Objects.requireNonNull(packageName);
733-
if (_className != null) setClassName(_className);
734733
}
735734

736735
/**

src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
33
*/
44
/*
55
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -88,7 +88,7 @@
8888
* @author G. Todd Miller
8989
* @author Morten Jorgensen
9090
* @author Santiago Pericas-Geertsen
91-
* @LastModified: Jan 2022
91+
* @LastModified: Feb 2025
9292
*/
9393
public class TransformerFactoryImpl
9494
extends SAXTransformerFactory implements SourceLoader
@@ -1004,9 +1004,6 @@ public Templates newTemplates(Source source)
10041004
// Set the attributes for translet generation
10051005
int outputType = XSLTC.BYTEARRAY_OUTPUT;
10061006
if (_generateTranslet || _autoTranslet) {
1007-
// Set the translet name
1008-
xsltc.setClassName(getTransletBaseName(source));
1009-
10101007
if (_destinationDirectory != null)
10111008
xsltc.setDestDirectory(_destinationDirectory);
10121009
else {
@@ -1020,8 +1017,11 @@ public Templates newTemplates(Source source)
10201017
}
10211018
}
10221019

1020+
// set package name
10231021
if (_packageName != null)
10241022
xsltc.setPackageName(_packageName);
1023+
// Set the translet name
1024+
xsltc.setClassName(getTransletBaseName(source));
10251025

10261026
if (_jarFileName != null) {
10271027
xsltc.setJarFileName(_jarFileName);

src/jdk.internal.le/share/classes/jdk/internal/org/jline/JdkConsoleProviderImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ public class JdkConsoleProviderImpl implements JdkConsoleProvider {
5151
public JdkConsole console(boolean isTTY, Charset charset) {
5252
try {
5353
Terminal terminal = TerminalBuilder.builder().encoding(charset)
54-
.exec(false).build();
54+
.exec(false)
55+
.nativeSignals(false)
56+
.build();
5557
return new JdkConsoleImpl(terminal);
5658
} catch (IllegalStateException ise) {
5759
//cannot create a non-dumb, non-exec terminal,

0 commit comments

Comments
 (0)