Skip to content

Commit 617eb10

Browse files
[GR-63602] Merge in jdk-24.0.2+7 (24.2)
PullRequest: labsjdk-ce/174
2 parents 27ea326 + c6aca06 commit 617eb10

File tree

19 files changed

+217
-257
lines changed

19 files changed

+217
-257
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,8 @@ class G1UpdateRegionLivenessAndSelectForRebuildTask : public WorkerTask {
12741274
// The liveness of this humongous obj decided by either its allocation
12751275
// time (allocated after conc-mark-start, i.e. live) or conc-marking.
12761276
const bool is_live = _cm->top_at_mark_start(hr) == hr->bottom()
1277-
|| _cm->contains_live_object(hr->hrm_index());
1277+
|| _cm->contains_live_object(hr->hrm_index())
1278+
|| hr->has_pinned_objects();
12781279
if (is_live) {
12791280
const bool selected_for_rebuild = tracker->update_humongous_before_rebuild(hr);
12801281
auto on_humongous_region = [&] (G1HeapRegion* hr) {
@@ -1291,7 +1292,9 @@ class G1UpdateRegionLivenessAndSelectForRebuildTask : public WorkerTask {
12911292
} else if (hr->is_old()) {
12921293
hr->note_end_of_marking(_cm->top_at_mark_start(hr), _cm->live_bytes(hr->hrm_index()));
12931294

1294-
if (hr->live_bytes() != 0) {
1295+
const bool is_live = hr->live_bytes() != 0
1296+
|| hr->has_pinned_objects();
1297+
if (is_live) {
12951298
if (tracker->update_old_before_rebuild(hr)) {
12961299
_num_selected_for_rebuild++;
12971300
}

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,12 @@ void G1ParScanThreadStateSet::record_unused_optional_region(G1HeapRegion* hr) {
653653
}
654654
}
655655

656+
void G1ParScanThreadState::record_evacuation_failed_region(G1HeapRegion* r, uint worker_id, bool cause_pinned) {
657+
if (_evac_failure_regions->record(worker_id, r->hrm_index(), cause_pinned)) {
658+
G1HeapRegionPrinter::evac_failure(r);
659+
}
660+
}
661+
656662
NOINLINE
657663
oop G1ParScanThreadState::handle_evacuation_failure_par(oop old, markWord m, size_t word_sz, bool cause_pinned) {
658664
assert(_g1h->is_in_cset(old), "Object " PTR_FORMAT " should be in the CSet", p2i(old));
@@ -662,9 +668,7 @@ oop G1ParScanThreadState::handle_evacuation_failure_par(oop old, markWord m, siz
662668
// Forward-to-self succeeded. We are the "owner" of the object.
663669
G1HeapRegion* r = _g1h->heap_region_containing(old);
664670

665-
if (_evac_failure_regions->record(_worker_id, r->hrm_index(), cause_pinned)) {
666-
G1HeapRegionPrinter::evac_failure(r);
667-
}
671+
record_evacuation_failed_region(r, _worker_id, cause_pinned);
668672

669673
// Mark the failing object in the marking bitmap and later use the bitmap to handle
670674
// evacuation failure recovery.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ class G1ParScanThreadState : public CHeapObj<mtGC> {
226226
Tickspan trim_ticks() const;
227227
void reset_trim_ticks();
228228

229+
void record_evacuation_failed_region(G1HeapRegion* r, uint worker_id, bool cause_pinned);
229230
// An attempt to evacuate "obj" has failed; take necessary steps.
230231
oop handle_evacuation_failure_par(oop obj, markWord m, size_t word_sz, bool cause_pinned);
231232

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -661,13 +661,6 @@ void G1Policy::record_concurrent_refinement_stats(size_t pending_cards,
661661

662662
bool G1Policy::should_retain_evac_failed_region(uint index) const {
663663
size_t live_bytes = _g1h->region_at(index)->live_bytes();
664-
665-
#ifdef ASSERT
666-
G1HeapRegion* r = _g1h->region_at(index);
667-
assert(live_bytes != 0,
668-
"live bytes not set for %u used %zu garbage %zu cm-live %zu pinned %d",
669-
index, r->used(), r->garbage_bytes(), live_bytes, r->has_pinned_objects());
670-
#endif
671664
size_t threshold = G1RetainRegionLiveThresholdPercent * G1HeapRegion::GrainBytes / 100;
672665
return live_bytes < threshold;
673666
}

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

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,15 +588,37 @@ class G1ParEvacuateFollowersClosure : public VoidClosure {
588588
};
589589

590590
class G1EvacuateRegionsBaseTask : public WorkerTask {
591+
592+
// All pinned regions in the collection set must be registered as failed
593+
// regions as there is no guarantee that there is a reference reachable by
594+
// Java code (i.e. only by native code) that adds it to the evacuation failed
595+
// regions.
596+
void record_pinned_regions(G1ParScanThreadState* pss, uint worker_id) {
597+
class RecordPinnedRegionClosure : public G1HeapRegionClosure {
598+
G1ParScanThreadState* _pss;
599+
uint _worker_id;
600+
601+
public:
602+
RecordPinnedRegionClosure(G1ParScanThreadState* pss, uint worker_id) : _pss(pss), _worker_id(worker_id) { }
603+
604+
bool do_heap_region(G1HeapRegion* r) {
605+
if (r->has_pinned_objects()) {
606+
_pss->record_evacuation_failed_region(r, _worker_id, true /* cause_pinned */);
607+
}
608+
return false;
609+
}
610+
} cl(pss, worker_id);
611+
612+
_g1h->collection_set_iterate_increment_from(&cl, worker_id);
613+
}
614+
591615
protected:
592616
G1CollectedHeap* _g1h;
593617
G1ParScanThreadStateSet* _per_thread_states;
594618

595619
G1ScannerTasksQueueSet* _task_queues;
596620
TaskTerminator _terminator;
597621

598-
uint _num_workers;
599-
600622
void evacuate_live_objects(G1ParScanThreadState* pss,
601623
uint worker_id,
602624
G1GCPhaseTimes::GCParPhases objcopy_phase,
@@ -632,6 +654,9 @@ class G1EvacuateRegionsBaseTask : public WorkerTask {
632654

633655
virtual void evacuate_live_objects(G1ParScanThreadState* pss, uint worker_id) = 0;
634656

657+
private:
658+
volatile bool _pinned_regions_recorded;
659+
635660
public:
636661
G1EvacuateRegionsBaseTask(const char* name,
637662
G1ParScanThreadStateSet* per_thread_states,
@@ -642,7 +667,7 @@ class G1EvacuateRegionsBaseTask : public WorkerTask {
642667
_per_thread_states(per_thread_states),
643668
_task_queues(task_queues),
644669
_terminator(num_workers, _task_queues),
645-
_num_workers(num_workers)
670+
_pinned_regions_recorded(false)
646671
{ }
647672

648673
void work(uint worker_id) {
@@ -654,6 +679,9 @@ class G1EvacuateRegionsBaseTask : public WorkerTask {
654679
G1ParScanThreadState* pss = _per_thread_states->state_for_worker(worker_id);
655680
pss->set_ref_discoverer(_g1h->ref_processor_stw());
656681

682+
if (!Atomic::cmpxchg(&_pinned_regions_recorded, false, true)) {
683+
record_pinned_regions(pss, worker_id);
684+
}
657685
scan_roots(pss, worker_id);
658686
evacuate_live_objects(pss, worker_id);
659687
}

src/java.base/share/classes/sun/security/validator/CamerfirmaTLSPolicy.java

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,14 @@ final class CamerfirmaTLSPolicy {
4343

4444
private static final Debug debug = Debug.getInstance("certpath");
4545

46-
// SHA-256 certificate fingerprints of distrusted roots
47-
private static final Set<String> FINGERPRINTS = Set.of(
48-
// cacerts alias: camerfirmachamberscommerceca
49-
// DN: CN=Chambers of Commerce Root,
50-
// OU=http://www.chambersign.org,
51-
// O=AC Camerfirma SA CIF A82743287, C=EU
52-
"0C258A12A5674AEF25F28BA7DCFAECEEA348E541E6F5CC4EE63B71B361606AC3",
53-
// cacerts alias: camerfirmachambersca
54-
// DN: CN=Chambers of Commerce Root - 2008,
55-
// O=AC Camerfirma S.A., SERIALNUMBER=A82743287,
56-
// L=Madrid (see current address at www.camerfirma.com/address),
57-
// C=EU
58-
"063E4AFAC491DFD332F3089B8542E94617D893D7FE944E10A7937EE29D9693C0",
59-
// cacerts alias: camerfirmachambersignca
60-
// DN: CN=Global Chambersign Root - 2008,
61-
// O=AC Camerfirma S.A., SERIALNUMBER=A82743287,
62-
// L=Madrid (see current address at www.camerfirma.com/address),
63-
// C=EU
64-
"136335439334A7698016A0D324DE72284E079D7B5220BB8FBD747816EEBEBACA"
65-
);
46+
// SHA-256 certificate fingerprint of distrusted root for TLS
47+
// cacerts alias: camerfirmachambersca
48+
// DN: CN=Chambers of Commerce Root - 2008,
49+
// O=AC Camerfirma S.A., SERIALNUMBER=A82743287,
50+
// L=Madrid (see current address at www.camerfirma.com/address),
51+
// C=EU
52+
private static final String FINGERPRINT =
53+
"063E4AFAC491DFD332F3089B8542E94617D893D7FE944E10A7937EE29D9693C0";
6654

6755
// Any TLS Server certificate that is anchored by one of the Camerfirma
6856
// roots above and is issued after this date will be distrusted.
@@ -85,7 +73,7 @@ static void checkDistrust(X509Certificate[] chain)
8573
throw new ValidatorException("Cannot generate fingerprint for "
8674
+ "trust anchor of TLS server certificate");
8775
}
88-
if (FINGERPRINTS.contains(fp)) {
76+
if (FINGERPRINT.equalsIgnoreCase(fp)) {
8977
Date notBefore = chain[0].getNotBefore();
9078
LocalDate ldNotBefore = LocalDate.ofInstant(notBefore.toInstant(),
9179
ZoneOffset.UTC);

src/java.base/share/data/cacerts/camerfirmachamberscommerceca

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/java.base/share/data/cacerts/camerfirmachambersignca

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,8 @@ @implementation CGGI_GlyphCanvas
494494
const CGGI_RenderingMode* mode)
495495
{
496496
if (canvas->image != NULL &&
497-
width * CGGI_GLYPH_CANVAS_SLACK <= canvas->image->width &&
498-
height * CGGI_GLYPH_CANVAS_SLACK <= canvas->image->height)
497+
width < canvas->image->width &&
498+
height < canvas->image->height)
499499
{
500500
return;
501501
}

src/java.net.http/share/classes/jdk/internal/net/http/HttpRequestImpl.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import java.net.http.HttpClient;
4040
import java.net.http.HttpHeaders;
4141
import java.net.http.HttpRequest;
42+
import java.util.function.BiPredicate;
4243

4344
import jdk.internal.net.http.common.Alpns;
4445
import jdk.internal.net.http.common.HttpHeadersBuilder;
@@ -148,7 +149,11 @@ public static HttpRequestImpl newInstanceForRedirection(URI uri,
148149
String method,
149150
HttpRequestImpl other,
150151
boolean mayHaveBody) {
151-
return new HttpRequestImpl(uri, method, other, mayHaveBody);
152+
if (uri.getScheme().equalsIgnoreCase(other.uri.getScheme()) &&
153+
uri.getRawAuthority().equals(other.uri.getRawAuthority())) {
154+
return new HttpRequestImpl(uri, method, other, mayHaveBody, Optional.empty());
155+
}
156+
return new HttpRequestImpl(uri, method, other, mayHaveBody, Optional.of(Utils.ALLOWED_REDIRECT_HEADERS));
152157
}
153158

154159
/** Returns a new instance suitable for authentication. */
@@ -168,9 +173,19 @@ private HttpRequestImpl(URI uri,
168173
String method,
169174
HttpRequestImpl other,
170175
boolean mayHaveBody) {
176+
this(uri, method, other, mayHaveBody, Optional.empty());
177+
}
178+
179+
private HttpRequestImpl(URI uri,
180+
String method,
181+
HttpRequestImpl other,
182+
boolean mayHaveBody,
183+
Optional<BiPredicate<String, String>> redirectHeadersFilter) {
171184
assert method == null || Utils.isValidName(method);
172-
this.method = method == null? "GET" : method;
173-
this.userHeaders = other.userHeaders;
185+
this.method = method == null ? "GET" : method;
186+
HttpHeaders userHeaders = redirectHeadersFilter.isPresent() ?
187+
HttpHeaders.of(other.userHeaders.map(), redirectHeadersFilter.get()) : other.userHeaders;
188+
this.userHeaders = userHeaders;
174189
this.isWebSocket = other.isWebSocket;
175190
this.systemHeadersBuilder = new HttpHeadersBuilder();
176191
if (userHeaders.firstValue("User-Agent").isEmpty()) {

0 commit comments

Comments
 (0)