Skip to content

Commit 86a7bac

Browse files
Merge tag 'jdk-24+18' into labsjdk/adopt-jdk-24+18-master
Added tag jdk-24+18 for changeset 19642bd
2 parents 7824c14 + 19642bd commit 86a7bac

File tree

447 files changed

+22796
-4175
lines changed

Some content is hidden

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

447 files changed

+22796
-4175
lines changed

make/hotspot/gensrc/GensrcAdlc.gmk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,13 @@ ifeq ($(call check-jvm-feature, compiler2), true)
200200
)))
201201
endif
202202

203+
ifeq ($(call check-jvm-feature, g1gc), true)
204+
AD_SRC_FILES += $(call uniq, $(wildcard $(foreach d, $(AD_SRC_ROOTS), \
205+
$d/cpu/$(HOTSPOT_TARGET_CPU_ARCH)/gc/g1/g1_$(HOTSPOT_TARGET_CPU).ad \
206+
$d/cpu/$(HOTSPOT_TARGET_CPU_ARCH)/gc/g1/g1_$(HOTSPOT_TARGET_CPU_ARCH).ad \
207+
)))
208+
endif
209+
203210
SINGLE_AD_SRCFILE := $(ADLC_SUPPORT_DIR)/all-ad-src.ad
204211

205212
INSERT_FILENAME_AWK_SCRIPT := \

make/jdk/src/classes/build/tools/tzdb/TzdbZoneRulesCompiler.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 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
@@ -273,16 +273,16 @@ private void outputFile(Path dstFile, String version,
273273
// link version-region-rules
274274
out.writeShort(builtZones.size());
275275
for (Map.Entry<String, ZoneRules> entry : builtZones.entrySet()) {
276-
int regionIndex = Arrays.binarySearch(regionArray, entry.getKey());
276+
int regionIndex = findRegionIndex(regionArray, entry.getKey());
277277
int rulesIndex = rulesList.indexOf(entry.getValue());
278278
out.writeShort(regionIndex);
279279
out.writeShort(rulesIndex);
280280
}
281281
// alias-region
282282
out.writeShort(links.size());
283283
for (Map.Entry<String, String> entry : links.entrySet()) {
284-
int aliasIndex = Arrays.binarySearch(regionArray, entry.getKey());
285-
int regionIndex = Arrays.binarySearch(regionArray, entry.getValue());
284+
int aliasIndex = findRegionIndex(regionArray, entry.getKey());
285+
int regionIndex = findRegionIndex(regionArray, entry.getValue());
286286
out.writeShort(aliasIndex);
287287
out.writeShort(regionIndex);
288288
}
@@ -294,6 +294,14 @@ private void outputFile(Path dstFile, String version,
294294
}
295295
}
296296

297+
private static int findRegionIndex(String[] regionArray, String region) {
298+
int index = Arrays.binarySearch(regionArray, region);
299+
if (index < 0) {
300+
throw new IllegalArgumentException("Unknown region: " + region);
301+
}
302+
return index;
303+
}
304+
297305
/** Whether to output verbose messages. */
298306
private boolean verbose;
299307

