Skip to content

Commit ca1a20d

Browse files
author
Datadog Syncup Service
committed
Merge branch 'upstream-master'
2 parents 12db0b9 + 363327e commit ca1a20d

File tree

372 files changed

+6764
-1671
lines changed

Some content is hidden

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

372 files changed

+6764
-1671
lines changed

src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ address NativeCall::destination() const {
7878
//
7979
// Used in the runtime linkage of calls; see class CompiledIC.
8080
void NativeCall::set_destination_mt_safe(address dest) {
81-
assert((Patching_lock->is_locked() || SafepointSynchronize::is_at_safepoint()) ||
81+
assert((CodeCache_lock->is_locked() || SafepointSynchronize::is_at_safepoint()) ||
8282
CompiledICLocker::is_safe(addr_at(0)),
8383
"concurrent code patching");
8484

src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,11 @@ int LIR_Assembler::emit_unwind_handler() {
213213
if (method()->is_synchronized()) {
214214
monitor_address(0, FrameMap::R4_opr);
215215
stub = new MonitorExitStub(FrameMap::R4_opr, true, 0);
216-
__ unlock_object(R5, R6, R4, *stub->entry());
216+
if (LockingMode == LM_MONITOR) {
217+
__ b(*stub->entry());
218+
} else {
219+
__ unlock_object(R5, R6, R4, *stub->entry());
220+
}
217221
__ bind(*stub->continuation());
218222
}
219223

src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ void C1_MacroAssembler::lock_object(Register Rmark, Register Roop, Register Rbox
114114
/*check without membar and ldarx first*/true);
115115
// If compare/exchange succeeded we found an unlocked object and we now have locked it
116116
// hence we are done.
117+
} else {
118+
assert(false, "Unhandled LockingMode:%d", LockingMode);
117119
}
118120
b(done);
119121

@@ -168,6 +170,8 @@ void C1_MacroAssembler::unlock_object(Register Rmark, Register Roop, Register Rb
168170
MacroAssembler::cmpxchgx_hint_release_lock(),
169171
noreg,
170172
&slow_int);
173+
} else {
174+
assert(false, "Unhandled LockingMode:%d", LockingMode);
171175
}
172176
b(done);
173177
bind(slow_int);

src/hotspot/cpu/ppc/macroAssembler_ppc.cpp

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2651,7 +2651,19 @@ void MacroAssembler::compiler_fast_lock_object(ConditionRegister flag, Register
26512651
// flag == NE indicates failure
26522652
bind(success);
26532653
inc_held_monitor_count(temp);
2654+
#ifdef ASSERT
2655+
// Check that unlocked label is reached with flag == EQ.
2656+
Label flag_correct;
2657+
beq(flag, flag_correct);
2658+
stop("compiler_fast_lock_object: Flag != EQ");
2659+
#endif
26542660
bind(failure);
2661+
#ifdef ASSERT
2662+
// Check that slow_path label is reached with flag == NE.
2663+
bne(flag, flag_correct);
2664+
stop("compiler_fast_lock_object: Flag != NE");
2665+
bind(flag_correct);
2666+
#endif
26552667
}
26562668

26572669
void MacroAssembler::compiler_fast_unlock_object(ConditionRegister flag, Register oop, Register box,
@@ -2701,17 +2713,12 @@ void MacroAssembler::compiler_fast_unlock_object(ConditionRegister flag, Registe
27012713
bind(object_has_monitor);
27022714
STATIC_ASSERT(markWord::monitor_value <= INT_MAX);
27032715
addi(current_header, current_header, -(int)markWord::monitor_value); // monitor
2704-
ld(temp, in_bytes(ObjectMonitor::owner_offset()), current_header);
2705-
2706-
// In case of LM_LIGHTWEIGHT, we may reach here with (temp & ObjectMonitor::ANONYMOUS_OWNER) != 0.
2707-
// This is handled like owner thread mismatches: We take the slow path.
2708-
cmpd(flag, temp, R16_thread);
2709-
bne(flag, failure);
27102716

27112717
ld(displaced_header, in_bytes(ObjectMonitor::recursions_offset()), current_header);
2712-
27132718
addic_(displaced_header, displaced_header, -1);
27142719
blt(CCR0, notRecursive); // Not recursive if negative after decrement.
2720+
2721+
// Recursive unlock
27152722
std(displaced_header, in_bytes(ObjectMonitor::recursions_offset()), current_header);
27162723
if (flag == CCR0) { // Otherwise, flag is already EQ, here.
27172724
crorc(CCR0, Assembler::equal, CCR0, Assembler::equal); // Set CCR0 EQ
@@ -2739,20 +2746,32 @@ void MacroAssembler::compiler_fast_unlock_object(ConditionRegister flag, Registe
27392746
// Check if there is a successor.
27402747
ld(temp, in_bytes(ObjectMonitor::succ_offset()), current_header);
27412748
cmpdi(flag, temp, 0);
2742-
bne(flag, success); // If so we are done.
2749+
// Invert equal bit
2750+
crnand(flag, Assembler::equal, flag, Assembler::equal);
2751+
beq(flag, success); // If there is a successor we are done.
27432752

27442753
// Save the monitor pointer in the current thread, so we can try
27452754
// to reacquire the lock in SharedRuntime::monitor_exit_helper().
27462755
std(current_header, in_bytes(JavaThread::unlocked_inflated_monitor_offset()), R16_thread);
2747-
2748-
crxor(flag, Assembler::equal, flag, Assembler::equal); // Set flag = NE => slow path
2749-
b(failure);
2756+
b(failure); // flag == NE
27502757

27512758
// flag == EQ indicates success, decrement held monitor count
27522759
// flag == NE indicates failure
27532760
bind(success);
27542761
dec_held_monitor_count(temp);
2762+
#ifdef ASSERT
2763+
// Check that unlocked label is reached with flag == EQ.
2764+
Label flag_correct;
2765+
beq(flag, flag_correct);
2766+
stop("compiler_fast_unlock_object: Flag != EQ");
2767+
#endif
27552768
bind(failure);
2769+
#ifdef ASSERT
2770+
// Check that slow_path label is reached with flag == NE.
2771+
bne(flag, flag_correct);
2772+
stop("compiler_fast_unlock_object: Flag != NE");
2773+
bind(flag_correct);
2774+
#endif
27562775
}
27572776

27582777
void MacroAssembler::compiler_fast_lock_lightweight_object(ConditionRegister flag, Register obj, Register box,
@@ -3053,7 +3072,6 @@ void MacroAssembler::compiler_fast_unlock_lightweight_object(ConditionRegister f
30533072

30543073
bind(not_recursive);
30553074

3056-
Label set_eq_unlocked;
30573075
const Register t2 = tmp2;
30583076

30593077
// Set owner to null.
@@ -3075,17 +3093,14 @@ void MacroAssembler::compiler_fast_unlock_lightweight_object(ConditionRegister f
30753093
// Check if there is a successor.
30763094
ld(t, in_bytes(ObjectMonitor::succ_offset()), monitor);
30773095
cmpdi(CCR0, t, 0);
3078-
bne(CCR0, set_eq_unlocked); // If so we are done.
3096+
// Invert equal bit
3097+
crnand(flag, Assembler::equal, flag, Assembler::equal);
3098+
beq(CCR0, unlocked); // If there is a successor we are done.
30793099

30803100
// Save the monitor pointer in the current thread, so we can try
30813101
// to reacquire the lock in SharedRuntime::monitor_exit_helper().
30823102
std(monitor, in_bytes(JavaThread::unlocked_inflated_monitor_offset()), R16_thread);
3083-
3084-
crxor(CCR0, Assembler::equal, CCR0, Assembler::equal); // Set flag = NE => slow path
3085-
b(slow_path);
3086-
3087-
bind(set_eq_unlocked);
3088-
crorc(CCR0, Assembler::equal, CCR0, Assembler::equal); // Set flag = EQ => fast path
3103+
b(slow_path); // flag == NE
30893104
}
30903105

30913106
bind(unlocked);

src/hotspot/cpu/ppc/nativeInst_ppc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ address NativeCall::destination() const {
9292
// Used in the runtime linkage of calls; see class CompiledIC.
9393
//
9494
// Add parameter assert_lock to switch off assertion
95-
// during code generation, where no patching lock is needed.
95+
// during code generation, where no lock is needed.
9696
void NativeCall::set_destination_mt_safe(address dest, bool assert_lock) {
9797
assert(!assert_lock ||
98-
(Patching_lock->is_locked() || SafepointSynchronize::is_at_safepoint()) ||
98+
(CodeCache_lock->is_locked() || SafepointSynchronize::is_at_safepoint()) ||
9999
CompiledICLocker::is_safe(addr_at(0)),
100100
"concurrent code patching");
101101

src/hotspot/cpu/riscv/nativeInst_riscv.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ void NativeShortCall::print() {
215215
// Used in the runtime linkage of calls; see class CompiledIC.
216216
//
217217
// Add parameter assert_lock to switch off assertion
218-
// during code generation, where no patching lock is needed.
218+
// during code generation, where no lock is needed.
219219
bool NativeShortCall::set_destination_mt_safe(address dest, bool assert_lock) {
220220
assert(!assert_lock ||
221-
(Patching_lock->is_locked() || SafepointSynchronize::is_at_safepoint()) ||
221+
(CodeCache_lock->is_locked() || SafepointSynchronize::is_at_safepoint()) ||
222222
CompiledICLocker::is_safe(instruction_address()),
223223
"concurrent code patching");
224224

@@ -386,7 +386,7 @@ void NativeFarCall::print() {
386386
bool NativeFarCall::set_destination_mt_safe(address dest, bool assert_lock) {
387387
assert(NativeFarCall::is_at(addr_at(0)), "unexpected code at call site");
388388
assert(!assert_lock ||
389-
(Patching_lock->is_locked() || SafepointSynchronize::is_at_safepoint()) ||
389+
(CodeCache_lock->is_locked() || SafepointSynchronize::is_at_safepoint()) ||
390390
CompiledICLocker::is_safe(addr_at(0)),
391391
"concurrent code patching");
392392

src/hotspot/cpu/s390/nativeInst_s390.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,8 +658,8 @@ void NativeGeneralJump::insert_unconditional(address code_pos, address entry) {
658658

659659
void NativeGeneralJump::replace_mt_safe(address instr_addr, address code_buffer) {
660660
assert(((intptr_t)instr_addr & (BytesPerWord-1)) == 0, "requirement for mt safe patching");
661-
// Bytes_after_jump cannot change, because we own the Patching_lock.
662-
assert(Patching_lock->owned_by_self(), "must hold lock to patch instruction");
661+
// Bytes_after_jump cannot change, because we own the CodeCache_lock.
662+
assert(CodeCache_lock->owned_by_self(), "must hold lock to patch instruction");
663663
intptr_t bytes_after_jump = (*(intptr_t*)instr_addr) & 0x000000000000ffffL; // 2 bytes after jump.
664664
intptr_t load_const_bytes = (*(intptr_t*)code_buffer) & 0xffffffffffff0000L;
665665
*(intptr_t*)instr_addr = load_const_bytes | bytes_after_jump;

src/hotspot/cpu/x86/assembler_x86.cpp

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4738,22 +4738,6 @@ void Assembler::vpermpd(XMMRegister dst, XMMRegister src, int imm8, int vector_l
47384738
emit_int24(0x01, (0xC0 | encode), imm8);
47394739
}
47404740

4741-
void Assembler::evpermi2q(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
4742-
assert(VM_Version::supports_evex(), "");
4743-
InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
4744-
attributes.set_is_evex_instruction();
4745-
int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
4746-
emit_int16(0x76, (0xC0 | encode));
4747-
}
4748-
4749-
void Assembler::evpermt2b(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
4750-
assert(VM_Version::supports_avx512_vbmi(), "");
4751-
InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
4752-
attributes.set_is_evex_instruction();
4753-
int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
4754-
emit_int16(0x7D, (0xC0 | encode));
4755-
}
4756-
47574741
void Assembler::evpmultishiftqb(XMMRegister dst, XMMRegister ctl, XMMRegister src, int vector_len) {
47584742
assert(VM_Version::supports_avx512_vbmi(), "");
47594743
InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
@@ -16103,3 +16087,59 @@ void InstructionAttr::set_address_attributes(int tuple_type, int input_size_in_b
1610316087
_input_size_in_bits = input_size_in_bits;
1610416088
}
1610516089
}
16090+
16091+
void Assembler::evpermi2b(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
16092+
assert(VM_Version::supports_avx512_vbmi() && (vector_len == Assembler::AVX_512bit || VM_Version::supports_avx512vl()), "");
16093+
InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
16094+
attributes.set_is_evex_instruction();
16095+
int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
16096+
emit_int16(0x75, (0xC0 | encode));
16097+
}
16098+
16099+
void Assembler::evpermi2w(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
16100+
assert(VM_Version::supports_avx512bw() && (vector_len == Assembler::AVX_512bit || VM_Version::supports_avx512vl()), "");
16101+
InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
16102+
attributes.set_is_evex_instruction();
16103+
int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
16104+
emit_int16(0x75, (0xC0 | encode));
16105+
}
16106+
16107+
void Assembler::evpermi2d(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
16108+
assert(VM_Version::supports_evex() && (vector_len == Assembler::AVX_512bit || VM_Version::supports_avx512vl()), "");
16109+
InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
16110+
attributes.set_is_evex_instruction();
16111+
int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
16112+
emit_int16(0x76, (0xC0 | encode));
16113+
}
16114+
16115+
void Assembler::evpermi2q(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
16116+
assert(VM_Version::supports_evex() && (vector_len == Assembler::AVX_512bit || VM_Version::supports_avx512vl()), "");
16117+
InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
16118+
attributes.set_is_evex_instruction();
16119+
int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
16120+
emit_int16(0x76, (0xC0 | encode));
16121+
}
16122+
16123+
void Assembler::evpermi2ps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
16124+
assert(VM_Version::supports_evex() && (vector_len == Assembler::AVX_512bit || VM_Version::supports_avx512vl()), "");
16125+
InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
16126+
attributes.set_is_evex_instruction();
16127+
int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
16128+
emit_int16(0x77, (0xC0 | encode));
16129+
}
16130+
16131+
void Assembler::evpermi2pd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
16132+
assert(VM_Version::supports_evex() && (vector_len == Assembler::AVX_512bit || VM_Version::supports_avx512vl()), "");
16133+
InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
16134+
attributes.set_is_evex_instruction();
16135+
int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
16136+
emit_int16(0x77, (0xC0 | encode));
16137+
}
16138+
16139+
void Assembler::evpermt2b(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
16140+
assert(VM_Version::supports_avx512_vbmi(), "");
16141+
InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
16142+
attributes.set_is_evex_instruction();
16143+
int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
16144+
emit_int16(0x7D, (0xC0 | encode));
16145+
}

src/hotspot/cpu/x86/assembler_x86.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,9 +1962,14 @@ class Assembler : public AbstractAssembler {
19621962
void vpermilps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
19631963
void vpermilpd(XMMRegister dst, XMMRegister src, int imm8, int vector_len);
19641964
void vpermpd(XMMRegister dst, XMMRegister src, int imm8, int vector_len);
1965+
void evpmultishiftqb(XMMRegister dst, XMMRegister ctl, XMMRegister src, int vector_len);
1966+
void evpermi2b(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
1967+
void evpermi2w(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
1968+
void evpermi2d(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
19651969
void evpermi2q(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
1970+
void evpermi2ps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
1971+
void evpermi2pd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
19661972
void evpermt2b(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
1967-
void evpmultishiftqb(XMMRegister dst, XMMRegister ctl, XMMRegister src, int vector_len);
19681973

19691974
void pause();
19701975

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6475,3 +6475,30 @@ void C2_MacroAssembler::vector_rearrange_int_float(BasicType bt, XMMRegister dst
64756475
vpermps(dst, shuffle, src, vlen_enc);
64766476
}
64776477
}
6478+
6479+
void C2_MacroAssembler::select_from_two_vectors_evex(BasicType elem_bt, XMMRegister dst, XMMRegister src1,
6480+
XMMRegister src2, int vlen_enc) {
6481+
switch(elem_bt) {
6482+
case T_BYTE:
6483+
evpermi2b(dst, src1, src2, vlen_enc);
6484+
break;
6485+
case T_SHORT:
6486+
evpermi2w(dst, src1, src2, vlen_enc);
6487+
break;
6488+
case T_INT:
6489+
evpermi2d(dst, src1, src2, vlen_enc);
6490+
break;
6491+
case T_LONG:
6492+
evpermi2q(dst, src1, src2, vlen_enc);
6493+
break;
6494+
case T_FLOAT:
6495+
evpermi2ps(dst, src1, src2, vlen_enc);
6496+
break;
6497+
case T_DOUBLE:
6498+
evpermi2pd(dst, src1, src2, vlen_enc);
6499+
break;
6500+
default:
6501+
fatal("Unsupported type %s", type2name(elem_bt));
6502+
break;
6503+
}
6504+
}

0 commit comments

Comments
 (0)