src/hotspot/cpu/aarch64/aarch64.ad

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,7 +2620,8 @@ static bool is_vector_bitwise_not_pattern(Node* n, Node* m) {
26202620
bool Matcher::pd_clone_node(Node* n, Node* m, Matcher::MStack& mstack) {
26212621
if (is_vshift_con_pattern(n, m) ||
26222622
is_vector_bitwise_not_pattern(n, m) ||
2623-
is_valid_sve_arith_imm_pattern(n, m)) {
2623+
is_valid_sve_arith_imm_pattern(n, m) ||
2624+
is_encode_and_store_pattern(n, m)) {
26242625
mstack.push(m, Visit);
26252626
return true;
26262627
}
@@ -6410,7 +6411,7 @@ instruct loadP(iRegPNoSp dst, memory mem)
64106411
instruct loadN(iRegNNoSp dst, memory mem)
64116412
%{
64126413
match(Set dst (LoadN mem));
6413-
predicate(!needs_acquiring_load(n));
6414+
predicate(!needs_acquiring_load(n) && n->as_Load()->barrier_data() == 0);
64146415

64156416
ins_cost(4 * INSN_COST);
64166417
format %{ "ldrw $dst, $mem\t# compressed ptr" %}
@@ -6839,7 +6840,7 @@ instruct storeimmP0(immP0 zero, memory mem)
68396840
instruct storeN(iRegN src, memory mem)
68406841
%{
68416842
match(Set mem (StoreN mem src));
6842-
predicate(!needs_releasing_store(n));
6843+
predicate(!needs_releasing_store(n) && n->as_Store()->barrier_data() == 0);
68436844

68446845
ins_cost(INSN_COST);
68456846
format %{ "strw $src, $mem\t# compressed ptr" %}
@@ -6852,7 +6853,7 @@ instruct storeN(iRegN src, memory mem)
68526853
instruct storeImmN0(immN0 zero, memory mem)
68536854
%{
68546855
match(Set mem (StoreN mem zero));
6855-
predicate(!needs_releasing_store(n));
6856+
predicate(!needs_releasing_store(n) && n->as_Store()->barrier_data() == 0);
68566857

68576858
ins_cost(INSN_COST);
68586859
format %{ "strw zr, $mem\t# compressed ptr" %}
@@ -7086,6 +7087,7 @@ instruct loadP_volatile(iRegPNoSp dst, /* sync_memory*/indirect mem)
70867087
instruct loadN_volatile(iRegNNoSp dst, /* sync_memory*/indirect mem)
70877088
%{
70887089
match(Set dst (LoadN mem));
7090+
predicate(n->as_Load()->barrier_data() == 0);
70897091

70907092
ins_cost(VOLATILE_REF_COST);
70917093
format %{ "ldarw $dst, $mem\t# compressed ptr" %}
@@ -7253,6 +7255,7 @@ instruct storeimmP0_volatile(immP0 zero, /* sync_memory*/indirect mem)
72537255
instruct storeN_volatile(iRegN src, /* sync_memory*/indirect mem)
72547256
%{
72557257
match(Set mem (StoreN mem src));
7258+
predicate(n->as_Store()->barrier_data() == 0);
72567259

72577260
ins_cost(VOLATILE_REF_COST);
72587261
format %{ "stlrw $src, $mem\t# compressed ptr" %}
@@ -7265,6 +7268,7 @@ instruct storeN_volatile(iRegN src, /* sync_memory*/indirect mem)
72657268
instruct storeimmN0_volatile(immN0 zero, /* sync_memory*/indirect mem)
72667269
%{
72677270
match(Set mem (StoreN mem zero));
7271+
predicate(n->as_Store()->barrier_data() == 0);
72687272

72697273
ins_cost(VOLATILE_REF_COST);
72707274
format %{ "stlrw zr, $mem\t# compressed ptr" %}
@@ -8061,6 +8065,7 @@ instruct compareAndSwapP(iRegINoSp res, indirect mem, iRegP oldval, iRegP newval
80618065
instruct compareAndSwapN(iRegINoSp res, indirect mem, iRegNNoSp oldval, iRegNNoSp newval, rFlagsReg cr) %{
80628066

80638067
match(Set res (CompareAndSwapN mem (Binary oldval newval)));
8068+
predicate(n->as_LoadStore()->barrier_data() == 0);
80648069
ins_cost(2 * VOLATILE_REF_COST);
80658070

80668071
effect(KILL cr);
@@ -8175,7 +8180,7 @@ instruct compareAndSwapPAcq(iRegINoSp res, indirect mem, iRegP oldval, iRegP new
81758180

81768181
instruct compareAndSwapNAcq(iRegINoSp res, indirect mem, iRegNNoSp oldval, iRegNNoSp newval, rFlagsReg cr) %{
81778182

8178-
predicate(needs_acquiring_load_exclusive(n));
8183+
predicate(needs_acquiring_load_exclusive(n) && n->as_LoadStore()->barrier_data() == 0);
81798184
match(Set res (CompareAndSwapN mem (Binary oldval newval)));
81808185
ins_cost(VOLATILE_REF_COST);
81818186

@@ -8280,6 +8285,7 @@ instruct compareAndExchangeL(iRegLNoSp res, indirect mem, iRegL oldval, iRegL ne
82808285
// This pattern is generated automatically from cas.m4.
82818286
// DO NOT EDIT ANYTHING IN THIS SECTION OF THE FILE
82828287
instruct compareAndExchangeN(iRegNNoSp res, indirect mem, iRegN oldval, iRegN newval, rFlagsReg cr) %{
8288+
predicate(n->as_LoadStore()->barrier_data() == 0);
82838289
match(Set res (CompareAndExchangeN mem (Binary oldval newval)));
82848290
ins_cost(2 * VOLATILE_REF_COST);
82858291
effect(TEMP_DEF res, KILL cr);
@@ -8389,7 +8395,7 @@ instruct compareAndExchangeLAcq(iRegLNoSp res, indirect mem, iRegL oldval, iRegL
83898395
// This pattern is generated automatically from cas.m4.
83908396
// DO NOT EDIT ANYTHING IN THIS SECTION OF THE FILE
83918397
instruct compareAndExchangeNAcq(iRegNNoSp res, indirect mem, iRegN oldval, iRegN newval, rFlagsReg cr) %{
8392-
predicate(needs_acquiring_load_exclusive(n));
8398+
predicate(needs_acquiring_load_exclusive(n) && n->as_LoadStore()->barrier_data() == 0);
83938399
match(Set res (CompareAndExchangeN mem (Binary oldval newval)));
83948400
ins_cost(VOLATILE_REF_COST);
83958401
effect(TEMP_DEF res, KILL cr);
@@ -8501,6 +8507,7 @@ instruct weakCompareAndSwapL(iRegINoSp res, indirect mem, iRegL oldval, iRegL ne
85018507
// This pattern is generated automatically from cas.m4.
85028508
// DO NOT EDIT ANYTHING IN THIS SECTION OF THE FILE
85038509
instruct weakCompareAndSwapN(iRegINoSp res, indirect mem, iRegN oldval, iRegN newval, rFlagsReg cr) %{
8510+
predicate(n->as_LoadStore()->barrier_data() == 0);
85048511
match(Set res (WeakCompareAndSwapN mem (Binary oldval newval)));
85058512
ins_cost(2 * VOLATILE_REF_COST);
85068513
effect(KILL cr);
@@ -8620,7 +8627,7 @@ instruct weakCompareAndSwapLAcq(iRegINoSp res, indirect mem, iRegL oldval, iRegL
86208627
// This pattern is generated automatically from cas.m4.
86218628
// DO NOT EDIT ANYTHING IN THIS SECTION OF THE FILE
86228629
instruct weakCompareAndSwapNAcq(iRegINoSp res, indirect mem, iRegN oldval, iRegN newval, rFlagsReg cr) %{
8623-
predicate(needs_acquiring_load_exclusive(n));
8630+
predicate(needs_acquiring_load_exclusive(n) && n->as_LoadStore()->barrier_data() == 0);
86248631
match(Set res (WeakCompareAndSwapN mem (Binary oldval newval)));
86258632
ins_cost(VOLATILE_REF_COST);
86268633
effect(KILL cr);
@@ -8681,6 +8688,7 @@ instruct get_and_setL(indirect mem, iRegL newv, iRegLNoSp prev) %{
86818688
%}
86828689

86838690
instruct get_and_setN(indirect mem, iRegN newv, iRegINoSp prev) %{
8691+
predicate(n->as_LoadStore()->barrier_data() == 0);
86848692
match(Set prev (GetAndSetN mem newv));
86858693
ins_cost(2 * VOLATILE_REF_COST);
86868694
format %{ "atomic_xchgw $prev, $newv, [$mem]" %}
@@ -8724,7 +8732,7 @@ instruct get_and_setLAcq(indirect mem, iRegL newv, iRegLNoSp prev) %{
87248732
%}
87258733

87268734
instruct get_and_setNAcq(indirect mem, iRegN newv, iRegINoSp prev) %{
8727-
predicate(needs_acquiring_load_exclusive(n));
8735+
predicate(needs_acquiring_load_exclusive(n) && n->as_LoadStore()->barrier_data() == 0);
87288736
match(Set prev (GetAndSetN mem newv));
87298737
ins_cost(VOLATILE_REF_COST);
87308738
format %{ "atomic_xchgw_acq $prev, $newv, [$mem]" %}

src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,12 @@ void C2_MacroAssembler::fast_unlock(Register objectReg, Register boxReg, Registe
150150
Register oop = objectReg;
151151
Register box = boxReg;
152152
Register disp_hdr = tmpReg;
153+
Register owner_addr = tmpReg;
153154
Register tmp = tmp2Reg;
154155
Label cont;
155156
Label object_has_monitor;
156157
Label count, no_count;
158+
Label unlocked;
157159

158160
assert(LockingMode != LM_LIGHTWEIGHT, "lightweight locking should use fast_unlock_lightweight");
159161
assert_different_registers(oop, box, tmp, disp_hdr);
@@ -204,14 +206,40 @@ void C2_MacroAssembler::fast_unlock(Register objectReg, Register boxReg, Registe
204206
b(cont);
205207

206208
bind(notRecursive);
209+
210+
// Compute owner address.
211+
lea(owner_addr, Address(tmp, ObjectMonitor::owner_offset()));
212+
213+
// Set owner to null.
214+
// Release to satisfy the JMM
215+
stlr(zr, owner_addr);
216+
// We need a full fence after clearing owner to avoid stranding.
217+
// StoreLoad achieves this.
218+
membar(StoreLoad);
219+
220+
// Check if the entry lists are empty.
207221
ldr(rscratch1, Address(tmp, ObjectMonitor::EntryList_offset()));
208-
ldr(disp_hdr, Address(tmp, ObjectMonitor::cxq_offset()));
209-
orr(rscratch1, rscratch1, disp_hdr); // Will be 0 if both are 0.
210-
cmp(rscratch1, zr); // Sets flags for result
211-
cbnz(rscratch1, cont);
212-
// need a release store here
213-
lea(tmp, Address(tmp, ObjectMonitor::owner_offset()));
214-
stlr(zr, tmp); // set unowned
222+
ldr(tmpReg, Address(tmp, ObjectMonitor::cxq_offset()));
223+
orr(rscratch1, rscratch1, tmpReg);
224+
cmp(rscratch1, zr);
225+
br(Assembler::EQ, cont); // If so we are done.
226+
227+
// Check if there is a successor.
228+
ldr(rscratch1, Address(tmp, ObjectMonitor::succ_offset()));
229+
cmp(rscratch1, zr);
230+
br(Assembler::NE, unlocked); // If so we are done.
231+
232+
// Save the monitor pointer in the current thread, so we can try to
233+
// reacquire the lock in SharedRuntime::monitor_exit_helper().
234+
str(tmp, Address(rthread, JavaThread::unlocked_inflated_monitor_offset()));
235+
236+
cmp(zr, rthread); // Set Flag to NE => slow path
237+
b(cont);
238+
239+
bind(unlocked);
240+
cmp(zr, zr); // Set Flag to EQ => fast path
241+
242+
// Intentional fall-through
215243

216244
bind(cont);
217245
// flag == EQ indicates success
@@ -498,33 +526,41 @@ void C2_MacroAssembler::fast_unlock_lightweight(Register obj, Register box, Regi
498526

499527
bind(not_recursive);
500528

501-
Label release;
502529
const Register t2_owner_addr = t2;
503530

504531
// Compute owner address.
505532
lea(t2_owner_addr, Address(t1_monitor, ObjectMonitor::owner_offset()));
506533

534+
// Set owner to null.
535+
// Release to satisfy the JMM
536+
stlr(zr, t2_owner_addr);
537+
// We need a full fence after clearing owner to avoid stranding.
538+
// StoreLoad achieves this.
539+
membar(StoreLoad);
540+
507541
// Check if the entry lists are empty.
508542
ldr(rscratch1, Address(t1_monitor, ObjectMonitor::EntryList_offset()));
509543
ldr(t3_t, Address(t1_monitor, ObjectMonitor::cxq_offset()));
510544
orr(rscratch1, rscratch1, t3_t);
511545
cmp(rscratch1, zr);
512-
br(Assembler::EQ, release);
546+
br(Assembler::EQ, unlocked); // If so we are done.
513547

514-
// The owner may be anonymous and we removed the last obj entry in
515-
// the lock-stack. This loses the information about the owner.
516-
// Write the thread to the owner field so the runtime knows the owner.
517-
str(rthread, Address(t2_owner_addr));
518-
b(slow_path);
548+
// Check if there is a successor.
549+
ldr(rscratch1, Address(t1_monitor, ObjectMonitor::succ_offset()));
550+
cmp(rscratch1, zr);
551+
br(Assembler::NE, unlocked); // If so we are done.
519552

520-
bind(release);
521-
// Set owner to null.
522-
// Release to satisfy the JMM
523-
stlr(zr, t2_owner_addr);
553+
// Save the monitor pointer in the current thread, so we can try to
554+
// reacquire the lock in SharedRuntime::monitor_exit_helper().
555+
str(t1_monitor, Address(rthread, JavaThread::unlocked_inflated_monitor_offset()));
556+
557+
cmp(zr, rthread); // Set Flag to NE => slow path
558+
b(slow_path);
524559
}
525560

526561
bind(unlocked);
527562
decrement(Address(rthread, JavaThread::held_monitor_count_offset()));
563+
cmp(zr, zr); // Set Flags to EQ => fast path
528564

529565
#ifdef ASSERT
530566
// Check that unlocked label is reached with Flags == EQ.

src/hotspot/cpu/aarch64/cas.m4

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ define(`CAS_INSN',
4545
// DO NOT EDIT ANYTHING IN THIS SECTION OF THE FILE
4646
instruct compareAndExchange$1$6(iReg$2NoSp res, indirect mem, iReg$2 oldval, iReg$2 newval, rFlagsReg cr) %{
4747
ifelse($1$6,PAcq,INDENT(predicate(needs_acquiring_load_exclusive(n) && (n->as_LoadStore()->barrier_data() == 0));),
48+
$1$6,NAcq,INDENT(predicate(needs_acquiring_load_exclusive(n) && n->as_LoadStore()->barrier_data() == 0);),
4849
$1,P,INDENT(predicate(n->as_LoadStore()->barrier_data() == 0);),
50+
$1,N,INDENT(predicate(n->as_LoadStore()->barrier_data() == 0);),
4951
$6,Acq,INDENT(predicate(needs_acquiring_load_exclusive(n));),
5052
`dnl')
5153
match(Set res (CompareAndExchange$1 mem (Binary oldval newval)));
@@ -122,7 +124,9 @@ define(`CAS_INSN3',
122124
// DO NOT EDIT ANYTHING IN THIS SECTION OF THE FILE
123125
instruct weakCompareAndSwap$1$6(iRegINoSp res, indirect mem, iReg$2 oldval, iReg$2 newval, rFlagsReg cr) %{
124126
ifelse($1$6,PAcq,INDENT(predicate(needs_acquiring_load_exclusive(n) && (n->as_LoadStore()->barrier_data() == 0));),
127+
$1$6,NAcq,INDENT(predicate(needs_acquiring_load_exclusive(n) && n->as_LoadStore()->barrier_data() == 0);),
125128
$1,P,INDENT(predicate(n->as_LoadStore()->barrier_data() == 0);),
129+
$1,N,INDENT(predicate(n->as_LoadStore()->barrier_data() == 0);),
126130
$6,Acq,INDENT(predicate(needs_acquiring_load_exclusive(n));),
127131
`dnl')
128132
match(Set res (WeakCompareAndSwap$1 mem (Binary oldval newval)));

0 commit comments

Comments
 (0)