diff --git a/src/hotspot/cpu/aarch64/aarch64_vector.ad b/src/hotspot/cpu/aarch64/aarch64_vector.ad index b14295ca15c88..1ebc6408a6094 100644 --- a/src/hotspot/cpu/aarch64/aarch64_vector.ad +++ b/src/hotspot/cpu/aarch64/aarch64_vector.ad @@ -135,9 +135,9 @@ source %{ (opcode == Op_VectorCastL2X && bt == T_FLOAT) || (opcode == Op_CountLeadingZerosV && bt == T_LONG) || (opcode == Op_CountTrailingZerosV && bt == T_LONG) || - // The vector implementation of Op_AddReductionVD/F is for the Vector API only. - // It is not suitable for auto-vectorization because it does not add the elements - // in the same order as sequential code, and FP addition is non-associative. + // The implementations of Op_AddReductionVD/F in Neon are for the Vector API only. + // They are not suitable for auto-vectorization because the result would not conform + // to the JLS, Section Evaluation Order. opcode == Op_AddReductionVD || opcode == Op_AddReductionVF || opcode == Op_MulReductionVD || opcode == Op_MulReductionVF || opcode == Op_MulVL) { @@ -2858,14 +2858,14 @@ instruct reduce_addL_sve(iRegLNoSp dst, iRegL isrc, vReg vsrc, vRegD tmp) %{ %} // reduction addF -// Floating-point addition is not associative, so the rules for AddReductionVF -// on NEON can't be used to auto-vectorize floating-point reduce-add. -// Currently, on NEON, AddReductionVF is only generated by Vector API. -instruct reduce_add2F_neon(vRegF dst, vRegF fsrc, vReg vsrc) %{ - predicate(UseSVE == 0 && Matcher::vector_length(n->in(2)) == 2); + +instruct reduce_non_strict_order_add2F_neon(vRegF dst, vRegF fsrc, vReg vsrc) %{ + // Non-strictly ordered floating-point add reduction for a 64-bits-long vector. This rule is + // intended for the VectorAPI (which allows for non-strictly ordered add reduction). + predicate(Matcher::vector_length(n->in(2)) == 2 && !n->as_Reduction()->requires_strict_order()); match(Set dst (AddReductionVF fsrc vsrc)); effect(TEMP_DEF dst); - format %{ "reduce_add2F_neon $dst, $fsrc, $vsrc" %} + format %{ "reduce_non_strict_order_add2F_neon $dst, $fsrc, $vsrc" %} ins_encode %{ __ faddp($dst$$FloatRegister, $vsrc$$FloatRegister, __ S); __ fadds($dst$$FloatRegister, $dst$$FloatRegister, $fsrc$$FloatRegister); @@ -2873,11 +2873,13 @@ instruct reduce_add2F_neon(vRegF dst, vRegF fsrc, vReg vsrc) %{ ins_pipe(pipe_slow); %} -instruct reduce_add4F_neon(vRegF dst, vRegF fsrc, vReg vsrc, vReg tmp) %{ - predicate(UseSVE == 0 && Matcher::vector_length(n->in(2)) == 4); +instruct reduce_non_strict_order_add4F_neon(vRegF dst, vRegF fsrc, vReg vsrc, vReg tmp) %{ + // Non-strictly ordered floating-point add reduction for 128-bits-long vector. This rule is + // intended for the VectorAPI (which allows for non-strictly ordered add reduction). + predicate(Matcher::vector_length(n->in(2)) == 4 && !n->as_Reduction()->requires_strict_order()); match(Set dst (AddReductionVF fsrc vsrc)); effect(TEMP_DEF dst, TEMP tmp); - format %{ "reduce_add4F_neon $dst, $fsrc, $vsrc\t# KILL $tmp" %} + format %{ "reduce_non_strict_order_add4F_neon $dst, $fsrc, $vsrc\t# KILL $tmp" %} ins_encode %{ __ faddp($tmp$$FloatRegister, __ T4S, $vsrc$$FloatRegister, $vsrc$$FloatRegister); __ faddp($dst$$FloatRegister, $tmp$$FloatRegister, __ S); @@ -2886,11 +2888,21 @@ instruct reduce_add4F_neon(vRegF dst, vRegF fsrc, vReg vsrc, vReg tmp) %{ ins_pipe(pipe_slow); %} +// This rule calculates the reduction result in strict order. Two cases will +// reach here: +// 1. Non strictly-ordered AddReductionVF when vector size > 128-bits. For example - +// AddReductionVF generated by Vector API. For vector size > 128-bits, it is more +// beneficial performance-wise to generate direct SVE instruction even if it is +// strictly ordered. +// 2. Strictly-ordered AddReductionVF. For example - AddReductionVF generated by +// auto-vectorization on SVE machine. instruct reduce_addF_sve(vRegF dst_src1, vReg src2) %{ - predicate(UseSVE > 0); + predicate(!VM_Version::use_neon_for_vector(Matcher::vector_length_in_bytes(n->in(2))) || + n->as_Reduction()->requires_strict_order()); match(Set dst_src1 (AddReductionVF dst_src1 src2)); format %{ "reduce_addF_sve $dst_src1, $dst_src1, $src2" %} ins_encode %{ + assert(UseSVE > 0, "must be sve"); uint length_in_bytes = Matcher::vector_length_in_bytes(this, $src2); assert(length_in_bytes == MaxVectorSize, "invalid vector length"); __ sve_fadda($dst_src1$$FloatRegister, __ S, ptrue, $src2$$FloatRegister); @@ -2899,14 +2911,14 @@ instruct reduce_addF_sve(vRegF dst_src1, vReg src2) %{ %} // reduction addD -// Floating-point addition is not associative, so the rule for AddReductionVD -// on NEON can't be used to auto-vectorize floating-point reduce-add. -// Currently, on NEON, AddReductionVD is only generated by Vector API. -instruct reduce_addD_neon(vRegD dst, vRegD dsrc, vReg vsrc) %{ - predicate(UseSVE == 0); + +instruct reduce_non_strict_order_add2D_neon(vRegD dst, vRegD dsrc, vReg vsrc) %{ + // Non-strictly ordered floating-point add reduction for doubles. This rule is + // intended for the VectorAPI (which allows for non-strictly ordered add reduction). + predicate(!n->as_Reduction()->requires_strict_order()); match(Set dst (AddReductionVD dsrc vsrc)); effect(TEMP_DEF dst); - format %{ "reduce_addD_neon $dst, $dsrc, $vsrc\t# 2D" %} + format %{ "reduce_non_strict_order_add2D_neon $dst, $dsrc, $vsrc\t# 2D" %} ins_encode %{ __ faddp($dst$$FloatRegister, $vsrc$$FloatRegister, __ D); __ faddd($dst$$FloatRegister, $dst$$FloatRegister, $dsrc$$FloatRegister); @@ -2914,11 +2926,21 @@ instruct reduce_addD_neon(vRegD dst, vRegD dsrc, vReg vsrc) %{ ins_pipe(pipe_slow); %} +// This rule calculates the reduction result in strict order. Two cases will +// reach here: +// 1. Non strictly-ordered AddReductionVD when vector size > 128-bits. For example - +// AddReductionVD generated by Vector API. For vector size > 128-bits, it is more +// beneficial performance-wise to generate direct SVE instruction even if it is +// strictly ordered. +// 2. Strictly-ordered AddReductionVD. For example - AddReductionVD generated by +// auto-vectorization on SVE machine. instruct reduce_addD_sve(vRegD dst_src1, vReg src2) %{ - predicate(UseSVE > 0); + predicate(!VM_Version::use_neon_for_vector(Matcher::vector_length_in_bytes(n->in(2))) || + n->as_Reduction()->requires_strict_order()); match(Set dst_src1 (AddReductionVD dst_src1 src2)); format %{ "reduce_addD_sve $dst_src1, $dst_src1, $src2" %} ins_encode %{ + assert(UseSVE > 0, "must be sve"); uint length_in_bytes = Matcher::vector_length_in_bytes(this, $src2); assert(length_in_bytes == MaxVectorSize, "invalid vector length"); __ sve_fadda($dst_src1$$FloatRegister, __ D, ptrue, $src2$$FloatRegister); diff --git a/src/hotspot/cpu/aarch64/aarch64_vector_ad.m4 b/src/hotspot/cpu/aarch64/aarch64_vector_ad.m4 index 060bb4a11d4ad..29f927723688f 100644 --- a/src/hotspot/cpu/aarch64/aarch64_vector_ad.m4 +++ b/src/hotspot/cpu/aarch64/aarch64_vector_ad.m4 @@ -125,9 +125,9 @@ source %{ (opcode == Op_VectorCastL2X && bt == T_FLOAT) || (opcode == Op_CountLeadingZerosV && bt == T_LONG) || (opcode == Op_CountTrailingZerosV && bt == T_LONG) || - // The vector implementation of Op_AddReductionVD/F is for the Vector API only. - // It is not suitable for auto-vectorization because it does not add the elements - // in the same order as sequential code, and FP addition is non-associative. + // The implementations of Op_AddReductionVD/F in Neon are for the Vector API only. + // They are not suitable for auto-vectorization because the result would not conform + // to the JLS, Section Evaluation Order. opcode == Op_AddReductionVD || opcode == Op_AddReductionVF || opcode == Op_MulReductionVD || opcode == Op_MulReductionVF || opcode == Op_MulVL) { @@ -1752,14 +1752,14 @@ REDUCE_ADD_INT_NEON_SVE_PAIRWISE(I, iRegIorL2I) REDUCE_ADD_INT_NEON_SVE_PAIRWISE(L, iRegL) // reduction addF -// Floating-point addition is not associative, so the rules for AddReductionVF -// on NEON can't be used to auto-vectorize floating-point reduce-add. -// Currently, on NEON, AddReductionVF is only generated by Vector API. -instruct reduce_add2F_neon(vRegF dst, vRegF fsrc, vReg vsrc) %{ - predicate(UseSVE == 0 && Matcher::vector_length(n->in(2)) == 2); + +instruct reduce_non_strict_order_add2F_neon(vRegF dst, vRegF fsrc, vReg vsrc) %{ + // Non-strictly ordered floating-point add reduction for a 64-bits-long vector. This rule is + // intended for the VectorAPI (which allows for non-strictly ordered add reduction). + predicate(Matcher::vector_length(n->in(2)) == 2 && !n->as_Reduction()->requires_strict_order()); match(Set dst (AddReductionVF fsrc vsrc)); effect(TEMP_DEF dst); - format %{ "reduce_add2F_neon $dst, $fsrc, $vsrc" %} + format %{ "reduce_non_strict_order_add2F_neon $dst, $fsrc, $vsrc" %} ins_encode %{ __ faddp($dst$$FloatRegister, $vsrc$$FloatRegister, __ S); __ fadds($dst$$FloatRegister, $dst$$FloatRegister, $fsrc$$FloatRegister); @@ -1767,11 +1767,13 @@ instruct reduce_add2F_neon(vRegF dst, vRegF fsrc, vReg vsrc) %{ ins_pipe(pipe_slow); %} -instruct reduce_add4F_neon(vRegF dst, vRegF fsrc, vReg vsrc, vReg tmp) %{ - predicate(UseSVE == 0 && Matcher::vector_length(n->in(2)) == 4); +instruct reduce_non_strict_order_add4F_neon(vRegF dst, vRegF fsrc, vReg vsrc, vReg tmp) %{ + // Non-strictly ordered floating-point add reduction for 128-bits-long vector. This rule is + // intended for the VectorAPI (which allows for non-strictly ordered add reduction). + predicate(Matcher::vector_length(n->in(2)) == 4 && !n->as_Reduction()->requires_strict_order()); match(Set dst (AddReductionVF fsrc vsrc)); effect(TEMP_DEF dst, TEMP tmp); - format %{ "reduce_add4F_neon $dst, $fsrc, $vsrc\t# KILL $tmp" %} + format %{ "reduce_non_strict_order_add4F_neon $dst, $fsrc, $vsrc\t# KILL $tmp" %} ins_encode %{ __ faddp($tmp$$FloatRegister, __ T4S, $vsrc$$FloatRegister, $vsrc$$FloatRegister); __ faddp($dst$$FloatRegister, $tmp$$FloatRegister, __ S); @@ -1783,11 +1785,21 @@ dnl dnl REDUCE_ADD_FP_SVE($1, $2 ) dnl REDUCE_ADD_FP_SVE(type, size) define(`REDUCE_ADD_FP_SVE', ` +// This rule calculates the reduction result in strict order. Two cases will +// reach here: +// 1. Non strictly-ordered AddReductionV$1 when vector size > 128-bits. For example - +// AddReductionV$1 generated by Vector API. For vector size > 128-bits, it is more +// beneficial performance-wise to generate direct SVE instruction even if it is +// strictly ordered. +// 2. Strictly-ordered AddReductionV$1. For example - AddReductionV$1 generated by +// auto-vectorization on SVE machine. instruct reduce_add$1_sve(vReg$1 dst_src1, vReg src2) %{ - predicate(UseSVE > 0); + predicate(!VM_Version::use_neon_for_vector(Matcher::vector_length_in_bytes(n->in(2))) || + n->as_Reduction()->requires_strict_order()); match(Set dst_src1 (AddReductionV$1 dst_src1 src2)); format %{ "reduce_add$1_sve $dst_src1, $dst_src1, $src2" %} ins_encode %{ + assert(UseSVE > 0, "must be sve"); uint length_in_bytes = Matcher::vector_length_in_bytes(this, $src2); assert(length_in_bytes == MaxVectorSize, "invalid vector length"); __ sve_fadda($dst_src1$$FloatRegister, __ $2, ptrue, $src2$$FloatRegister); @@ -1798,14 +1810,14 @@ dnl REDUCE_ADD_FP_SVE(F, S) // reduction addD -// Floating-point addition is not associative, so the rule for AddReductionVD -// on NEON can't be used to auto-vectorize floating-point reduce-add. -// Currently, on NEON, AddReductionVD is only generated by Vector API. -instruct reduce_addD_neon(vRegD dst, vRegD dsrc, vReg vsrc) %{ - predicate(UseSVE == 0); + +instruct reduce_non_strict_order_add2D_neon(vRegD dst, vRegD dsrc, vReg vsrc) %{ + // Non-strictly ordered floating-point add reduction for doubles. This rule is + // intended for the VectorAPI (which allows for non-strictly ordered add reduction). + predicate(!n->as_Reduction()->requires_strict_order()); match(Set dst (AddReductionVD dsrc vsrc)); effect(TEMP_DEF dst); - format %{ "reduce_addD_neon $dst, $dsrc, $vsrc\t# 2D" %} + format %{ "reduce_non_strict_order_add2D_neon $dst, $dsrc, $vsrc\t# 2D" %} ins_encode %{ __ faddp($dst$$FloatRegister, $vsrc$$FloatRegister, __ D); __ faddd($dst$$FloatRegister, $dst$$FloatRegister, $dsrc$$FloatRegister); diff --git a/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp b/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp index 84caef57f87ca..974214d985b5d 100644 --- a/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp @@ -168,6 +168,7 @@ class NativeCall: public NativeInstruction { return_address_offset = 4 }; + static int byte_size() { return instruction_size; } address instruction_address() const { return addr_at(instruction_offset); } address next_instruction_address() const { return addr_at(return_address_offset); } int displacement() const { return (int_at(displacement_offset) << 6) >> 4; } diff --git a/src/hotspot/cpu/arm/nativeInst_arm_32.hpp b/src/hotspot/cpu/arm/nativeInst_arm_32.hpp index 15b57188730df..e26c23cd9836c 100644 --- a/src/hotspot/cpu/arm/nativeInst_arm_32.hpp +++ b/src/hotspot/cpu/arm/nativeInst_arm_32.hpp @@ -415,6 +415,7 @@ inline NativeJump* nativeJump_at(address address) { class NativeCall: public RawNativeCall { public: + static int byte_size() { return instruction_size; } // NativeCall::next_instruction_address() is used only to define the // range where to look for the relocation information. We need not // walk over composed instructions (as long as the relocation information diff --git a/src/hotspot/cpu/ppc/nativeInst_ppc.hpp b/src/hotspot/cpu/ppc/nativeInst_ppc.hpp index 113cedfee7cab..f21d76f8a675e 100644 --- a/src/hotspot/cpu/ppc/nativeInst_ppc.hpp +++ b/src/hotspot/cpu/ppc/nativeInst_ppc.hpp @@ -137,6 +137,8 @@ class NativeCall: public NativeInstruction { instruction_size = 16 // Used in shared code for calls with reloc_info. }; + static int byte_size() { return instruction_size; } + static bool is_call_at(address a) { return Assembler::is_bl(*(int*)(a)); } diff --git a/src/hotspot/cpu/riscv/nativeInst_riscv.hpp b/src/hotspot/cpu/riscv/nativeInst_riscv.hpp index e9b3624d9d29d..f925f8950aa23 100644 --- a/src/hotspot/cpu/riscv/nativeInst_riscv.hpp +++ b/src/hotspot/cpu/riscv/nativeInst_riscv.hpp @@ -126,6 +126,7 @@ class NativeCall: public NativeInstruction { return_address_offset = 4 }; + static int byte_size() { return instruction_size; } address instruction_address() const { return addr_at(instruction_offset); } address next_instruction_address() const { return addr_at(return_address_offset); } address return_address() const { return addr_at(return_address_offset); } diff --git a/src/hotspot/cpu/s390/nativeInst_s390.hpp b/src/hotspot/cpu/s390/nativeInst_s390.hpp index 13f15224f8bf5..8003e1d42f267 100644 --- a/src/hotspot/cpu/s390/nativeInst_s390.hpp +++ b/src/hotspot/cpu/s390/nativeInst_s390.hpp @@ -212,6 +212,7 @@ class NativeCall: public NativeInstruction { call_far_pcrelative_displacement_alignment = 4 }; + static int byte_size() { return instruction_size; } // Maximum size (in bytes) of a call to an absolute address. // Used when emitting call to deopt handler blob, which is a diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp index bec63210df9c5..66a782ba9c622 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp @@ -172,310 +172,6 @@ inline Assembler::AvxVectorLen C2_MacroAssembler::vector_length_encoding(int vle } } -#if INCLUDE_RTM_OPT - -// Update rtm_counters based on abort status -// input: abort_status -// rtm_counters (RTMLockingCounters*) -// flags are killed -void C2_MacroAssembler::rtm_counters_update(Register abort_status, Register rtm_counters) { - - atomic_incptr(Address(rtm_counters, RTMLockingCounters::abort_count_offset())); - if (PrintPreciseRTMLockingStatistics) { - for (int i = 0; i < RTMLockingCounters::ABORT_STATUS_LIMIT; i++) { - Label check_abort; - testl(abort_status, (1< 0) { - // Delay calculation - movptr(tmpReg, ExternalAddress((address) RTMLockingCounters::rtm_calculation_flag_addr())); - testptr(tmpReg, tmpReg); - jccb(Assembler::equal, L_done); - } - // Abort ratio calculation only if abort_count > RTMAbortThreshold - // Aborted transactions = abort_count * 100 - // All transactions = total_count * RTMTotalCountIncrRate - // Set no_rtm bit if (Aborted transactions >= All transactions * RTMAbortRatio) - - movptr(tmpReg, Address(rtm_counters_Reg, RTMLockingCounters::abort_count_offset())); - cmpptr(tmpReg, RTMAbortThreshold); - jccb(Assembler::below, L_check_always_rtm2); - imulptr(tmpReg, tmpReg, 100); - - Register scrReg = rtm_counters_Reg; - movptr(scrReg, Address(rtm_counters_Reg, RTMLockingCounters::total_count_offset())); - imulptr(scrReg, scrReg, RTMTotalCountIncrRate); - imulptr(scrReg, scrReg, RTMAbortRatio); - cmpptr(tmpReg, scrReg); - jccb(Assembler::below, L_check_always_rtm1); - if (method_data != nullptr) { - // set rtm_state to "no rtm" in MDO - mov_metadata(tmpReg, method_data); - lock(); - orl(Address(tmpReg, MethodData::rtm_state_offset()), NoRTM); - } - jmpb(L_done); - bind(L_check_always_rtm1); - // Reload RTMLockingCounters* address - lea(rtm_counters_Reg, ExternalAddress((address)rtm_counters)); - bind(L_check_always_rtm2); - movptr(tmpReg, Address(rtm_counters_Reg, RTMLockingCounters::total_count_offset())); - cmpptr(tmpReg, RTMLockingThreshold / RTMTotalCountIncrRate); - jccb(Assembler::below, L_done); - if (method_data != nullptr) { - // set rtm_state to "always rtm" in MDO - mov_metadata(tmpReg, method_data); - lock(); - orl(Address(tmpReg, MethodData::rtm_state_offset()), UseRTM); - } - bind(L_done); -} - -// Update counters and perform abort ratio calculation -// input: abort_status_Reg -// rtm_counters_Reg, flags are killed -void C2_MacroAssembler::rtm_profiling(Register abort_status_Reg, - Register rtm_counters_Reg, - RTMLockingCounters* rtm_counters, - Metadata* method_data, - bool profile_rtm) { - - assert(rtm_counters != nullptr, "should not be null when profiling RTM"); - // update rtm counters based on rax value at abort - // reads abort_status_Reg, updates flags - lea(rtm_counters_Reg, ExternalAddress((address)rtm_counters)); - rtm_counters_update(abort_status_Reg, rtm_counters_Reg); - if (profile_rtm) { - // Save abort status because abort_status_Reg is used by following code. - if (RTMRetryCount > 0) { - push(abort_status_Reg); - } - assert(rtm_counters != nullptr, "should not be null when profiling RTM"); - rtm_abort_ratio_calculation(abort_status_Reg, rtm_counters_Reg, rtm_counters, method_data); - // restore abort status - if (RTMRetryCount > 0) { - pop(abort_status_Reg); - } - } -} - -// Retry on abort if abort's status is 0x6: can retry (0x2) | memory conflict (0x4) -// inputs: retry_count_Reg -// : abort_status_Reg -// output: retry_count_Reg decremented by 1 -// flags are killed -void C2_MacroAssembler::rtm_retry_lock_on_abort(Register retry_count_Reg, Register abort_status_Reg, Label& retryLabel) { - Label doneRetry; - assert(abort_status_Reg == rax, ""); - // The abort reason bits are in eax (see all states in rtmLocking.hpp) - // 0x6 = conflict on which we can retry (0x2) | memory conflict (0x4) - // if reason is in 0x6 and retry count != 0 then retry - andptr(abort_status_Reg, 0x6); - jccb(Assembler::zero, doneRetry); - testl(retry_count_Reg, retry_count_Reg); - jccb(Assembler::zero, doneRetry); - pause(); - decrementl(retry_count_Reg); - jmp(retryLabel); - bind(doneRetry); -} - -// Spin and retry if lock is busy, -// inputs: box_Reg (monitor address) -// : retry_count_Reg -// output: retry_count_Reg decremented by 1 -// : clear z flag if retry count exceeded -// tmp_Reg, scr_Reg, flags are killed -void C2_MacroAssembler::rtm_retry_lock_on_busy(Register retry_count_Reg, Register box_Reg, - Register tmp_Reg, Register scr_Reg, Label& retryLabel) { - Label SpinLoop, SpinExit, doneRetry; - int owner_offset = OM_OFFSET_NO_MONITOR_VALUE_TAG(owner); - - testl(retry_count_Reg, retry_count_Reg); - jccb(Assembler::zero, doneRetry); - decrementl(retry_count_Reg); - movptr(scr_Reg, RTMSpinLoopCount); - - bind(SpinLoop); - pause(); - decrementl(scr_Reg); - jccb(Assembler::lessEqual, SpinExit); - movptr(tmp_Reg, Address(box_Reg, owner_offset)); - testptr(tmp_Reg, tmp_Reg); - jccb(Assembler::notZero, SpinLoop); - - bind(SpinExit); - jmp(retryLabel); - bind(doneRetry); - incrementl(retry_count_Reg); // clear z flag -} - -// Use RTM for normal stack locks -// Input: objReg (object to lock) -void C2_MacroAssembler::rtm_stack_locking(Register objReg, Register tmpReg, Register scrReg, - Register retry_on_abort_count_Reg, - RTMLockingCounters* stack_rtm_counters, - Metadata* method_data, bool profile_rtm, - Label& DONE_LABEL, Label& IsInflated) { - assert(UseRTMForStackLocks, "why call this otherwise?"); - assert(tmpReg == rax, ""); - assert(scrReg == rdx, ""); - Label L_rtm_retry, L_decrement_retry, L_on_abort; - - if (RTMRetryCount > 0) { - movl(retry_on_abort_count_Reg, RTMRetryCount); // Retry on abort - bind(L_rtm_retry); - } - movptr(tmpReg, Address(objReg, oopDesc::mark_offset_in_bytes())); - testptr(tmpReg, markWord::monitor_value); // inflated vs stack-locked|neutral - jcc(Assembler::notZero, IsInflated); - - if (PrintPreciseRTMLockingStatistics || profile_rtm) { - Label L_noincrement; - if (RTMTotalCountIncrRate > 1) { - // tmpReg, scrReg and flags are killed - branch_on_random_using_rdtsc(tmpReg, scrReg, RTMTotalCountIncrRate, L_noincrement); - } - assert(stack_rtm_counters != nullptr, "should not be null when profiling RTM"); - atomic_incptr(ExternalAddress((address)stack_rtm_counters->total_count_addr()), scrReg); - bind(L_noincrement); - } - xbegin(L_on_abort); - movptr(tmpReg, Address(objReg, oopDesc::mark_offset_in_bytes())); // fetch markword - andptr(tmpReg, markWord::lock_mask_in_place); // look at 2 lock bits - cmpptr(tmpReg, markWord::unlocked_value); // bits = 01 unlocked - jcc(Assembler::equal, DONE_LABEL); // all done if unlocked - - Register abort_status_Reg = tmpReg; // status of abort is stored in RAX - if (UseRTMXendForLockBusy) { - xend(); - movptr(abort_status_Reg, 0x2); // Set the abort status to 2 (so we can retry) - jmp(L_decrement_retry); - } - else { - xabort(0); - } - bind(L_on_abort); - if (PrintPreciseRTMLockingStatistics || profile_rtm) { - rtm_profiling(abort_status_Reg, scrReg, stack_rtm_counters, method_data, profile_rtm); - } - bind(L_decrement_retry); - if (RTMRetryCount > 0) { - // retry on lock abort if abort status is 'can retry' (0x2) or 'memory conflict' (0x4) - rtm_retry_lock_on_abort(retry_on_abort_count_Reg, abort_status_Reg, L_rtm_retry); - } -} - -// Use RTM for inflating locks -// inputs: objReg (object to lock) -// boxReg (on-stack box address (displaced header location) - KILLED) -// tmpReg (ObjectMonitor address + markWord::monitor_value) -void C2_MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, Register tmpReg, - Register scrReg, Register retry_on_busy_count_Reg, - Register retry_on_abort_count_Reg, - RTMLockingCounters* rtm_counters, - Metadata* method_data, bool profile_rtm, - Label& DONE_LABEL) { - assert(UseRTMLocking, "why call this otherwise?"); - assert(tmpReg == rax, ""); - assert(scrReg == rdx, ""); - Label L_rtm_retry, L_decrement_retry, L_on_abort; - int owner_offset = OM_OFFSET_NO_MONITOR_VALUE_TAG(owner); - - movptr(Address(boxReg, 0), checked_cast(markWord::unused_mark().value())); - movptr(boxReg, tmpReg); // Save ObjectMonitor address - - if (RTMRetryCount > 0) { - movl(retry_on_busy_count_Reg, RTMRetryCount); // Retry on lock busy - movl(retry_on_abort_count_Reg, RTMRetryCount); // Retry on abort - bind(L_rtm_retry); - } - if (PrintPreciseRTMLockingStatistics || profile_rtm) { - Label L_noincrement; - if (RTMTotalCountIncrRate > 1) { - // tmpReg, scrReg and flags are killed - branch_on_random_using_rdtsc(tmpReg, scrReg, RTMTotalCountIncrRate, L_noincrement); - } - assert(rtm_counters != nullptr, "should not be null when profiling RTM"); - atomic_incptr(ExternalAddress((address)rtm_counters->total_count_addr()), scrReg); - bind(L_noincrement); - } - xbegin(L_on_abort); - movptr(tmpReg, Address(objReg, oopDesc::mark_offset_in_bytes())); - movptr(tmpReg, Address(tmpReg, owner_offset)); - testptr(tmpReg, tmpReg); - jcc(Assembler::zero, DONE_LABEL); - if (UseRTMXendForLockBusy) { - xend(); - jmp(L_decrement_retry); - } - else { - xabort(0); - } - bind(L_on_abort); - Register abort_status_Reg = tmpReg; // status of abort is stored in RAX - if (PrintPreciseRTMLockingStatistics || profile_rtm) { - rtm_profiling(abort_status_Reg, scrReg, rtm_counters, method_data, profile_rtm); - } - if (RTMRetryCount > 0) { - // retry on lock abort if abort status is 'can retry' (0x2) or 'memory conflict' (0x4) - rtm_retry_lock_on_abort(retry_on_abort_count_Reg, abort_status_Reg, L_rtm_retry); - } - - movptr(tmpReg, Address(boxReg, owner_offset)) ; - testptr(tmpReg, tmpReg) ; - jccb(Assembler::notZero, L_decrement_retry) ; - - // Appears unlocked - try to swing _owner from null to non-null. - // Invariant: tmpReg == 0. tmpReg is EAX which is the implicit cmpxchg comparand. -#ifdef _LP64 - Register threadReg = r15_thread; -#else - get_thread(scrReg); - Register threadReg = scrReg; -#endif - lock(); - cmpxchgptr(threadReg, Address(boxReg, owner_offset)); // Updates tmpReg - - if (RTMRetryCount > 0) { - // success done else retry - jccb(Assembler::equal, DONE_LABEL) ; - bind(L_decrement_retry); - // Spin and retry if lock is busy. - rtm_retry_lock_on_busy(retry_on_busy_count_Reg, boxReg, tmpReg, scrReg, L_rtm_retry); - } - else { - bind(L_decrement_retry); - } -} - -#endif // INCLUDE_RTM_OPT - // fast_lock and fast_unlock used by C2 // Because the transitions from emitted code to the runtime @@ -554,21 +250,13 @@ void C2_MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, R // scr: tmp -- KILLED void C2_MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg, Register scrReg, Register cx1Reg, Register cx2Reg, Register thread, - RTMLockingCounters* rtm_counters, - RTMLockingCounters* stack_rtm_counters, - Metadata* method_data, - bool use_rtm, bool profile_rtm) { + Metadata* method_data) { assert(LockingMode != LM_LIGHTWEIGHT, "lightweight locking should use fast_lock_lightweight"); // Ensure the register assignments are disjoint assert(tmpReg == rax, ""); - - if (use_rtm) { - assert_different_registers(objReg, boxReg, tmpReg, scrReg, cx1Reg, cx2Reg); - } else { - assert(cx1Reg == noreg, ""); - assert(cx2Reg == noreg, ""); - assert_different_registers(objReg, boxReg, tmpReg, scrReg); - } + assert(cx1Reg == noreg, ""); + assert(cx2Reg == noreg, ""); + assert_different_registers(objReg, boxReg, tmpReg, scrReg); // Possible cases that we'll encounter in fast_lock // ------------------------------------------------ @@ -594,15 +282,6 @@ void C2_MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmp jcc(Assembler::notZero, DONE_LABEL); } -#if INCLUDE_RTM_OPT - if (UseRTMForStackLocks && use_rtm) { - assert(LockingMode != LM_MONITOR, "LockingMode == 0 (LM_MONITOR) and +UseRTMForStackLocks are mutually exclusive"); - rtm_stack_locking(objReg, tmpReg, scrReg, cx2Reg, - stack_rtm_counters, method_data, profile_rtm, - DONE_LABEL, IsInflated); - } -#endif // INCLUDE_RTM_OPT - movptr(tmpReg, Address(objReg, oopDesc::mark_offset_in_bytes())); // [FETCH] testptr(tmpReg, markWord::monitor_value); // inflated vs stack-locked|neutral jcc(Assembler::notZero, IsInflated); @@ -632,14 +311,6 @@ void C2_MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmp bind(IsInflated); // The object is inflated. tmpReg contains pointer to ObjectMonitor* + markWord::monitor_value -#if INCLUDE_RTM_OPT - // Use the same RTM locking code in 32- and 64-bit VM. - if (use_rtm) { - rtm_inflated_locking(objReg, boxReg, tmpReg, scrReg, cx1Reg, cx2Reg, - rtm_counters, method_data, profile_rtm, DONE_LABEL); - } else { -#endif // INCLUDE_RTM_OPT - #ifndef _LP64 // The object is inflated. @@ -700,9 +371,6 @@ void C2_MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmp incq(Address(scrReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions))); xorq(rax, rax); // Set ZF = 1 (success) for recursive lock, denoting locking success #endif // _LP64 -#if INCLUDE_RTM_OPT - } // use_rtm() -#endif bind(DONE_LABEL); // ZFlag == 1 count in fast path @@ -755,27 +423,13 @@ void C2_MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmp // A perfectly viable alternative is to elide the owner check except when // Xcheck:jni is enabled. -void C2_MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpReg, bool use_rtm) { +void C2_MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpReg) { assert(LockingMode != LM_LIGHTWEIGHT, "lightweight locking should use fast_unlock_lightweight"); assert(boxReg == rax, ""); assert_different_registers(objReg, boxReg, tmpReg); Label DONE_LABEL, Stacked, COUNT, NO_COUNT; -#if INCLUDE_RTM_OPT - if (UseRTMForStackLocks && use_rtm) { - assert(LockingMode != LM_MONITOR, "LockingMode == 0 (LM_MONITOR) and +UseRTMForStackLocks are mutually exclusive"); - Label L_regular_unlock; - movptr(tmpReg, Address(objReg, oopDesc::mark_offset_in_bytes())); // fetch markword - andptr(tmpReg, markWord::lock_mask_in_place); // look at 2 lock bits - cmpptr(tmpReg, markWord::unlocked_value); // bits = 01 unlocked - jccb(Assembler::notEqual, L_regular_unlock); // if !HLE RegularLock - xend(); // otherwise end... - jmp(DONE_LABEL); // ... and we're done - bind(L_regular_unlock); - } -#endif - if (LockingMode == LM_LEGACY) { cmpptr(Address(boxReg, 0), NULL_WORD); // Examine the displaced header jcc (Assembler::zero, COUNT); // 0 indicates recursive stack-lock @@ -788,19 +442,6 @@ void C2_MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register t // It's inflated. -#if INCLUDE_RTM_OPT - if (use_rtm) { - Label L_regular_inflated_unlock; - int owner_offset = OM_OFFSET_NO_MONITOR_VALUE_TAG(owner); - movptr(boxReg, Address(tmpReg, owner_offset)); - testptr(boxReg, boxReg); - jccb(Assembler::notZero, L_regular_inflated_unlock); - xend(); - jmp(DONE_LABEL); - bind(L_regular_inflated_unlock); - } -#endif - // Despite our balanced locking property we still check that m->_owner == Self // as java routines or native JNI code called by this thread might // have released the lock. diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp index 676382225c241..e268ed3dd7a46 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp @@ -37,39 +37,13 @@ // See full description in macroAssembler_x86.cpp. void fast_lock(Register obj, Register box, Register tmp, Register scr, Register cx1, Register cx2, Register thread, - RTMLockingCounters* rtm_counters, - RTMLockingCounters* stack_rtm_counters, - Metadata* method_data, - bool use_rtm, bool profile_rtm); - void fast_unlock(Register obj, Register box, Register tmp, bool use_rtm); + Metadata* method_data); + void fast_unlock(Register obj, Register box, Register tmp); void fast_lock_lightweight(Register obj, Register box, Register rax_reg, Register t, Register thread); void fast_unlock_lightweight(Register obj, Register reg_rax, Register t, Register thread); -#if INCLUDE_RTM_OPT - void rtm_counters_update(Register abort_status, Register rtm_counters); - void branch_on_random_using_rdtsc(Register tmp, Register scr, int count, Label& brLabel); - void rtm_abort_ratio_calculation(Register tmp, Register rtm_counters_reg, - RTMLockingCounters* rtm_counters, - Metadata* method_data); - void rtm_profiling(Register abort_status_Reg, Register rtm_counters_Reg, - RTMLockingCounters* rtm_counters, Metadata* method_data, bool profile_rtm); - void rtm_retry_lock_on_abort(Register retry_count, Register abort_status, Label& retryLabel); - void rtm_retry_lock_on_busy(Register retry_count, Register box, Register tmp, Register scr, Label& retryLabel); - void rtm_stack_locking(Register obj, Register tmp, Register scr, - Register retry_on_abort_count, - RTMLockingCounters* stack_rtm_counters, - Metadata* method_data, bool profile_rtm, - Label& DONE_LABEL, Label& IsInflated); - void rtm_inflated_locking(Register obj, Register box, Register tmp, - Register scr, Register retry_on_busy_count, - Register retry_on_abort_count, - RTMLockingCounters* rtm_counters, - Metadata* method_data, bool profile_rtm, - Label& DONE_LABEL); -#endif - // Generic instructions support for use in .ad files C2 code generation void vabsnegd(int opcode, XMMRegister dst, XMMRegister src); void vabsnegd(int opcode, XMMRegister dst, XMMRegister src, int vector_len); diff --git a/src/hotspot/cpu/x86/globalDefinitions_x86.hpp b/src/hotspot/cpu/x86/globalDefinitions_x86.hpp index 2e82453b38002..12ac26aff21ac 100644 --- a/src/hotspot/cpu/x86/globalDefinitions_x86.hpp +++ b/src/hotspot/cpu/x86/globalDefinitions_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,11 +52,6 @@ const bool CCallingConventionRequiresIntsAsLongs = false; #define DEFAULT_PADDING_SIZE DEFAULT_CACHE_LINE_SIZE #endif -#if defined(COMPILER2) -// Include Restricted Transactional Memory lock eliding optimization -#define INCLUDE_RTM_OPT 1 -#endif - #if defined(LINUX) || defined(__APPLE__) #define SUPPORT_RESERVED_STACK_AREA #endif diff --git a/src/hotspot/cpu/x86/globals_x86.hpp b/src/hotspot/cpu/x86/globals_x86.hpp index edcd9b58963a4..03fd26195c0ad 100644 --- a/src/hotspot/cpu/x86/globals_x86.hpp +++ b/src/hotspot/cpu/x86/globals_x86.hpp @@ -155,51 +155,6 @@ define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong); product(bool, UseFastStosb, false, \ "Use fast-string operation for zeroing: rep stosb") \ \ - /* Use Restricted Transactional Memory for lock eliding */ \ - product(bool, UseRTMLocking, false, \ - "(Deprecated) Enable RTM lock eliding for inflated locks " \ - "in compiled code") \ - \ - product(bool, UseRTMForStackLocks, false, EXPERIMENTAL, \ - "Enable RTM lock eliding for stack locks in compiled code") \ - \ - product(bool, UseRTMDeopt, false, \ - "(Deprecated) Perform deopt and recompilation based on " \ - "RTM abort ratio") \ - \ - product(int, RTMRetryCount, 5, \ - "(Deprecated) Number of RTM retries on lock abort or busy") \ - range(0, max_jint) \ - \ - product(int, RTMSpinLoopCount, 100, EXPERIMENTAL, \ - "Spin count for lock to become free before RTM retry") \ - range(0, max_jint) \ - \ - product(int, RTMAbortThreshold, 1000, EXPERIMENTAL, \ - "Calculate abort ratio after this number of aborts") \ - range(0, max_jint) \ - \ - product(int, RTMLockingThreshold, 10000, EXPERIMENTAL, \ - "Lock count at which to do RTM lock eliding without " \ - "abort ratio calculation") \ - range(0, max_jint) \ - \ - product(int, RTMAbortRatio, 50, EXPERIMENTAL, \ - "Lock abort ratio at which to stop use RTM lock eliding") \ - range(0, 100) /* natural range */ \ - \ - product(int, RTMTotalCountIncrRate, 64, EXPERIMENTAL, \ - "Increment total RTM attempted lock count once every n times") \ - range(1, max_jint) \ - constraint(RTMTotalCountIncrRateConstraintFunc,AfterErgo) \ - \ - product(intx, RTMLockingCalculationDelay, 0, EXPERIMENTAL, \ - "Number of milliseconds to wait before start calculating aborts " \ - "for RTM locking") \ - \ - product(bool, UseRTMXendForLockBusy, true, EXPERIMENTAL, \ - "Use RTM Xend instead of Xabort when lock busy") \ - \ /* assembler */ \ product(bool, UseCountLeadingZerosInstruction, false, \ "Use count leading zeros instruction") \ diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.hpp b/src/hotspot/cpu/x86/macroAssembler_x86.hpp index fd989c7bd229d..492ea99e04536 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp @@ -30,7 +30,6 @@ #include "code/vmreg.inline.hpp" #include "compiler/oopMap.hpp" #include "utilities/macros.hpp" -#include "runtime/rtmLocking.hpp" #include "runtime/vm_version.hpp" #include "utilities/checkedCast.hpp" diff --git a/src/hotspot/cpu/x86/nativeInst_x86.hpp b/src/hotspot/cpu/x86/nativeInst_x86.hpp index f8cbf70f18961..70cb61793661e 100644 --- a/src/hotspot/cpu/x86/nativeInst_x86.hpp +++ b/src/hotspot/cpu/x86/nativeInst_x86.hpp @@ -160,6 +160,7 @@ class NativeCall: public NativeInstruction { return_address_offset = 5 }; + static int byte_size() { return instruction_size; } address instruction_address() const { return addr_at(instruction_offset); } address next_instruction_address() const { return addr_at(return_address_offset); } int displacement() const { return (jint) int_at(displacement_offset); } diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp index febc1b2c3b143..79a573763dcc1 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp @@ -1476,13 +1476,6 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, // Frame is now completed as far as size and linkage. int frame_complete = ((intptr_t)__ pc()) - start; - if (UseRTMLocking) { - // Abort RTM transaction before calling JNI - // because critical section will be large and will be - // aborted anyway. Also nmethod could be deoptimized. - __ xabort(0); - } - // Calculate the difference between rsp and rbp,. We need to know it // after the native call because on windows Java Natives will pop // the arguments and it is painful to do rsp relative addressing @@ -2422,11 +2415,6 @@ void SharedRuntime::generate_uncommon_trap_blob() { address start = __ pc(); - if (UseRTMLocking) { - // Abort RTM transaction before possible nmethod deoptimization. - __ xabort(0); - } - // Push self-frame. __ subptr(rsp, return_off*wordSize); // Epilog! @@ -2609,13 +2597,6 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t bool cause_return = (poll_type == POLL_AT_RETURN); bool save_vectors = (poll_type == POLL_AT_VECTOR_LOOP); - if (UseRTMLocking) { - // Abort RTM transaction before calling runtime - // because critical section will be large and will be - // aborted anyway. Also nmethod could be deoptimized. - __ xabort(0); - } - // If cause_return is true we are at a poll_return and there is // the return address on the stack to the caller on the nmethod // that is safepoint. We can leave this return on the stack and diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp index 31bbfb747f8a6..ac7baeaf74ff5 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp @@ -1959,13 +1959,6 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, // Frame is now completed as far as size and linkage. int frame_complete = ((intptr_t)__ pc()) - start; - if (UseRTMLocking) { - // Abort RTM transaction before calling JNI - // because critical section will be large and will be - // aborted anyway. Also nmethod could be deoptimized. - __ xabort(0); - } - #ifdef ASSERT __ check_stack_alignment(rsp, "improperly aligned stack"); #endif /* ASSERT */ @@ -2921,11 +2914,6 @@ void SharedRuntime::generate_uncommon_trap_blob() { address start = __ pc(); - if (UseRTMLocking) { - // Abort RTM transaction before possible nmethod deoptimization. - __ xabort(0); - } - // Push self-frame. We get here with a return address on the // stack, so rsp is 8-byte aligned until we allocate our frame. __ subptr(rsp, SimpleRuntimeFrame::return_off << LogBytesPerInt); // Epilog! @@ -3112,13 +3100,6 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t bool cause_return = (poll_type == POLL_AT_RETURN); bool save_wide_vectors = (poll_type == POLL_AT_VECTOR_LOOP); - if (UseRTMLocking) { - // Abort RTM transaction before calling runtime - // because critical section will be large and will be - // aborted anyway. Also nmethod could be deoptimized. - __ xabort(0); - } - // Make room for return address (or push it again) if (!cause_return) { __ push(rbx); diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index cdefa3922be1a..103a7726276c7 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -1322,55 +1322,6 @@ void VM_Version::get_processor_features() { FLAG_SET_DEFAULT(UseSHA, false); } - if (!supports_rtm() && UseRTMLocking) { - vm_exit_during_initialization("RTM instructions are not available on this CPU"); - } - -#if INCLUDE_RTM_OPT - if (UseRTMLocking) { - if (!CompilerConfig::is_c2_enabled()) { - // Only C2 does RTM locking optimization. - vm_exit_during_initialization("RTM locking optimization is not supported in this VM"); - } - if (is_intel_family_core()) { - if ((_model == CPU_MODEL_HASWELL_E3) || - (_model == CPU_MODEL_HASWELL_E7 && _stepping < 3) || - (_model == CPU_MODEL_BROADWELL && _stepping < 4)) { - // currently a collision between SKL and HSW_E3 - if (!UnlockExperimentalVMOptions && UseAVX < 3) { - vm_exit_during_initialization("UseRTMLocking is only available as experimental option on this " - "platform. It must be enabled via -XX:+UnlockExperimentalVMOptions flag."); - } else { - warning("UseRTMLocking is only available as experimental option on this platform."); - } - } - } - if (!FLAG_IS_CMDLINE(UseRTMLocking)) { - // RTM locking should be used only for applications with - // high lock contention. For now we do not use it by default. - vm_exit_during_initialization("UseRTMLocking flag should be only set on command line"); - } - } else { // !UseRTMLocking - if (UseRTMForStackLocks) { - if (!FLAG_IS_DEFAULT(UseRTMForStackLocks)) { - warning("UseRTMForStackLocks flag should be off when UseRTMLocking flag is off"); - } - FLAG_SET_DEFAULT(UseRTMForStackLocks, false); - } - if (UseRTMDeopt) { - FLAG_SET_DEFAULT(UseRTMDeopt, false); - } - if (PrintPreciseRTMLockingStatistics) { - FLAG_SET_DEFAULT(PrintPreciseRTMLockingStatistics, false); - } - } -#else - if (UseRTMLocking) { - // Only C2 does RTM locking optimization. - vm_exit_during_initialization("RTM locking optimization is not supported in this VM"); - } -#endif - #ifdef COMPILER2 if (UseFPUForSpilling) { if (UseSSE < 2) { diff --git a/src/hotspot/cpu/x86/x86_32.ad b/src/hotspot/cpu/x86/x86_32.ad index 240e9b10323bd..49a3cad37df2f 100644 --- a/src/hotspot/cpu/x86/x86_32.ad +++ b/src/hotspot/cpu/x86/x86_32.ad @@ -13613,25 +13613,8 @@ instruct RethrowException() // inlined locking and unlocking -instruct cmpFastLockRTM(eFlagsReg cr, eRegP object, eBXRegP box, eAXRegI tmp, eDXRegI scr, rRegI cx1, rRegI cx2, eRegP thread) %{ - predicate(Compile::current()->use_rtm()); - match(Set cr (FastLock object box)); - effect(TEMP tmp, TEMP scr, TEMP cx1, TEMP cx2, USE_KILL box, TEMP thread); - ins_cost(300); - format %{ "FASTLOCK $object,$box\t! kills $box,$tmp,$scr,$cx1,$cx2" %} - ins_encode %{ - __ get_thread($thread$$Register); - __ fast_lock($object$$Register, $box$$Register, $tmp$$Register, - $scr$$Register, $cx1$$Register, $cx2$$Register, $thread$$Register, - _rtm_counters, _stack_rtm_counters, - ((Method*)(ra_->C->method()->constant_encoding()))->method_data(), - true, ra_->C->profile_rtm()); - %} - ins_pipe(pipe_slow); -%} - instruct cmpFastLock(eFlagsReg cr, eRegP object, eBXRegP box, eAXRegI tmp, eRegP scr, eRegP thread) %{ - predicate(LockingMode != LM_LIGHTWEIGHT && !Compile::current()->use_rtm()); + predicate(LockingMode != LM_LIGHTWEIGHT); match(Set cr (FastLock object box)); effect(TEMP tmp, TEMP scr, USE_KILL box, TEMP thread); ins_cost(300); @@ -13639,7 +13622,7 @@ instruct cmpFastLock(eFlagsReg cr, eRegP object, eBXRegP box, eAXRegI tmp, eRegP ins_encode %{ __ get_thread($thread$$Register); __ fast_lock($object$$Register, $box$$Register, $tmp$$Register, - $scr$$Register, noreg, noreg, $thread$$Register, nullptr, nullptr, nullptr, false, false); + $scr$$Register, noreg, noreg, $thread$$Register, nullptr); %} ins_pipe(pipe_slow); %} @@ -13651,7 +13634,7 @@ instruct cmpFastUnlock(eFlagsReg cr, eRegP object, eAXRegP box, eRegP tmp ) %{ ins_cost(300); format %{ "FASTUNLOCK $object,$box\t! kills $box,$tmp" %} ins_encode %{ - __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register, ra_->C->use_rtm()); + __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register); %} ins_pipe(pipe_slow); %} diff --git a/src/hotspot/cpu/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad index f3ad721dfcb9d..34eb990340178 100644 --- a/src/hotspot/cpu/x86/x86_64.ad +++ b/src/hotspot/cpu/x86/x86_64.ad @@ -12260,31 +12260,15 @@ instruct jmpConUCF2_short(cmpOpUCF2 cop, rFlagsRegUCF cmp, label labl) %{ // ============================================================================ // inlined locking and unlocking -instruct cmpFastLockRTM(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rdx_RegI scr, rRegI cx1, rRegI cx2) %{ - predicate(Compile::current()->use_rtm()); - match(Set cr (FastLock object box)); - effect(TEMP tmp, TEMP scr, TEMP cx1, TEMP cx2, USE_KILL box); - ins_cost(300); - format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr,$cx1,$cx2" %} - ins_encode %{ - __ fast_lock($object$$Register, $box$$Register, $tmp$$Register, - $scr$$Register, $cx1$$Register, $cx2$$Register, r15_thread, - _rtm_counters, _stack_rtm_counters, - ((Method*)(ra_->C->method()->constant_encoding()))->method_data(), - true, ra_->C->profile_rtm()); - %} - ins_pipe(pipe_slow); -%} - instruct cmpFastLock(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rRegP scr) %{ - predicate(LockingMode != LM_LIGHTWEIGHT && !Compile::current()->use_rtm()); + predicate(LockingMode != LM_LIGHTWEIGHT); match(Set cr (FastLock object box)); effect(TEMP tmp, TEMP scr, USE_KILL box); ins_cost(300); format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr" %} ins_encode %{ __ fast_lock($object$$Register, $box$$Register, $tmp$$Register, - $scr$$Register, noreg, noreg, r15_thread, nullptr, nullptr, nullptr, false, false); + $scr$$Register, noreg, noreg, r15_thread, nullptr); %} ins_pipe(pipe_slow); %} @@ -12296,7 +12280,7 @@ instruct cmpFastUnlock(rFlagsReg cr, rRegP object, rax_RegP box, rRegP tmp) %{ ins_cost(300); format %{ "fastunlock $object,$box\t! kills $box,$tmp" %} ins_encode %{ - __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register, ra_->C->use_rtm()); + __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register); %} ins_pipe(pipe_slow); %} diff --git a/src/hotspot/cpu/zero/nativeInst_zero.hpp b/src/hotspot/cpu/zero/nativeInst_zero.hpp index 77a7d511ac5e8..2f3d9b80617ce 100644 --- a/src/hotspot/cpu/zero/nativeInst_zero.hpp +++ b/src/hotspot/cpu/zero/nativeInst_zero.hpp @@ -70,6 +70,8 @@ class NativeCall : public NativeInstruction { instruction_size = 0 // not used within the interpreter }; + static int byte_size() { return instruction_size; } + address instruction_address() const { ShouldNotCallThis(); return nullptr; diff --git a/src/hotspot/share/adlc/output_c.cpp b/src/hotspot/share/adlc/output_c.cpp index 77332b21c0112..804e8f1a4e6c3 100644 --- a/src/hotspot/share/adlc/output_c.cpp +++ b/src/hotspot/share/adlc/output_c.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1614,11 +1614,6 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) { fprintf(fp, " ((MachIfNode*)n%d)->_fcnt = _fcnt;\n", cnt); } - if (node->is_ideal_fastlock() && new_inst->is_ideal_fastlock()) { - fprintf(fp, " ((MachFastLockNode*)n%d)->_rtm_counters = _rtm_counters;\n", cnt); - fprintf(fp, " ((MachFastLockNode*)n%d)->_stack_rtm_counters = _stack_rtm_counters;\n", cnt); - } - // Fill in the bottom_type where requested if (node->captures_bottom_type(_globalNames) && new_inst->captures_bottom_type(_globalNames)) { @@ -4008,10 +4003,6 @@ void ArchDesc::buildMachNode(FILE *fp_cpp, InstructForm *inst, const char *inden if (inst->is_ideal_jump()) { fprintf(fp_cpp, "%s node->_probs = _leaf->as_Jump()->_probs;\n", indent); } - if( inst->is_ideal_fastlock() ) { - fprintf(fp_cpp, "%s node->_rtm_counters = _leaf->as_FastLock()->rtm_counters();\n", indent); - fprintf(fp_cpp, "%s node->_stack_rtm_counters = _leaf->as_FastLock()->stack_rtm_counters();\n", indent); - } } diff --git a/src/hotspot/share/ci/ciEnv.cpp b/src/hotspot/share/ci/ciEnv.cpp index 6d11a436f65d9..565300f43b4ff 100644 --- a/src/hotspot/share/ci/ciEnv.cpp +++ b/src/hotspot/share/ci/ciEnv.cpp @@ -1032,8 +1032,7 @@ void ciEnv::register_method(ciMethod* target, bool has_unsafe_access, bool has_wide_vectors, bool has_monitors, - int immediate_oops_patched, - RTMState rtm_state) { + int immediate_oops_patched) { VM_ENTRY_MARK; nmethod* nm = nullptr; { @@ -1090,14 +1089,6 @@ void ciEnv::register_method(ciMethod* target, // Check for {class loads, evolution, breakpoints, ...} during compilation validate_compile_task_dependencies(target); } -#if INCLUDE_RTM_OPT - if (!failing() && (rtm_state != NoRTM) && - (method()->method_data() != nullptr) && - (method()->method_data()->rtm_state() != rtm_state)) { - // Preemptive decompile if rtm state was changed. - record_failure("RTM state change invalidated rtm code"); - } -#endif if (failing()) { // While not a true deoptimization, it is a preemptive decompile. @@ -1134,9 +1125,6 @@ void ciEnv::register_method(ciMethod* target, nm->set_has_wide_vectors(has_wide_vectors); nm->set_has_monitors(has_monitors); assert(!method->is_synchronized() || nm->has_monitors(), ""); -#if INCLUDE_RTM_OPT - nm->set_rtm_state(rtm_state); -#endif if (entry_bci == InvocationEntryBci) { if (TieredCompilation) { diff --git a/src/hotspot/share/ci/ciEnv.hpp b/src/hotspot/share/ci/ciEnv.hpp index 5d3a61f809e7c..be63632ba4eef 100644 --- a/src/hotspot/share/ci/ciEnv.hpp +++ b/src/hotspot/share/ci/ciEnv.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -383,8 +383,7 @@ class ciEnv : StackObj { bool has_unsafe_access, bool has_wide_vectors, bool has_monitors, - int immediate_oops_patched, - RTMState rtm_state = NoRTM); + int immediate_oops_patched); // Access to certain well known ciObjects. #define VM_CLASS_FUNC(name, ignore_s) \ diff --git a/src/hotspot/share/ci/ciMethodData.hpp b/src/hotspot/share/ci/ciMethodData.hpp index dedbfc9f4d68a..a43d011b77ea2 100644 --- a/src/hotspot/share/ci/ciMethodData.hpp +++ b/src/hotspot/share/ci/ciMethodData.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -479,17 +479,6 @@ class ciMethodData : public ciMetadata { int invocation_count() { return _invocation_counter; } -#if INCLUDE_RTM_OPT - // return cached value - int rtm_state() { - if (is_empty()) { - return NoRTM; - } else { - return get_MethodData()->rtm_state(); - } - } -#endif - // Transfer information about the method to MethodData*. // would_profile means we would like to profile this method, // meaning it's not trivial. diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index fab77fbbdb23f..bcfbae49fd992 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -1229,9 +1229,6 @@ void nmethod::init_defaults(CodeBuffer *code_buffer, CodeOffsets* offsets) { _oops_do_mark_link = nullptr; _compiled_ic_data = nullptr; -#if INCLUDE_RTM_OPT - _rtm_state = NoRTM; -#endif _is_unloading_state = 0; _state = not_installed; diff --git a/src/hotspot/share/code/nmethod.hpp b/src/hotspot/share/code/nmethod.hpp index 9972b89ae4026..e3ac422ca7093 100644 --- a/src/hotspot/share/code/nmethod.hpp +++ b/src/hotspot/share/code/nmethod.hpp @@ -260,12 +260,6 @@ class nmethod : public CodeBlob { CompLevel _comp_level; // compilation level (s1) CompilerType _compiler_type; // which compiler made this nmethod (u1) -#if INCLUDE_RTM_OPT - // RTM state at compile time. Used during deoptimization to decide - // whether to restart collecting RTM locking abort statistic again. - RTMState _rtm_state; -#endif - // Local state used to keep track of whether unloading is happening or not volatile uint8_t _is_unloading_state; @@ -629,12 +623,6 @@ class nmethod : public CodeBlob { bool is_unloading(); void do_unloading(bool unloading_occurred); -#if INCLUDE_RTM_OPT - // rtm state accessing and manipulating - RTMState rtm_state() const { return _rtm_state; } - void set_rtm_state(RTMState state) { _rtm_state = state; } -#endif - bool make_in_use() { return try_transition(in_use); } diff --git a/src/hotspot/share/code/nmethod.inline.hpp b/src/hotspot/share/code/nmethod.inline.hpp index 4af4d3ffaedd9..49af1e0b95f2f 100644 --- a/src/hotspot/share/code/nmethod.inline.hpp +++ b/src/hotspot/share/code/nmethod.inline.hpp @@ -37,7 +37,7 @@ inline bool nmethod::is_deopt_pc(address pc) { return is_deopt_entry(pc) || is_d inline bool nmethod::is_deopt_entry(address pc) { return pc == deopt_handler_begin() #if INCLUDE_JVMCI - || (is_compiled_by_jvmci() && pc == (deopt_handler_begin() + NativeCall::instruction_size)) + || (is_compiled_by_jvmci() && pc == (deopt_handler_begin() + NativeCall::byte_size())) #endif ; } @@ -45,7 +45,7 @@ inline bool nmethod::is_deopt_entry(address pc) { inline bool nmethod::is_deopt_mh_entry(address pc) { return pc == deopt_mh_handler_begin() #if INCLUDE_JVMCI - || (is_compiled_by_jvmci() && pc == (deopt_mh_handler_begin() + NativeCall::instruction_size)) + || (is_compiled_by_jvmci() && pc == (deopt_mh_handler_begin() + NativeCall::byte_size())) #endif ; } diff --git a/src/hotspot/share/compiler/compilerDefinitions.hpp b/src/hotspot/share/compiler/compilerDefinitions.hpp index 9b69501a5986d..03b7d446b1ab3 100644 --- a/src/hotspot/share/compiler/compilerDefinitions.hpp +++ b/src/hotspot/share/compiler/compilerDefinitions.hpp @@ -98,23 +98,6 @@ inline bool is_compile(int comp_level) { return is_c1_compile(comp_level) || is_c2_compile(comp_level); } - -// States of Restricted Transactional Memory usage. -enum RTMState: u1 { - NoRTM = 0x2, // Don't use RTM - UseRTM = 0x1, // Use RTM - ProfileRTM = 0x0 // Use RTM with abort ratio calculation -}; - -#ifndef INCLUDE_RTM_OPT -#define INCLUDE_RTM_OPT 0 -#endif -#if INCLUDE_RTM_OPT -#define RTM_OPT_ONLY(code) code -#else -#define RTM_OPT_ONLY(code) -#endif - class CompilerConfig : public AllStatic { public: // Scale compile thresholds diff --git a/src/hotspot/share/compiler/compilerOracle.hpp b/src/hotspot/share/compiler/compilerOracle.hpp index 1a85e0629f93e..5864ca5dc0dd7 100644 --- a/src/hotspot/share/compiler/compilerOracle.hpp +++ b/src/hotspot/share/compiler/compilerOracle.hpp @@ -77,8 +77,6 @@ class methodHandle; option(CompileThresholdScaling, "CompileThresholdScaling", Double) \ option(ControlIntrinsic, "ControlIntrinsic", Ccstrlist) \ option(DisableIntrinsic, "DisableIntrinsic", Ccstrlist) \ - option(NoRTMLockEliding, "NoRTMLockEliding", Bool) \ - option(UseRTMLockEliding, "UseRTMLockEliding", Bool) \ option(BlockLayoutByFrequency, "BlockLayoutByFrequency", Bool) \ option(TraceOptoPipelining, "TraceOptoPipelining", Bool) \ option(TraceOptoOutput, "TraceOptoOutput", Bool) \ diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp index ed594d72d06e7..49f1c82a98ab0 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp @@ -227,7 +227,7 @@ void G1CollectedHeap::register_region_with_region_attr(G1HeapRegion* r) { void G1CollectedHeap::register_old_region_with_region_attr(G1HeapRegion* r) { assert(!r->has_pinned_objects(), "must be"); assert(r->rem_set()->is_complete(), "must be"); - _region_attr.set_in_old(r->hrm_index(), r->rem_set()->is_tracked()); + _region_attr.set_in_old(r->hrm_index(), true); _rem_set->exclude_region_from_scan(r->hrm_index()); } diff --git a/src/hotspot/share/gc/parallel/psOldGen.hpp b/src/hotspot/share/gc/parallel/psOldGen.hpp index 35cefec8a0a8d..68cac7128da20 100644 --- a/src/hotspot/share/gc/parallel/psOldGen.hpp +++ b/src/hotspot/share/gc/parallel/psOldGen.hpp @@ -108,11 +108,6 @@ class PSOldGen : public CHeapObj { // Size info size_t capacity_in_bytes() const { return object_space()->capacity_in_bytes(); } size_t used_in_bytes() const { return object_space()->used_in_bytes(); } - size_t free_in_bytes() const { return object_space()->free_in_bytes(); } - - size_t capacity_in_words() const { return object_space()->capacity_in_words(); } - size_t used_in_words() const { return object_space()->used_in_words(); } - size_t free_in_words() const { return object_space()->free_in_words(); } bool is_maximal_no_gc() const { return virtual_space()->uncommitted_size() == 0; diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp index 7b8ae42aaa4ec..e0d174dcc6ace 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp @@ -200,188 +200,6 @@ void PSParallelCompact::print_on_error(outputStream* st) { _mark_bitmap.print_on_error(st); } -#ifndef PRODUCT -const char* PSParallelCompact::space_names[] = { - "old ", "eden", "from", "to " -}; - -void PSParallelCompact::print_region_ranges() { - if (!log_develop_is_enabled(Trace, gc, compaction)) { - return; - } - Log(gc, compaction) log; - ResourceMark rm; - LogStream ls(log.trace()); - Universe::print_on(&ls); - log.trace("space bottom top end new_top"); - log.trace("------ ---------- ---------- ---------- ----------"); - - for (unsigned int id = 0; id < last_space_id; ++id) { - const MutableSpace* space = _space_info[id].space(); - log.trace("%u %s " - SIZE_FORMAT_W(10) " " SIZE_FORMAT_W(10) " " - SIZE_FORMAT_W(10) " " SIZE_FORMAT_W(10) " ", - id, space_names[id], - summary_data().addr_to_region_idx(space->bottom()), - summary_data().addr_to_region_idx(space->top()), - summary_data().addr_to_region_idx(space->end()), - summary_data().addr_to_region_idx(_space_info[id].new_top())); - } -} - -static void -print_generic_summary_region(size_t i, const ParallelCompactData::RegionData* c) -{ -#define REGION_IDX_FORMAT SIZE_FORMAT_W(7) -#define REGION_DATA_FORMAT SIZE_FORMAT_W(5) - - ParallelCompactData& sd = PSParallelCompact::summary_data(); - size_t dci = c->destination() ? sd.addr_to_region_idx(c->destination()) : 0; - log_develop_trace(gc, compaction)( - REGION_IDX_FORMAT " " - REGION_IDX_FORMAT " " PTR_FORMAT " " - REGION_DATA_FORMAT " " REGION_DATA_FORMAT " " - REGION_DATA_FORMAT " " REGION_IDX_FORMAT " %d", - i, dci, p2i(c->destination()), - c->partial_obj_size(), c->live_obj_size(), - c->data_size(), c->source_region(), c->destination_count()); - -#undef REGION_IDX_FORMAT -#undef REGION_DATA_FORMAT -} - -void -print_generic_summary_data(ParallelCompactData& summary_data, - HeapWord* const beg_addr, - HeapWord* const end_addr) -{ - size_t total_words = 0; - size_t i = summary_data.addr_to_region_idx(beg_addr); - const size_t last = summary_data.addr_to_region_idx(end_addr); - HeapWord* pdest = 0; - - while (i < last) { - ParallelCompactData::RegionData* c = summary_data.region(i); - if (c->data_size() != 0 || c->destination() != pdest) { - print_generic_summary_region(i, c); - total_words += c->data_size(); - pdest = c->destination(); - } - ++i; - } - - log_develop_trace(gc, compaction)("summary_data_bytes=" SIZE_FORMAT, total_words * HeapWordSize); -} - -void -PSParallelCompact::print_generic_summary_data(ParallelCompactData& summary_data, - HeapWord* const beg_addr, - HeapWord* const end_addr) { - ::print_generic_summary_data(summary_data,beg_addr, end_addr); -} - -static void -print_initial_summary_data(ParallelCompactData& summary_data, - const MutableSpace* space) { - if (space->top() == space->bottom()) { - return; - } - - const size_t region_size = ParallelCompactData::RegionSize; - typedef ParallelCompactData::RegionData RegionData; - HeapWord* const top_aligned_up = summary_data.region_align_up(space->top()); - const size_t end_region = summary_data.addr_to_region_idx(top_aligned_up); - const RegionData* c = summary_data.region(end_region - 1); - HeapWord* end_addr = c->destination() + c->data_size(); - const size_t live_in_space = pointer_delta(end_addr, space->bottom()); - - // Print (and count) the full regions at the beginning of the space. - size_t full_region_count = 0; - size_t i = summary_data.addr_to_region_idx(space->bottom()); - while (i < end_region && summary_data.region(i)->data_size() == region_size) { - ParallelCompactData::RegionData* c = summary_data.region(i); - log_develop_trace(gc, compaction)( - SIZE_FORMAT_W(5) " " PTR_FORMAT " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " %d", - i, p2i(c->destination()), - c->partial_obj_size(), c->live_obj_size(), - c->data_size(), c->source_region(), c->destination_count()); - ++full_region_count; - ++i; - } - - size_t live_to_right = live_in_space - full_region_count * region_size; - - double max_reclaimed_ratio = 0.0; - size_t max_reclaimed_ratio_region = 0; - size_t max_dead_to_right = 0; - size_t max_live_to_right = 0; - - // Print the 'reclaimed ratio' for regions while there is something live in - // the region or to the right of it. The remaining regions are empty (and - // uninteresting), and computing the ratio will result in division by 0. - while (i < end_region && live_to_right > 0) { - c = summary_data.region(i); - HeapWord* const region_addr = summary_data.region_to_addr(i); - const size_t used_to_right = pointer_delta(space->top(), region_addr); - const size_t dead_to_right = used_to_right - live_to_right; - const double reclaimed_ratio = double(dead_to_right) / live_to_right; - - if (reclaimed_ratio > max_reclaimed_ratio) { - max_reclaimed_ratio = reclaimed_ratio; - max_reclaimed_ratio_region = i; - max_dead_to_right = dead_to_right; - max_live_to_right = live_to_right; - } - - ParallelCompactData::RegionData* c = summary_data.region(i); - log_develop_trace(gc, compaction)( - SIZE_FORMAT_W(5) " " PTR_FORMAT " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " %d" - "%12.10f " SIZE_FORMAT_W(10) " " SIZE_FORMAT_W(10), - i, p2i(c->destination()), - c->partial_obj_size(), c->live_obj_size(), - c->data_size(), c->source_region(), c->destination_count(), - reclaimed_ratio, dead_to_right, live_to_right); - - - live_to_right -= c->data_size(); - ++i; - } - - // Any remaining regions are empty. Print one more if there is one. - if (i < end_region) { - ParallelCompactData::RegionData* c = summary_data.region(i); - log_develop_trace(gc, compaction)( - SIZE_FORMAT_W(5) " " PTR_FORMAT " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " %d", - i, p2i(c->destination()), - c->partial_obj_size(), c->live_obj_size(), - c->data_size(), c->source_region(), c->destination_count()); - } - - log_develop_trace(gc, compaction)("max: " SIZE_FORMAT_W(4) " d2r=" SIZE_FORMAT_W(10) " l2r=" SIZE_FORMAT_W(10) " max_ratio=%14.12f", - max_reclaimed_ratio_region, max_dead_to_right, max_live_to_right, max_reclaimed_ratio); -} - -static void -print_initial_summary_data(ParallelCompactData& summary_data, - SpaceInfo* space_info) { - if (!log_develop_is_enabled(Trace, gc, compaction)) { - return; - } - - unsigned int id = PSParallelCompact::old_space_id; - const MutableSpace* space; - do { - space = space_info[id].space(); - print_initial_summary_data(summary_data, space); - } while (++id < PSParallelCompact::eden_space_id); - - do { - space = space_info[id].space(); - print_generic_summary_data(summary_data, space->bottom(), space->top()); - } while (++id < PSParallelCompact::last_space_id); -} -#endif // #ifndef PRODUCT - ParallelCompactData::ParallelCompactData() : _heap_start(nullptr), DEBUG_ONLY(_heap_end(nullptr) COMMA) @@ -1008,29 +826,6 @@ void PSParallelCompact::fill_dense_prefix_end(SpaceId id) { } } -#ifndef PRODUCT -void PSParallelCompact::summary_phase_msg(SpaceId dst_space_id, - HeapWord* dst_beg, HeapWord* dst_end, - SpaceId src_space_id, - HeapWord* src_beg, HeapWord* src_end) -{ - log_develop_trace(gc, compaction)( - "Summarizing %d [%s] into %d [%s]: " - "src=" PTR_FORMAT "-" PTR_FORMAT " " - SIZE_FORMAT "-" SIZE_FORMAT " " - "dst=" PTR_FORMAT "-" PTR_FORMAT " " - SIZE_FORMAT "-" SIZE_FORMAT, - src_space_id, space_names[src_space_id], - dst_space_id, space_names[dst_space_id], - p2i(src_beg), p2i(src_end), - _summary_data.addr_to_region_idx(src_beg), - _summary_data.addr_to_region_idx(src_end), - p2i(dst_beg), p2i(dst_end), - _summary_data.addr_to_region_idx(dst_beg), - _summary_data.addr_to_region_idx(dst_end)); -} -#endif // #ifndef PRODUCT - bool PSParallelCompact::reassess_maximum_compaction(bool maximum_compaction, size_t total_live_words, MutableSpace* const old_space, @@ -1114,8 +909,6 @@ void PSParallelCompact::summary_phase(bool maximum_compaction) space->bottom()); const size_t available = pointer_delta(dst_space_end, *new_top_addr); - NOT_PRODUCT(summary_phase_msg(dst_space_id, *new_top_addr, dst_space_end, - SpaceId(id), space->bottom(), space->top());) if (live > 0 && live <= available) { // All the live data will fit. bool done = _summary_data.summarize(_space_info[id].split_info(), @@ -1143,9 +936,6 @@ void PSParallelCompact::summary_phase(bool maximum_compaction) dst_space_id = SpaceId(id); dst_space_end = space->end(); new_top_addr = _space_info[id].new_top_addr(); - NOT_PRODUCT(summary_phase_msg(dst_space_id, - space->bottom(), dst_space_end, - SpaceId(id), next_src_addr, space->top());) done = _summary_data.summarize(_space_info[id].split_info(), next_src_addr, space->top(), nullptr, @@ -1155,10 +945,6 @@ void PSParallelCompact::summary_phase(bool maximum_compaction) assert(*new_top_addr <= space->top(), "usage should not grow"); } } - - log_develop_trace(gc, compaction)("Summary_phase: after final summarization"); - NOT_PRODUCT(print_region_ranges()); - NOT_PRODUCT(print_initial_summary_data(_summary_data, _space_info)); } // This method should contain all heap-specific policy for invoking a full @@ -2126,15 +1912,12 @@ void PSParallelCompact::verify_complete(SpaceId space_id) { const size_t new_top_region = sd.addr_to_region_idx(new_top_addr); const size_t old_top_region = sd.addr_to_region_idx(old_top_addr); - bool issued_a_warning = false; - size_t cur_region; for (cur_region = beg_region; cur_region < new_top_region; ++cur_region) { const RegionData* const c = sd.region(cur_region); if (!c->completed()) { log_warning(gc)("region " SIZE_FORMAT " not filled: destination_count=%u", cur_region, c->destination_count()); - issued_a_warning = true; } } @@ -2143,13 +1926,8 @@ void PSParallelCompact::verify_complete(SpaceId space_id) { if (!c->available()) { log_warning(gc)("region " SIZE_FORMAT " not empty: destination_count=%u", cur_region, c->destination_count()); - issued_a_warning = true; } } - - if (issued_a_warning) { - print_region_ranges(); - } } #endif // #ifdef ASSERT @@ -2450,7 +2228,7 @@ void PSParallelCompact::fill_region(ParCompactionManager* cm, MoveAndUpdateClosu if (closure.is_full()) { decrement_destination_counts(cm, src_space_id, src_region_idx, closure.source()); - closure.complete_region(cm, dest_addr, region_ptr); + closure.complete_region(dest_addr, region_ptr); return; } @@ -2493,7 +2271,7 @@ void PSParallelCompact::fill_region(ParCompactionManager* cm, MoveAndUpdateClosu if (closure.is_full()) { decrement_destination_counts(cm, src_space_id, src_region_idx, closure.source()); - closure.complete_region(cm, dest_addr, region_ptr); + closure.complete_region(dest_addr, region_ptr); return; } @@ -2526,7 +2304,7 @@ void PSParallelCompact::fill_and_update_shadow_region(ParCompactionManager* cm, region_ptr->shadow_to_normal(); return fill_region(cm, cl, region_idx); } else { - MoveAndUpdateShadowClosure cl(mark_bitmap(), cm, region_idx, shadow_region); + MoveAndUpdateShadowClosure cl(mark_bitmap(), region_idx, shadow_region); return fill_region(cm, cl, region_idx); } } @@ -2603,8 +2381,7 @@ void MoveAndUpdateClosure::copy_partial_obj(size_t partial_obj_size) update_state(words); } -void MoveAndUpdateClosure::complete_region(ParCompactionManager *cm, HeapWord *dest_addr, - PSParallelCompact::RegionData *region_ptr) { +void MoveAndUpdateClosure::complete_region(HeapWord* dest_addr, PSParallelCompact::RegionData* region_ptr) { assert(region_ptr->shadow_state() == ParallelCompactData::RegionData::NormalRegion, "Region should be finished"); region_ptr->set_completed(); } @@ -2634,8 +2411,7 @@ void MoveAndUpdateClosure::do_addr(HeapWord* addr, size_t words) { update_state(words); } -void MoveAndUpdateShadowClosure::complete_region(ParCompactionManager *cm, HeapWord *dest_addr, - PSParallelCompact::RegionData *region_ptr) { +void MoveAndUpdateShadowClosure::complete_region(HeapWord* dest_addr, PSParallelCompact::RegionData* region_ptr) { assert(region_ptr->shadow_state() == ParallelCompactData::RegionData::ShadowRegion, "Region should be shadow"); // Record the shadow region index region_ptr->set_shadow_region(_shadow); diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.hpp b/src/hotspot/share/gc/parallel/psParallelCompact.hpp index b30ed0ab98a43..93ea7aed78e9f 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.hpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.hpp @@ -695,8 +695,6 @@ class PSParallelCompact : AllStatic { virtual bool do_object_b(oop p); }; - friend class PSParallelCompactTest; - private: static STWGCTimer _gc_timer; static ParallelOldTracer _gc_tracer; @@ -755,13 +753,6 @@ class PSParallelCompact : AllStatic { // Add available regions to the stack and draining tasks to the task queue. static void prepare_region_draining_tasks(uint parallel_gc_threads); -#ifndef PRODUCT - // Print generic summary data - static void print_generic_summary_data(ParallelCompactData& summary_data, - HeapWord* const beg_addr, - HeapWord* const end_addr); -#endif // #ifndef PRODUCT - static void fill_range_in_dense_prefix(HeapWord* start, HeapWord* end); public: @@ -857,16 +848,6 @@ class PSParallelCompact : AllStatic { static void print_on_error(outputStream* st); -#ifndef PRODUCT - // Debugging support. - static const char* space_names[last_space_id]; - static void print_region_ranges(); - static void summary_phase_msg(SpaceId dst_space_id, - HeapWord* dst_beg, HeapWord* dst_end, - SpaceId src_space_id, - HeapWord* src_beg, HeapWord* src_end); -#endif // #ifndef PRODUCT - #ifdef ASSERT // Sanity check the new location of a word in the heap. static inline void check_new_location(HeapWord* old_addr, HeapWord* new_addr); @@ -914,8 +895,7 @@ class MoveAndUpdateClosure: public StackObj { // updated. void copy_partial_obj(size_t partial_obj_size); - virtual void complete_region(ParCompactionManager* cm, HeapWord* dest_addr, - PSParallelCompact::RegionData* region_ptr); + virtual void complete_region(HeapWord* dest_addr, PSParallelCompact::RegionData* region_ptr); }; inline void MoveAndUpdateClosure::decrement_words_remaining(size_t words) { @@ -951,11 +931,9 @@ inline void MoveAndUpdateClosure::update_state(size_t words) class MoveAndUpdateShadowClosure: public MoveAndUpdateClosure { inline size_t calculate_shadow_offset(size_t region_idx, size_t shadow_idx); public: - inline MoveAndUpdateShadowClosure(ParMarkBitMap* bitmap, ParCompactionManager* cm, - size_t region, size_t shadow); + inline MoveAndUpdateShadowClosure(ParMarkBitMap* bitmap, size_t region, size_t shadow); - virtual void complete_region(ParCompactionManager* cm, HeapWord* dest_addr, - PSParallelCompact::RegionData* region_ptr); + virtual void complete_region(HeapWord* dest_addr, PSParallelCompact::RegionData* region_ptr); private: size_t _shadow; @@ -969,10 +947,7 @@ inline size_t MoveAndUpdateShadowClosure::calculate_shadow_offset(size_t region_ } inline -MoveAndUpdateShadowClosure::MoveAndUpdateShadowClosure(ParMarkBitMap *bitmap, - ParCompactionManager *cm, - size_t region, - size_t shadow) : +MoveAndUpdateShadowClosure::MoveAndUpdateShadowClosure(ParMarkBitMap* bitmap, size_t region, size_t shadow) : MoveAndUpdateClosure(bitmap, region), _shadow(shadow) { _offset = calculate_shadow_offset(region, shadow); diff --git a/src/hotspot/share/gc/serial/defNewGeneration.hpp b/src/hotspot/share/gc/serial/defNewGeneration.hpp index 65ee52cf4ea31..baf565e28629b 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.hpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.hpp @@ -191,7 +191,6 @@ class DefNewGeneration: public Generation { size_t max_survivor_size() const { return _max_survivor_size; } // Thread-local allocation buffers - bool supports_tlab_allocation() const { return true; } size_t tlab_capacity() const; size_t tlab_used() const; size_t unsafe_max_tlab_alloc() const; diff --git a/src/hotspot/share/gc/serial/generation.hpp b/src/hotspot/share/gc/serial/generation.hpp index 9f73caacb192a..5e5aad5d0c1b2 100644 --- a/src/hotspot/share/gc/serial/generation.hpp +++ b/src/hotspot/share/gc/serial/generation.hpp @@ -114,9 +114,6 @@ class Generation: public CHeapObj { // Like "allocate", but performs any necessary locking internally. virtual HeapWord* par_allocate(size_t word_size, bool is_tlab) = 0; - // Thread-local allocation buffers - virtual bool supports_tlab_allocation() const { return false; } - // Perform a heap collection, attempting to create (at least) enough // space to support an allocation of the given "word_size". If // successful, perform the allocation and return the resulting diff --git a/src/hotspot/share/gc/serial/serialHeap.cpp b/src/hotspot/share/gc/serial/serialHeap.cpp index 9e3bd0b81db8e..8dd8a9c0e6766 100644 --- a/src/hotspot/share/gc/serial/serialHeap.cpp +++ b/src/hotspot/share/gc/serial/serialHeap.cpp @@ -833,20 +833,15 @@ bool SerialHeap::block_is_obj(const HeapWord* addr) const { } size_t SerialHeap::tlab_capacity(Thread* thr) const { - assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!"); - assert(_young_gen->supports_tlab_allocation(), "Young gen doesn't support TLAB allocation?!"); + // Only young-gen supports tlab allocation. return _young_gen->tlab_capacity(); } size_t SerialHeap::tlab_used(Thread* thr) const { - assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!"); - assert(_young_gen->supports_tlab_allocation(), "Young gen doesn't support TLAB allocation?!"); return _young_gen->tlab_used(); } size_t SerialHeap::unsafe_max_tlab_alloc(Thread* thr) const { - assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!"); - assert(_young_gen->supports_tlab_allocation(), "Young gen doesn't support TLAB allocation?!"); return _young_gen->unsafe_max_tlab_alloc(); } diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.hpp b/src/hotspot/share/gc/serial/tenuredGeneration.hpp index 5d6c19afbfc4b..dc2730eaf419d 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.hpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.hpp @@ -143,7 +143,7 @@ class TenuredGeneration: public Generation { bool should_allocate(size_t word_size, bool is_tlab) { bool result = false; size_t overflow_limit = (size_t)1 << (BitsPerSize_t - LogHeapWordSize); - if (!is_tlab || supports_tlab_allocation()) { + if (!is_tlab) { result = (word_size > 0) && (word_size < overflow_limit); } return result; diff --git a/src/hotspot/share/oops/methodData.cpp b/src/hotspot/share/oops/methodData.cpp index 08dfc1fe95a36..af19d59f28123 100644 --- a/src/hotspot/share/oops/methodData.cpp +++ b/src/hotspot/share/oops/methodData.cpp @@ -1333,21 +1333,6 @@ void MethodData::init() { _failed_speculations = nullptr; #endif -#if INCLUDE_RTM_OPT - _rtm_state = NoRTM; // No RTM lock eliding by default - if (UseRTMLocking && - !CompilerOracle::has_option(mh, CompileCommandEnum::NoRTMLockEliding)) { - if (CompilerOracle::has_option(mh, CompileCommandEnum::UseRTMLockEliding) || !UseRTMDeopt) { - // Generate RTM lock eliding code without abort ratio calculation code. - _rtm_state = UseRTM; - } else if (UseRTMDeopt) { - // Generate RTM lock eliding code and include abort ratio calculation - // code if UseRTMDeopt is on. - _rtm_state = ProfileRTM; - } - } -#endif - // Initialize escape flags. clear_escape_info(); } diff --git a/src/hotspot/share/oops/methodData.hpp b/src/hotspot/share/oops/methodData.hpp index 4fa42eec960d7..b6e2a1c965212 100644 --- a/src/hotspot/share/oops/methodData.hpp +++ b/src/hotspot/share/oops/methodData.hpp @@ -2070,11 +2070,6 @@ class MethodData : public Metadata { int _invoke_mask; // per-method Tier0InvokeNotifyFreqLog int _backedge_mask; // per-method Tier0BackedgeNotifyFreqLog -#if INCLUDE_RTM_OPT - // State of RTM code generation during compilation of the method - int _rtm_state; -#endif - // Number of loops and blocks is computed when compiling the first // time with C1. It is used to determine if method is trivial. short _num_loops; @@ -2270,22 +2265,6 @@ class MethodData : public Metadata { } #endif -#if INCLUDE_RTM_OPT - int rtm_state() const { - return _rtm_state; - } - void set_rtm_state(RTMState rstate) { - _rtm_state = (int)rstate; - } - void atomic_set_rtm_state(RTMState rstate) { - Atomic::store(&_rtm_state, (int)rstate); - } - - static ByteSize rtm_state_offset() { - return byte_offset_of(MethodData, _rtm_state); - } -#endif - void set_would_profile(bool p) { _would_profile = p ? profile : no_profile; } bool would_profile() const { return _would_profile != no_profile; } diff --git a/src/hotspot/share/opto/c2_globals.hpp b/src/hotspot/share/opto/c2_globals.hpp index f2445e4f13688..7288533cd33e7 100644 --- a/src/hotspot/share/opto/c2_globals.hpp +++ b/src/hotspot/share/opto/c2_globals.hpp @@ -457,9 +457,6 @@ develop(bool, PrintLockStatistics, false, \ "Print precise statistics on the dynamic lock usage") \ \ - product(bool, PrintPreciseRTMLockingStatistics, false, DIAGNOSTIC, \ - "Print per-lock-site statistics of rtm locking in JVM") \ - \ develop(bool, PrintEliminateLocks, false, \ "Print out when locks are eliminated") \ \ diff --git a/src/hotspot/share/opto/classes.hpp b/src/hotspot/share/opto/classes.hpp index db6cb817d77f6..7908f21de10ba 100644 --- a/src/hotspot/share/opto/classes.hpp +++ b/src/hotspot/share/opto/classes.hpp @@ -269,7 +269,6 @@ macro(Opaque1) macro(OpaqueLoopInit) macro(OpaqueLoopStride) macro(OpaqueZeroTripGuard) -macro(Opaque3) macro(Opaque4) macro(OpaqueInitializedAssertionPredicate) macro(ProfileBoolean) diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index 25c7ced8aebfe..3687bc70efdc4 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -713,10 +713,9 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci, set_print_intrinsics(directive->PrintIntrinsicsOption); set_has_irreducible_loop(true); // conservative until build_loop_tree() reset it - if (ProfileTraps RTM_OPT_ONLY( || UseRTMLocking )) { + if (ProfileTraps) { // Make sure the method being compiled gets its own MDO, // so we can at least track the decompile_count(). - // Need MDO to record RTM code generation state. method()->ensure_method_data(); } @@ -1075,25 +1074,8 @@ void Compile::Init(bool aliasing) { set_use_cmove(UseCMoveUnconditionally /* || do_vector_loop()*/); //TODO: consider do_vector_loop() mandate use_cmove unconditionally NOT_PRODUCT(if (use_cmove() && Verbose && has_method()) {tty->print("Compile::Init: use CMove without profitability tests for method %s\n", method()->name()->as_quoted_ascii());}) - set_rtm_state(NoRTM); // No RTM lock eliding by default _max_node_limit = _directive->MaxNodeLimitOption; -#if INCLUDE_RTM_OPT - if (UseRTMLocking && has_method() && (method()->method_data_or_null() != nullptr)) { - int rtm_state = method()->method_data()->rtm_state(); - if (method_has_option(CompileCommandEnum::NoRTMLockEliding) || ((rtm_state & NoRTM) != 0)) { - // Don't generate RTM lock eliding code. - set_rtm_state(NoRTM); - } else if (method_has_option(CompileCommandEnum::UseRTMLockEliding) || ((rtm_state & UseRTM) != 0) || !UseRTMDeopt) { - // Generate RTM lock eliding code without abort ratio calculation code. - set_rtm_state(UseRTM); - } else if (UseRTMDeopt) { - // Generate RTM lock eliding code and include abort ratio calculation - // code if UseRTMDeopt is on. - set_rtm_state(ProfileRTM); - } - } -#endif if (VM_Version::supports_fast_class_init_checks() && has_method() && !is_osr_compilation() && method()->needs_clinit_barrier()) { set_clinit_barrier_on_entry(true); } @@ -3222,7 +3204,6 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f frc.inc_double_count(); break; case Op_Opaque1: // Remove Opaque Nodes before matching - case Op_Opaque3: n->subsume_by(n->in(1), this); break; case Op_CallStaticJava: diff --git a/src/hotspot/share/opto/compile.hpp b/src/hotspot/share/opto/compile.hpp index e1d9b61f7f8d1..7c998d59d37fc 100644 --- a/src/hotspot/share/opto/compile.hpp +++ b/src/hotspot/share/opto/compile.hpp @@ -355,7 +355,6 @@ class Compile : public Phase { bool _has_method_handle_invokes; // True if this method has MethodHandle invokes. bool _has_monitors; // Metadata transfered to nmethod to enable Continuations lock-detection fastpath bool _clinit_barrier_on_entry; // True if clinit barrier is needed on nmethod entry - RTMState _rtm_state; // State of Restricted Transactional Memory usage int _loop_opts_cnt; // loop opts round uint _stress_seed; // Seed for stress testing @@ -667,10 +666,6 @@ class Compile : public Phase { void set_print_inlining(bool z) { _print_inlining = z; } bool print_intrinsics() const { return _print_intrinsics; } void set_print_intrinsics(bool z) { _print_intrinsics = z; } - RTMState rtm_state() const { return _rtm_state; } - void set_rtm_state(RTMState s) { _rtm_state = s; } - bool use_rtm() const { return (_rtm_state & NoRTM) == 0; } - bool profile_rtm() const { return _rtm_state == ProfileRTM; } uint max_node_limit() const { return (uint)_max_node_limit; } void set_max_node_limit(uint n) { _max_node_limit = n; } bool clinit_barrier_on_entry() { return _clinit_barrier_on_entry; } diff --git a/src/hotspot/share/opto/graphKit.cpp b/src/hotspot/share/opto/graphKit.cpp index 614a4123c0dbe..134d21e5bad18 100644 --- a/src/hotspot/share/opto/graphKit.cpp +++ b/src/hotspot/share/opto/graphKit.cpp @@ -3491,9 +3491,6 @@ FastLockNode* GraphKit::shared_lock(Node* obj) { FastLockNode * flock = _gvn.transform(new FastLockNode(0, obj, box) )->as_FastLock(); - // Create the rtm counters for this fast lock if needed. - flock->create_rtm_lock_counter(sync_jvms()); // sync_jvms used to get current bci - // Add monitor to debug info for the slow path. If we block inside the // slow path and de-opt, we need the monitor hanging around map()->push_monitor( flock ); diff --git a/src/hotspot/share/opto/locknode.cpp b/src/hotspot/share/opto/locknode.cpp index 17d26d620e5b0..917d9d2bada12 100644 --- a/src/hotspot/share/opto/locknode.cpp +++ b/src/hotspot/share/opto/locknode.cpp @@ -194,22 +194,6 @@ bool FastUnlockNode::cmp( const Node &n ) const { return (&n == this); // Always fail except on self } -void FastLockNode::create_rtm_lock_counter(JVMState* state) { -#if INCLUDE_RTM_OPT - Compile* C = Compile::current(); - if (C->profile_rtm() || (PrintPreciseRTMLockingStatistics && C->use_rtm())) { - RTMLockingNamedCounter* rlnc = (RTMLockingNamedCounter*) - OptoRuntime::new_named_counter(state, NamedCounter::RTMLockingCounter); - _rtm_counters = rlnc->counters(); - if (UseRTMForStackLocks) { - rlnc = (RTMLockingNamedCounter*) - OptoRuntime::new_named_counter(state, NamedCounter::RTMLockingCounter); - _stack_rtm_counters = rlnc->counters(); - } - } -#endif -} - //============================================================================= //------------------------------do_monitor_enter------------------------------- void Parse::do_monitor_enter() { diff --git a/src/hotspot/share/opto/locknode.hpp b/src/hotspot/share/opto/locknode.hpp index fcc8da0eb343e..0a7e4bd4905c7 100644 --- a/src/hotspot/share/opto/locknode.hpp +++ b/src/hotspot/share/opto/locknode.hpp @@ -29,8 +29,6 @@ #include "opto/opcodes.hpp" #include "opto/subnode.hpp" -class RTMLockingCounters; - //------------------------------BoxLockNode------------------------------------ class BoxLockNode : public Node { private: @@ -130,16 +128,10 @@ class BoxLockNode : public Node { //------------------------------FastLockNode----------------------------------- class FastLockNode: public CmpNode { -private: - RTMLockingCounters* _rtm_counters; // RTM lock counters for inflated locks - RTMLockingCounters* _stack_rtm_counters; // RTM lock counters for stack locks - public: FastLockNode(Node *ctrl, Node *oop, Node *box) : CmpNode(oop,box) { init_req(0,ctrl); init_class_id(Class_FastLock); - _rtm_counters = nullptr; - _stack_rtm_counters = nullptr; } Node* obj_node() const { return in(1); } Node* box_node() const { return in(2); } @@ -153,10 +145,6 @@ class FastLockNode: public CmpNode { virtual int Opcode() const; virtual const Type* Value(PhaseGVN* phase) const { return TypeInt::CC; } const Type *sub(const Type *t1, const Type *t2) const { return TypeInt::CC;} - - void create_rtm_lock_counter(JVMState* state); - RTMLockingCounters* rtm_counters() const { return _rtm_counters; } - RTMLockingCounters* stack_rtm_counters() const { return _stack_rtm_counters; } }; diff --git a/src/hotspot/share/opto/loopTransform.cpp b/src/hotspot/share/opto/loopTransform.cpp index b4faced574d09..a02690778a019 100644 --- a/src/hotspot/share/opto/loopTransform.cpp +++ b/src/hotspot/share/opto/loopTransform.cpp @@ -901,15 +901,6 @@ bool IdealLoopTree::policy_maximally_unroll(PhaseIdealLoop* phase) const { case Op_CountPositives: { return false; } -#if INCLUDE_RTM_OPT - case Op_FastLock: - case Op_FastUnlock: { - // Don't unroll RTM locking code because it is large. - if (UseRTMLocking) { - return false; - } - } -#endif } // switch } @@ -1074,15 +1065,6 @@ bool IdealLoopTree::policy_unroll(PhaseIdealLoop *phase) { // String intrinsics are large and have loops. return false; } -#if INCLUDE_RTM_OPT - case Op_FastLock: - case Op_FastUnlock: { - // Don't unroll RTM locking code because it is large. - if (UseRTMLocking) { - return false; - } - } -#endif } // switch } diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp index ad603439e5973..90ef4da4f1e0e 100644 --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1460,7 +1460,7 @@ class PhaseIdealLoop : public PhaseTransform { }; AutoVectorizeStatus auto_vectorize(IdealLoopTree* lpt, VSharedData &vshared); - // Move UnorderedReduction out of loop if possible + // Move an unordered Reduction out of loop if possible void move_unordered_reduction_out_of_loop(IdealLoopTree* loop); // Create a scheduled list of nodes control dependent on ctrl set. diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp index a3227d4783266..b19c71fdd8689 100644 --- a/src/hotspot/share/opto/loopopts.cpp +++ b/src/hotspot/share/opto/loopopts.cpp @@ -2987,52 +2987,101 @@ RegionNode* PhaseIdealLoop::insert_region_before_proj(ProjNode* proj) { return reg; } -//------------------------------ insert_cmpi_loop_exit ------------------------------------- -// Clone a signed compare loop exit from an unsigned compare and -// insert it before the unsigned cmp on the stay-in-loop path. -// All new nodes inserted in the dominator tree between the original -// if and it's projections. The original if test is replaced with -// a constant to force the stay-in-loop path. +// Idea +// ---- +// Partial Peeling tries to rotate the loop in such a way that it can later be turned into a counted loop. Counted loops +// require a signed loop exit test. When calling this method, we've only found a suitable unsigned test to partial peel +// with. Therefore, we try to split off a signed loop exit test from the unsigned test such that it can be used as new +// loop exit while keeping the unsigned test unchanged and preserving the same behavior as if we've used the unsigned +// test alone instead: // -// This is done to make sure that the original if and it's projections -// still dominate the same set of control nodes, that the ctrl() relation -// from data nodes to them is preserved, and that their loop nesting is -// preserved. +// Before Partial Peeling: +// Loop: +// +// Split off signed loop exit test +// <-- CUT HERE --> +// Unchanged unsigned loop exit test +// +// goto Loop // -// before -// if(i +// Cloned split off signed loop exit test +// Loop: +// Unchanged unsigned loop exit test +// +// +// Split off signed loop exit test +// goto Loop +// +// Details +// ------- +// Before: +// if (i in(1)->as_Bool(); - if (bol->_test._test != BoolTest::lt) return nullptr; + if (bol->_test._test != BoolTest::lt) { + return nullptr; + } CmpNode* cmpu = bol->in(1)->as_Cmp(); - if (cmpu->Opcode() != Op_CmpU) return nullptr; + assert(cmpu->Opcode() == Op_CmpU, "must be unsigned comparison"); + int stride = stride_of_possible_iv(if_cmpu); - if (stride == 0) return nullptr; + if (stride == 0) { + return nullptr; + } Node* lp_proj = stay_in_loop(if_cmpu, loop); guarantee(lp_proj != nullptr, "null loop node"); @@ -3044,14 +3093,93 @@ IfNode* PhaseIdealLoop::insert_cmpi_loop_exit(IfNode* if_cmpu, IdealLoopTree *lo // We therefore can't add a single exit condition. return nullptr; } - // The loop exit condition is !(i (i < 0 || i >= limit). - // Split out the exit condition (i < 0) for stride < 0 or (i >= limit) for stride > 0. - Node* limit = nullptr; + // The unsigned loop exit condition is + // !(i =u limit + // + // First, we note that for any x for which + // 0 <= x <= INT_MAX + // we can convert x to an unsigned int and still get the same guarantee: + // 0 <= (uint) x <= INT_MAX = (uint) INT_MAX + // 0 <=u (uint) x <=u INT_MAX = (uint) INT_MAX (LEMMA) + // + // With that in mind, if + // limit >= 0 (COND) + // then the unsigned loop exit condition + // i >=u limit (ULE) + // is equivalent to + // i < 0 || i >= limit (SLE-full) + // because either i is negative and therefore always greater than MAX_INT when converting to unsigned + // (uint) i >=u MAX_INT >= limit >= 0 + // or otherwise + // i >= limit >= 0 + // holds due to (LEMMA). + // + // For completeness, a counterexample with limit < 0: + // Assume i = -3 and limit = -2: + // i < 0 + // -2 < 0 + // is true and thus also "i < 0 || i >= limit". But + // i >=u limit + // -3 >=u -2 + // is false. + Node* limit = cmpu->in(2); + const TypeInt* type_limit = _igvn.type(limit)->is_int(); + if (type_limit->_lo < 0) { + return nullptr; + } + + // We prove below that we can extract a single signed loop exit condition from (SLE-full), depending on the stride: + // stride < 0: + // i < 0 (SLE = SLE-negative) + // stride > 0: + // i >= limit (SLE = SLE-positive) + // such that we have the following graph before Partial Peeling with stride > 0 (similar for stride < 0): + // + // Loop: + // + // i >= limit (SLE-positive) + // <-- CUT HERE --> + // i >=u limit (ULE) + // + // goto Loop + // + // We exit the loop if: + // (SLE) is true OR (ULE) is true + // However, if (SLE) is true then (ULE) also needs to be true to ensure the exact same behavior. Otherwise, we wrongly + // exit a loop that should not have been exited if we did not apply Partial Peeling. More formally, we need to ensure: + // (SLE) IMPLIES (ULE) + // This indeed holds when (COND) is given: + // - stride > 0: + // i >= limit // (SLE = SLE-positive) + // i >= limit >= 0 // (COND) + // i >=u limit >= 0 // (LEMMA) + // which is the unsigned loop exit condition (ULE). + // - stride < 0: + // i < 0 // (SLE = SLE-negative) + // (uint) i >u MAX_INT // (NEG) all negative values are greater than MAX_INT when converted to unsigned + // MAX_INT >= limit >= 0 // (COND) + // MAX_INT >=u limit >= 0 // (LEMMA) + // and thus from (NEG) and (LEMMA): + // i >=u limit + // which is the unsigned loop exit condition (ULE). + // + // + // After Partial Peeling, we have the following structure for stride > 0 (similar for stride < 0): + // + // i >= limit (SLE-positive) + // Loop: + // i >=u limit (ULE) + // + // + // i >= limit (SLE-positive) + // goto Loop + Node* rhs_cmpi; if (stride > 0) { - limit = cmpu->in(2); + rhs_cmpi = limit; // For i >= limit } else { - limit = _igvn.makecon(TypeInt::ZERO); - set_ctrl(limit, C->root()); + rhs_cmpi = _igvn.makecon(TypeInt::ZERO); // For i < 0 + set_ctrl(rhs_cmpi, C->root()); } // Create a new region on the exit path RegionNode* reg = insert_region_before_proj(lp_exit); @@ -3059,7 +3187,7 @@ IfNode* PhaseIdealLoop::insert_cmpi_loop_exit(IfNode* if_cmpu, IdealLoopTree *lo // Clone the if-cmpu-true-false using a signed compare BoolTest::mask rel_i = stride > 0 ? bol->_test._test : BoolTest::ge; - ProjNode* cmpi_exit = insert_if_before_proj(cmpu->in(1), Signed, rel_i, limit, lp_continue); + ProjNode* cmpi_exit = insert_if_before_proj(cmpu->in(1), Signed, rel_i, rhs_cmpi, lp_continue); reg->add_req(cmpi_exit); // Clone the if-cmpu-true-false @@ -4310,11 +4438,19 @@ PhaseIdealLoop::auto_vectorize(IdealLoopTree* lpt, VSharedData &vshared) { return AutoVectorizeStatus::Success; } +// Returns true if the Reduction node is unordered. +static bool is_unordered_reduction(Node* n) { + return n->is_Reduction() && !n->as_Reduction()->requires_strict_order(); +} + // Having ReductionNodes in the loop is expensive. They need to recursively // fold together the vector values, for every vectorized loop iteration. If // we encounter the following pattern, we can vector accumulate the values // inside the loop, and only have a single UnorderedReduction after the loop. // +// Note: UnorderedReduction represents a ReductionNode which does not require +// calculating in strict order. +// // CountedLoop init // | | // +------+ | +-----------------------+ @@ -4354,21 +4490,24 @@ PhaseIdealLoop::auto_vectorize(IdealLoopTree* lpt, VSharedData &vshared) { // wise. This is a single operation per vector_accumulator, rather than many // for a UnorderedReduction. We can then reduce the last vector_accumulator // after the loop, and also reduce the init value into it. +// // We can not do this with all reductions. Some reductions do not allow the -// reordering of operations (for example float addition). +// reordering of operations (for example float addition/multiplication require +// strict order). void PhaseIdealLoop::move_unordered_reduction_out_of_loop(IdealLoopTree* loop) { assert(!C->major_progress() && loop->is_counted() && loop->is_innermost(), "sanity"); - // Find all Phi nodes with UnorderedReduction on backedge. + // Find all Phi nodes with an unordered Reduction on backedge. CountedLoopNode* cl = loop->_head->as_CountedLoop(); for (DUIterator_Fast jmax, j = cl->fast_outs(jmax); j < jmax; j++) { Node* phi = cl->fast_out(j); - // We have a phi with a single use, and a UnorderedReduction on the backedge. - if (!phi->is_Phi() || phi->outcnt() != 1 || !phi->in(2)->is_UnorderedReduction()) { + // We have a phi with a single use, and an unordered Reduction on the backedge. + if (!phi->is_Phi() || phi->outcnt() != 1 || !is_unordered_reduction(phi->in(2))) { continue; } - UnorderedReductionNode* last_ur = phi->in(2)->as_UnorderedReduction(); + ReductionNode* last_ur = phi->in(2)->as_Reduction(); + assert(!last_ur->requires_strict_order(), "must be"); // Determine types const TypeVect* vec_t = last_ur->vect_type(); @@ -4385,14 +4524,14 @@ void PhaseIdealLoop::move_unordered_reduction_out_of_loop(IdealLoopTree* loop) { continue; // not implemented -> fails } - // Traverse up the chain of UnorderedReductions, checking that it loops back to - // the phi. Check that all UnorderedReductions only have a single use, except for + // Traverse up the chain of unordered Reductions, checking that it loops back to + // the phi. Check that all unordered Reductions only have a single use, except for // the last (last_ur), which only has phi as a use in the loop, and all other uses // are outside the loop. - UnorderedReductionNode* current = last_ur; - UnorderedReductionNode* first_ur = nullptr; + ReductionNode* current = last_ur; + ReductionNode* first_ur = nullptr; while (true) { - assert(current->is_UnorderedReduction(), "sanity"); + assert(!current->requires_strict_order(), "sanity"); // Expect no ctrl and a vector_input from within the loop. Node* ctrl = current->in(0); @@ -4409,7 +4548,7 @@ void PhaseIdealLoop::move_unordered_reduction_out_of_loop(IdealLoopTree* loop) { break; // Chain traversal fails. } - // Expect single use of UnorderedReduction, except for last_ur. + // Expect single use of an unordered Reduction, except for last_ur. if (current == last_ur) { // Expect all uses to be outside the loop, except phi. for (DUIterator_Fast kmax, k = current->fast_outs(kmax); k < kmax; k++) { @@ -4427,12 +4566,13 @@ void PhaseIdealLoop::move_unordered_reduction_out_of_loop(IdealLoopTree* loop) { } } - // Expect another UnorderedReduction or phi as the scalar input. + // Expect another unordered Reduction or phi as the scalar input. Node* scalar_input = current->in(1); - if (scalar_input->is_UnorderedReduction() && + if (is_unordered_reduction(scalar_input) && scalar_input->Opcode() == current->Opcode()) { - // Move up the UnorderedReduction chain. - current = scalar_input->as_UnorderedReduction(); + // Move up the unordered Reduction chain. + current = scalar_input->as_Reduction(); + assert(!current->requires_strict_order(), "must be"); } else if (scalar_input == phi) { // Chain terminates at phi. first_ur = current; @@ -4456,7 +4596,7 @@ void PhaseIdealLoop::move_unordered_reduction_out_of_loop(IdealLoopTree* loop) { VectorNode* identity_vector = VectorNode::scalar2vector(identity_scalar, vector_length, bt_t); register_new_node(identity_vector, C->root()); assert(vec_t == identity_vector->vect_type(), "matching vector type"); - VectorNode::trace_new_vector(identity_vector, "UnorderedReduction"); + VectorNode::trace_new_vector(identity_vector, "Unordered Reduction"); // Turn the scalar phi into a vector phi. _igvn.rehash_node_delayed(phi); @@ -4465,7 +4605,7 @@ void PhaseIdealLoop::move_unordered_reduction_out_of_loop(IdealLoopTree* loop) { phi->as_Type()->set_type(vec_t); _igvn.set_type(phi, vec_t); - // Traverse down the chain of UnorderedReductions, and replace them with vector_accumulators. + // Traverse down the chain of unordered Reductions, and replace them with vector_accumulators. current = first_ur; while (true) { // Create vector_accumulator to replace current. @@ -4474,11 +4614,12 @@ void PhaseIdealLoop::move_unordered_reduction_out_of_loop(IdealLoopTree* loop) { VectorNode* vector_accumulator = VectorNode::make(vopc, last_vector_accumulator, vector_input, vec_t); register_new_node(vector_accumulator, cl); _igvn.replace_node(current, vector_accumulator); - VectorNode::trace_new_vector(vector_accumulator, "UnorderedReduction"); + VectorNode::trace_new_vector(vector_accumulator, "Unordered Reduction"); if (current == last_ur) { break; } - current = vector_accumulator->unique_out()->as_UnorderedReduction(); + current = vector_accumulator->unique_out()->as_Reduction(); + assert(!current->requires_strict_order(), "must be"); } // Create post-loop reduction. @@ -4495,7 +4636,7 @@ void PhaseIdealLoop::move_unordered_reduction_out_of_loop(IdealLoopTree* loop) { } } register_new_node(post_loop_reduction, get_late_ctrl(post_loop_reduction, cl)); - VectorNode::trace_new_vector(post_loop_reduction, "UnorderedReduction"); + VectorNode::trace_new_vector(post_loop_reduction, "Unordered Reduction"); assert(last_accumulator->outcnt() == 2, "last_accumulator has 2 uses: phi and post_loop_reduction"); assert(post_loop_reduction->outcnt() > 0, "should have taken over all non loop uses of last_accumulator"); diff --git a/src/hotspot/share/opto/machnode.hpp b/src/hotspot/share/opto/machnode.hpp index 677e1bcd1d1a5..6dbaa8a13969a 100644 --- a/src/hotspot/share/opto/machnode.hpp +++ b/src/hotspot/share/opto/machnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,7 +54,6 @@ class MachSpillCopyNode; class Matcher; class PhaseRegAlloc; class RegMask; -class RTMLockingCounters; class State; //---------------------------MachOper------------------------------------------ @@ -802,8 +801,6 @@ class MachGotoNode : public MachBranchNode { class MachFastLockNode : public MachNode { virtual uint size_of() const { return sizeof(*this); } // Size is bigger public: - RTMLockingCounters* _rtm_counters; // RTM lock counters for inflated locks - RTMLockingCounters* _stack_rtm_counters; // RTM lock counters for stack locks MachFastLockNode() : MachNode() {} }; diff --git a/src/hotspot/share/opto/macro.cpp b/src/hotspot/share/opto/macro.cpp index ce1a8a6113471..21dfacf9fe1ce 100644 --- a/src/hotspot/share/opto/macro.cpp +++ b/src/hotspot/share/opto/macro.cpp @@ -2428,7 +2428,6 @@ void PhaseMacroExpand::eliminate_macro_nodes() { break; default: assert(n->Opcode() == Op_LoopLimit || - n->Opcode() == Op_Opaque3 || n->is_Opaque4() || n->is_OpaqueInitializedAssertionPredicate() || n->Opcode() == Op_MaxL || @@ -2481,30 +2480,6 @@ bool PhaseMacroExpand::expand_macro_nodes() { } else if (n->is_Opaque1()) { _igvn.replace_node(n, n->in(1)); success = true; -#if INCLUDE_RTM_OPT - } else if ((n->Opcode() == Op_Opaque3) && ((Opaque3Node*)n)->rtm_opt()) { - assert(C->profile_rtm(), "should be used only in rtm deoptimization code"); - assert((n->outcnt() == 1) && n->unique_out()->is_Cmp(), ""); - Node* cmp = n->unique_out(); -#ifdef ASSERT - // Validate graph. - assert((cmp->outcnt() == 1) && cmp->unique_out()->is_Bool(), ""); - BoolNode* bol = cmp->unique_out()->as_Bool(); - assert((bol->outcnt() == 1) && bol->unique_out()->is_If() && - (bol->_test._test == BoolTest::ne), ""); - IfNode* ifn = bol->unique_out()->as_If(); - assert((ifn->outcnt() == 2) && - ifn->proj_out(1)->is_uncommon_trap_proj(Deoptimization::Reason_rtm_state_change) != nullptr, ""); -#endif - Node* repl = n->in(1); - if (!_has_locks) { - // Remove RTM state check if there are no locks in the code. - // Replace input to compare the same value. - repl = (cmp->in(1) == n) ? cmp->in(2) : cmp->in(1); - } - _igvn.replace_node(n, repl); - success = true; -#endif } else if (n->is_Opaque4()) { // With Opaque4 nodes, the expectation is that the test of input 1 // is always equal to the constant value of input 2. So we can diff --git a/src/hotspot/share/opto/node.hpp b/src/hotspot/share/opto/node.hpp index dc9dc6654b558..ae379c4833a56 100644 --- a/src/hotspot/share/opto/node.hpp +++ b/src/hotspot/share/opto/node.hpp @@ -175,7 +175,6 @@ class SubTypeCheckNode; class Type; class TypeNode; class UnlockNode; -class UnorderedReductionNode; class VectorNode; class LoadVectorNode; class LoadVectorMaskedNode; @@ -739,7 +738,6 @@ class Node { DEFINE_CLASS_ID(ExpandV, Vector, 5) DEFINE_CLASS_ID(CompressM, Vector, 6) DEFINE_CLASS_ID(Reduction, Vector, 7) - DEFINE_CLASS_ID(UnorderedReduction, Reduction, 0) DEFINE_CLASS_ID(NegV, Vector, 8) DEFINE_CLASS_ID(Con, Type, 8) DEFINE_CLASS_ID(ConI, Con, 0) @@ -991,7 +989,6 @@ class Node { DEFINE_CLASS_QUERY(Sub) DEFINE_CLASS_QUERY(SubTypeCheck) DEFINE_CLASS_QUERY(Type) - DEFINE_CLASS_QUERY(UnorderedReduction) DEFINE_CLASS_QUERY(Vector) DEFINE_CLASS_QUERY(VectorMaskCmp) DEFINE_CLASS_QUERY(VectorUnbox) diff --git a/src/hotspot/share/opto/opaquenode.cpp b/src/hotspot/share/opto/opaquenode.cpp index 0abc6f86ed022..14fd0d5f1a7a9 100644 --- a/src/hotspot/share/opto/opaquenode.cpp +++ b/src/hotspot/share/opto/opaquenode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,16 +45,6 @@ Node* Opaque1Node::Identity(PhaseGVN* phase) { return this; } -// Do NOT remove the opaque node until no more loop opts can happen. -Node* Opaque3Node::Identity(PhaseGVN* phase) { - if (phase->C->post_loop_opts_phase()) { - return in(1); - } else { - phase->C->record_for_post_loop_opts_igvn(this); - } - return this; -} - #ifdef ASSERT CountedLoopNode* OpaqueZeroTripGuardNode::guarded_loop() const { Node* iff = if_node(); @@ -92,12 +82,6 @@ IfNode* OpaqueZeroTripGuardNode::if_node() const { return iff->as_If(); } -// Do not allow value-numbering -uint Opaque3Node::hash() const { return NO_HASH; } -bool Opaque3Node::cmp(const Node &n) const { - return (&n == this); // Always fail except on self -} - const Type* Opaque4Node::Value(PhaseGVN* phase) const { return phase->type(in(1)); } diff --git a/src/hotspot/share/opto/opaquenode.hpp b/src/hotspot/share/opto/opaquenode.hpp index 2337989e974f7..4617979c2e494 100644 --- a/src/hotspot/share/opto/opaquenode.hpp +++ b/src/hotspot/share/opto/opaquenode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -91,26 +91,6 @@ class OpaqueZeroTripGuardNode : public Opaque1Node { IfNode* if_node() const; }; -//------------------------------Opaque3Node------------------------------------ -// A node to prevent unwanted optimizations. Will be optimized only during -// macro nodes expansion. -class Opaque3Node : public Node { - int _opt; // what optimization it was used for - virtual uint hash() const; - virtual bool cmp(const Node &n) const; - public: - enum { RTM_OPT }; - Opaque3Node(Compile* C, Node* n, int opt) : Node(0, n), _opt(opt) { - // Put it on the Macro nodes list to removed during macro nodes expansion. - init_flags(Flag_is_macro); - C->add_macro_node(this); - } - virtual int Opcode() const; - virtual const Type* bottom_type() const { return TypeInt::INT; } - virtual Node* Identity(PhaseGVN* phase); - bool rtm_opt() const { return (_opt == RTM_OPT); } -}; - // Input 1 is a check that we know implicitly is always true or false // but the compiler has no way to prove. If during optimizations, that // check becomes true or false, the Opaque4 node is replaced by that diff --git a/src/hotspot/share/opto/output.cpp b/src/hotspot/share/opto/output.cpp index 0ad56184d4d12..8ea456d3417da 100644 --- a/src/hotspot/share/opto/output.cpp +++ b/src/hotspot/share/opto/output.cpp @@ -1321,7 +1321,7 @@ CodeBuffer* PhaseOutput::init_buffer() { int code_req = _buf_sizes._code; int const_req = _buf_sizes._const; - int pad_req = NativeCall::instruction_size; + int pad_req = NativeCall::byte_size(); BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); stub_req += bs->estimate_stub_size(); @@ -3388,8 +3388,7 @@ void PhaseOutput::install() { C->entry_bci(), CompileBroker::compiler2(), C->has_unsafe_access(), - SharedRuntime::is_wide_vector(C->max_vector_size()), - C->rtm_state()); + SharedRuntime::is_wide_vector(C->max_vector_size())); } } @@ -3397,8 +3396,7 @@ void PhaseOutput::install_code(ciMethod* target, int entry_bci, AbstractCompiler* compiler, bool has_unsafe_access, - bool has_wide_vectors, - RTMState rtm_state) { + bool has_wide_vectors) { // Check if we want to skip execution of all compiled code. { #ifndef PRODUCT @@ -3436,8 +3434,7 @@ void PhaseOutput::install_code(ciMethod* target, has_unsafe_access, SharedRuntime::is_wide_vector(C->max_vector_size()), C->has_monitors(), - 0, - C->rtm_state()); + 0); if (C->log() != nullptr) { // Print code cache state into compiler log C->log()->code_cache_state(); diff --git a/src/hotspot/share/opto/output.hpp b/src/hotspot/share/opto/output.hpp index 1717955360256..9431ef3d5089f 100644 --- a/src/hotspot/share/opto/output.hpp +++ b/src/hotspot/share/opto/output.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -121,8 +121,7 @@ class PhaseOutput : public Phase { int entry_bci, AbstractCompiler* compiler, bool has_unsafe_access, - bool has_wide_vectors, - RTMState rtm_state); + bool has_wide_vectors); void install_stub(const char* stub_name); diff --git a/src/hotspot/share/opto/parse.hpp b/src/hotspot/share/opto/parse.hpp index d5f12c8bc8134..a55c9cb0cb12e 100644 --- a/src/hotspot/share/opto/parse.hpp +++ b/src/hotspot/share/opto/parse.hpp @@ -501,8 +501,6 @@ class Parse : public GraphKit { void clinit_deopt(); - void rtm_deopt(); - // Pass current map to exits void return_current(Node* value); diff --git a/src/hotspot/share/opto/parse1.cpp b/src/hotspot/share/opto/parse1.cpp index 80cb6721fceaa..4dc3ac3704231 100644 --- a/src/hotspot/share/opto/parse1.cpp +++ b/src/hotspot/share/opto/parse1.cpp @@ -597,12 +597,9 @@ Parse::Parse(JVMState* caller, ciMethod* parse_method, float expected_uses) // Add check to deoptimize the nmethod once the holder class is fully initialized clinit_deopt(); } - - // Add check to deoptimize the nmethod if RTM state was changed - rtm_deopt(); } - // Check for bailouts during method entry or RTM state check setup. + // Check for bailouts during method entry. if (failing()) { if (log) log->done("parse"); C->set_default_node_notes(caller_nn); @@ -2201,42 +2198,6 @@ void Parse::clinit_deopt() { guard_klass_being_initialized(holder); } -// Add check to deoptimize if RTM state is not ProfileRTM -void Parse::rtm_deopt() { -#if INCLUDE_RTM_OPT - if (C->profile_rtm()) { - assert(C->has_method(), "only for normal compilations"); - assert(!C->method()->method_data()->is_empty(), "MDO is needed to record RTM state"); - assert(depth() == 1, "generate check only for main compiled method"); - - // Set starting bci for uncommon trap. - set_parse_bci(is_osr_parse() ? osr_bci() : 0); - - // Load the rtm_state from the MethodData. - const TypePtr* adr_type = TypeMetadataPtr::make(C->method()->method_data()); - Node* mdo = makecon(adr_type); - int offset = in_bytes(MethodData::rtm_state_offset()); - Node* adr_node = basic_plus_adr(mdo, mdo, offset); - Node* rtm_state = make_load(control(), adr_node, TypeInt::INT, T_INT, adr_type, MemNode::unordered); - - // Separate Load from Cmp by Opaque. - // In expand_macro_nodes() it will be replaced either - // with this load when there are locks in the code - // or with ProfileRTM (cmp->in(2)) otherwise so that - // the check will fold. - Node* profile_state = makecon(TypeInt::make(ProfileRTM)); - Node* opq = _gvn.transform( new Opaque3Node(C, rtm_state, Opaque3Node::RTM_OPT) ); - Node* chk = _gvn.transform( new CmpINode(opq, profile_state) ); - Node* tst = _gvn.transform( new BoolNode(chk, BoolTest::eq) ); - // Branch to failure if state was changed - { BuildCutout unless(this, tst, PROB_ALWAYS); - uncommon_trap(Deoptimization::Reason_rtm_state_change, - Deoptimization::Action_make_not_entrant); - } - } -#endif -} - //------------------------------return_current--------------------------------- // Append current _map to _exit_return void Parse::return_current(Node* value) { diff --git a/src/hotspot/share/opto/runtime.cpp b/src/hotspot/share/opto/runtime.cpp index a6f9a7e54703d..2953a1f7b726a 100644 --- a/src/hotspot/share/opto/runtime.cpp +++ b/src/hotspot/share/opto/runtime.cpp @@ -1856,14 +1856,6 @@ void OptoRuntime::print_named_counters() { eliminated_lock_count += count; } } -#if INCLUDE_RTM_OPT - } else if (c->tag() == NamedCounter::RTMLockingCounter) { - RTMLockingCounters* rlc = ((RTMLockingNamedCounter*)c)->counters(); - if (rlc->nonzero()) { - tty->print_cr("%s", c->name()); - rlc->print_on(tty); - } -#endif } c = c->next(); } @@ -1905,12 +1897,7 @@ NamedCounter* OptoRuntime::new_named_counter(JVMState* youngest_jvms, NamedCount st.print("@%d", bci); // To print linenumbers instead of bci use: m->line_number_from_bci(bci) } - NamedCounter* c; - if (tag == NamedCounter::RTMLockingCounter) { - c = new RTMLockingNamedCounter(st.freeze()); - } else { - c = new NamedCounter(st.freeze(), tag); - } + NamedCounter* c = new NamedCounter(st.freeze(), tag); // atomically add the new counter to the head of the list. We only // add counters so this is safe. diff --git a/src/hotspot/share/opto/runtime.hpp b/src/hotspot/share/opto/runtime.hpp index 9ca8ac0494339..6aadab9712243 100644 --- a/src/hotspot/share/opto/runtime.hpp +++ b/src/hotspot/share/opto/runtime.hpp @@ -29,7 +29,6 @@ #include "opto/machnode.hpp" #include "opto/optoreg.hpp" #include "opto/type.hpp" -#include "runtime/rtmLocking.hpp" #include "runtime/deoptimization.hpp" #include "runtime/vframe.hpp" @@ -61,8 +60,7 @@ class NamedCounter : public CHeapObj { enum CounterTag { NoTag, LockCounter, - EliminatedLockCounter, - RTMLockingCounter + EliminatedLockCounter }; private: @@ -98,17 +96,6 @@ class NamedCounter : public CHeapObj { }; -class RTMLockingNamedCounter : public NamedCounter { - private: - RTMLockingCounters _counters; - - public: - RTMLockingNamedCounter(const char *n) : - NamedCounter(n, RTMLockingCounter), _counters() {} - - RTMLockingCounters* counters() { return &_counters; } -}; - typedef const TypeFunc*(*TypeFunc_generator)(); class OptoRuntime : public AllStatic { diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp index 3ef6ae02534b9..b31f6ace5a6e2 100644 --- a/src/hotspot/share/opto/vectorIntrinsics.cpp +++ b/src/hotspot/share/opto/vectorIntrinsics.cpp @@ -1616,21 +1616,23 @@ bool LibraryCallKit::inline_vector_reduction() { } Node* init = ReductionNode::make_identity_con_scalar(gvn(), opc, elem_bt); - Node* value = nullptr; - if (mask == nullptr) { - assert(!is_masked_op, "Masked op needs the mask value never null"); - value = ReductionNode::make(opc, nullptr, init, opd, elem_bt); - } else { - if (use_predicate) { - value = ReductionNode::make(opc, nullptr, init, opd, elem_bt); - value->add_req(mask); - value->add_flag(Node::Flag_is_predicated_vector); - } else { - Node* reduce_identity = gvn().transform(VectorNode::scalar2vector(init, num_elem, Type::get_const_basic_type(elem_bt))); - value = gvn().transform(new VectorBlendNode(reduce_identity, opd, mask)); - value = ReductionNode::make(opc, nullptr, init, value, elem_bt); - } + Node* value = opd; + + assert(mask != nullptr || !is_masked_op, "Masked op needs the mask value never null"); + if (mask != nullptr && !use_predicate) { + Node* reduce_identity = gvn().transform(VectorNode::scalar2vector(init, num_elem, Type::get_const_basic_type(elem_bt))); + value = gvn().transform(new VectorBlendNode(reduce_identity, value, mask)); } + + // Make an unordered Reduction node. This affects only AddReductionVF/VD and MulReductionVF/VD, + // as these operations are allowed to be associative (not requiring strict order) in VectorAPI. + value = ReductionNode::make(opc, nullptr, init, value, elem_bt, /* requires_strict_order */ false); + + if (mask != nullptr && use_predicate) { + value->add_req(mask); + value->add_flag(Node::Flag_is_predicated_vector); + } + value = gvn().transform(value); Node* bits = nullptr; diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index b14a7f7b16512..d560f112039a3 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -1296,7 +1296,8 @@ int ReductionNode::opcode(int opc, BasicType bt) { } // Return the appropriate reduction node. -ReductionNode* ReductionNode::make(int opc, Node *ctrl, Node* n1, Node* n2, BasicType bt) { +ReductionNode* ReductionNode::make(int opc, Node* ctrl, Node* n1, Node* n2, BasicType bt, + bool requires_strict_order) { int vopc = opcode(opc, bt); @@ -1306,17 +1307,17 @@ ReductionNode* ReductionNode::make(int opc, Node *ctrl, Node* n1, Node* n2, Basi switch (vopc) { case Op_AddReductionVI: return new AddReductionVINode(ctrl, n1, n2); case Op_AddReductionVL: return new AddReductionVLNode(ctrl, n1, n2); - case Op_AddReductionVF: return new AddReductionVFNode(ctrl, n1, n2); - case Op_AddReductionVD: return new AddReductionVDNode(ctrl, n1, n2); + case Op_AddReductionVF: return new AddReductionVFNode(ctrl, n1, n2, requires_strict_order); + case Op_AddReductionVD: return new AddReductionVDNode(ctrl, n1, n2, requires_strict_order); case Op_MulReductionVI: return new MulReductionVINode(ctrl, n1, n2); case Op_MulReductionVL: return new MulReductionVLNode(ctrl, n1, n2); - case Op_MulReductionVF: return new MulReductionVFNode(ctrl, n1, n2); - case Op_MulReductionVD: return new MulReductionVDNode(ctrl, n1, n2); - case Op_MinReductionV: return new MinReductionVNode(ctrl, n1, n2); - case Op_MaxReductionV: return new MaxReductionVNode(ctrl, n1, n2); - case Op_AndReductionV: return new AndReductionVNode(ctrl, n1, n2); - case Op_OrReductionV: return new OrReductionVNode(ctrl, n1, n2); - case Op_XorReductionV: return new XorReductionVNode(ctrl, n1, n2); + case Op_MulReductionVF: return new MulReductionVFNode(ctrl, n1, n2, requires_strict_order); + case Op_MulReductionVD: return new MulReductionVDNode(ctrl, n1, n2, requires_strict_order); + case Op_MinReductionV: return new MinReductionVNode (ctrl, n1, n2); + case Op_MaxReductionV: return new MaxReductionVNode (ctrl, n1, n2); + case Op_AndReductionV: return new AndReductionVNode (ctrl, n1, n2); + case Op_OrReductionV: return new OrReductionVNode (ctrl, n1, n2); + case Op_XorReductionV: return new XorReductionVNode (ctrl, n1, n2); default: assert(false, "unknown node: %s", NodeClassNames[vopc]); return nullptr; diff --git a/src/hotspot/share/opto/vectornode.hpp b/src/hotspot/share/opto/vectornode.hpp index 17c7482d88ce1..6c5402eb511f5 100644 --- a/src/hotspot/share/opto/vectornode.hpp +++ b/src/hotspot/share/opto/vectornode.hpp @@ -203,7 +203,9 @@ class ReductionNode : public Node { init_class_id(Class_Reduction); } - static ReductionNode* make(int opc, Node* ctrl, Node* in1, Node* in2, BasicType bt); + static ReductionNode* make(int opc, Node* ctrl, Node* in1, Node* in2, BasicType bt, + // This only effects floating-point add and mul reductions. + bool requires_strict_order = true); static int opcode(int opc, BasicType bt); static bool implemented(int opc, uint vlen, BasicType bt); // Make an identity scalar (zero for add, one for mul, etc) for scalar opc. @@ -225,47 +227,97 @@ class ReductionNode : public Node { // Needed for proper cloning. virtual uint size_of() const { return sizeof(*this); } -}; -//---------------------------UnorderedReductionNode------------------------------------- -// Order of reduction does not matter. Example int add. Not true for float add. -class UnorderedReductionNode : public ReductionNode { -public: - UnorderedReductionNode(Node * ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) { - init_class_id(Class_UnorderedReduction); + // Floating-point addition and multiplication are non-associative, so + // AddReductionVF/D and MulReductionVF/D require strict ordering + // in auto-vectorization. Vector API can generate AddReductionVF/D + // and MulReductionVF/VD without strict ordering, which can benefit + // some platforms. + // + // Other reductions don't need strict ordering. + virtual bool requires_strict_order() const { + return false; + } + +#ifndef PRODUCT + void dump_spec(outputStream* st) const { + if (requires_strict_order()) { + st->print("requires_strict_order"); + } else { + st->print("no_strict_order"); + } } +#endif }; //------------------------------AddReductionVINode-------------------------------------- // Vector add byte, short and int as a reduction -class AddReductionVINode : public UnorderedReductionNode { +class AddReductionVINode : public ReductionNode { public: - AddReductionVINode(Node * ctrl, Node* in1, Node* in2) : UnorderedReductionNode(ctrl, in1, in2) {} + AddReductionVINode(Node* ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} virtual int Opcode() const; }; //------------------------------AddReductionVLNode-------------------------------------- // Vector add long as a reduction -class AddReductionVLNode : public UnorderedReductionNode { +class AddReductionVLNode : public ReductionNode { public: - AddReductionVLNode(Node *ctrl, Node* in1, Node* in2) : UnorderedReductionNode(ctrl, in1, in2) {} + AddReductionVLNode(Node* ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} virtual int Opcode() const; }; //------------------------------AddReductionVFNode-------------------------------------- // Vector add float as a reduction class AddReductionVFNode : public ReductionNode { +private: + // True if add reduction operation for floats requires strict ordering. + // As an example - The value is true when add reduction for floats is auto-vectorized + // as auto-vectorization mandates strict ordering but the value is false when this node + // is generated through VectorAPI as VectorAPI does not impose any such rules on ordering. + const bool _requires_strict_order; public: - AddReductionVFNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} + //_requires_strict_order is set to true by default as mandated by auto-vectorization + AddReductionVFNode(Node* ctrl, Node* in1, Node* in2, bool requires_strict_order = true) : + ReductionNode(ctrl, in1, in2), _requires_strict_order(requires_strict_order) {} + virtual int Opcode() const; + + virtual bool requires_strict_order() const { return _requires_strict_order; } + + virtual uint hash() const { return Node::hash() + _requires_strict_order; } + + virtual bool cmp(const Node& n) const { + return Node::cmp(n) && _requires_strict_order == ((ReductionNode&)n).requires_strict_order(); + } + + virtual uint size_of() const { return sizeof(*this); } }; //------------------------------AddReductionVDNode-------------------------------------- // Vector add double as a reduction class AddReductionVDNode : public ReductionNode { +private: + // True if add reduction operation for doubles requires strict ordering. + // As an example - The value is true when add reduction for doubles is auto-vectorized + // as auto-vectorization mandates strict ordering but the value is false when this node + // is generated through VectorAPI as VectorAPI does not impose any such rules on ordering. + const bool _requires_strict_order; public: - AddReductionVDNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} + //_requires_strict_order is set to true by default as mandated by auto-vectorization + AddReductionVDNode(Node* ctrl, Node* in1, Node* in2, bool requires_strict_order = true) : + ReductionNode(ctrl, in1, in2), _requires_strict_order(requires_strict_order) {} + virtual int Opcode() const; + + virtual bool requires_strict_order() const { return _requires_strict_order; } + + virtual uint hash() const { return Node::hash() + _requires_strict_order; } + + virtual bool cmp(const Node& n) const { + return Node::cmp(n) && _requires_strict_order == ((ReductionNode&)n).requires_strict_order(); + } + + virtual uint size_of() const { return sizeof(*this); } }; //------------------------------SubVBNode-------------------------------------- @@ -400,34 +452,70 @@ class FmaVFNode : public FmaVNode { //------------------------------MulReductionVINode-------------------------------------- // Vector multiply byte, short and int as a reduction -class MulReductionVINode : public UnorderedReductionNode { +class MulReductionVINode : public ReductionNode { public: - MulReductionVINode(Node *ctrl, Node* in1, Node* in2) : UnorderedReductionNode(ctrl, in1, in2) {} + MulReductionVINode(Node* ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} virtual int Opcode() const; }; //------------------------------MulReductionVLNode-------------------------------------- // Vector multiply int as a reduction -class MulReductionVLNode : public UnorderedReductionNode { +class MulReductionVLNode : public ReductionNode { public: - MulReductionVLNode(Node *ctrl, Node* in1, Node* in2) : UnorderedReductionNode(ctrl, in1, in2) {} + MulReductionVLNode(Node* ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} virtual int Opcode() const; }; //------------------------------MulReductionVFNode-------------------------------------- // Vector multiply float as a reduction class MulReductionVFNode : public ReductionNode { + // True if mul reduction operation for floats requires strict ordering. + // As an example - The value is true when mul reduction for floats is auto-vectorized + // as auto-vectorization mandates strict ordering but the value is false when this node + // is generated through VectorAPI as VectorAPI does not impose any such rules on ordering. + const bool _requires_strict_order; public: - MulReductionVFNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} + //_requires_strict_order is set to true by default as mandated by auto-vectorization + MulReductionVFNode(Node* ctrl, Node* in1, Node* in2, bool requires_strict_order = true) : + ReductionNode(ctrl, in1, in2), _requires_strict_order(requires_strict_order) {} + virtual int Opcode() const; + + virtual bool requires_strict_order() const { return _requires_strict_order; } + + virtual uint hash() const { return Node::hash() + _requires_strict_order; } + + virtual bool cmp(const Node& n) const { + return Node::cmp(n) && _requires_strict_order == ((ReductionNode&)n).requires_strict_order(); + } + + virtual uint size_of() const { return sizeof(*this); } }; //------------------------------MulReductionVDNode-------------------------------------- // Vector multiply double as a reduction class MulReductionVDNode : public ReductionNode { + // True if mul reduction operation for doubles requires strict ordering. + // As an example - The value is true when mul reduction for doubles is auto-vectorized + // as auto-vectorization mandates strict ordering but the value is false when this node + // is generated through VectorAPI as VectorAPI does not impose any such rules on ordering. + const bool _requires_strict_order; public: - MulReductionVDNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} + //_requires_strict_order is set to true by default as mandated by auto-vectorization + MulReductionVDNode(Node* ctrl, Node* in1, Node* in2, bool requires_strict_order = true) : + ReductionNode(ctrl, in1, in2), _requires_strict_order(requires_strict_order) {} + virtual int Opcode() const; + + virtual bool requires_strict_order() const { return _requires_strict_order; } + + virtual uint hash() const { return Node::hash() + _requires_strict_order; } + + virtual bool cmp(const Node& n) const { + return Node::cmp(n) && _requires_strict_order == ((ReductionNode&)n).requires_strict_order(); + } + + virtual uint size_of() const { return sizeof(*this); } }; //------------------------------DivVFNode-------------------------------------- @@ -753,9 +841,9 @@ class AndVNode : public VectorNode { //------------------------------AndReductionVNode-------------------------------------- // Vector and byte, short, int, long as a reduction -class AndReductionVNode : public UnorderedReductionNode { +class AndReductionVNode : public ReductionNode { public: - AndReductionVNode(Node *ctrl, Node* in1, Node* in2) : UnorderedReductionNode(ctrl, in1, in2) {} + AndReductionVNode(Node* ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} virtual int Opcode() const; }; @@ -770,9 +858,9 @@ class OrVNode : public VectorNode { //------------------------------OrReductionVNode-------------------------------------- // Vector xor byte, short, int, long as a reduction -class OrReductionVNode : public UnorderedReductionNode { +class OrReductionVNode : public ReductionNode { public: - OrReductionVNode(Node *ctrl, Node* in1, Node* in2) : UnorderedReductionNode(ctrl, in1, in2) {} + OrReductionVNode(Node* ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} virtual int Opcode() const; }; @@ -787,25 +875,25 @@ class XorVNode : public VectorNode { //------------------------------XorReductionVNode-------------------------------------- // Vector and int, long as a reduction -class XorReductionVNode : public UnorderedReductionNode { +class XorReductionVNode : public ReductionNode { public: - XorReductionVNode(Node *ctrl, Node* in1, Node* in2) : UnorderedReductionNode(ctrl, in1, in2) {} + XorReductionVNode(Node* ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} virtual int Opcode() const; }; //------------------------------MinReductionVNode-------------------------------------- // Vector min byte, short, int, long, float, double as a reduction -class MinReductionVNode : public UnorderedReductionNode { +class MinReductionVNode : public ReductionNode { public: - MinReductionVNode(Node *ctrl, Node* in1, Node* in2) : UnorderedReductionNode(ctrl, in1, in2) {} + MinReductionVNode(Node* ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} virtual int Opcode() const; }; //------------------------------MaxReductionVNode-------------------------------------- // Vector min byte, short, int, long, float, double as a reduction -class MaxReductionVNode : public UnorderedReductionNode { +class MaxReductionVNode : public ReductionNode { public: - MaxReductionVNode(Node *ctrl, Node* in1, Node* in2) : UnorderedReductionNode(ctrl, in1, in2) {} + MaxReductionVNode(Node* ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} virtual int Opcode() const; }; diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 6c98f379db073..b80aa50534dca 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -507,11 +507,6 @@ static SpecialFlag const special_jvm_flags[] = { { "PreserveAllAnnotations", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) }, { "UseNotificationThread", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) }, { "UseEmptySlotsInSupers", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) }, -#if defined(X86) - { "UseRTMLocking", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) }, - { "UseRTMDeopt", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) }, - { "RTMRetryCount", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) }, -#endif // X86 // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in: { "CreateMinidumpOnCrash", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() }, @@ -545,6 +540,11 @@ static SpecialFlag const special_jvm_flags[] = { { "ParallelOldDeadWoodLimiterStdDev", JDK_Version::undefined(), JDK_Version::jdk(23), JDK_Version::jdk(24) }, { "UseNeon", JDK_Version::undefined(), JDK_Version::jdk(23), JDK_Version::jdk(24) }, { "ScavengeBeforeFullGC", JDK_Version::undefined(), JDK_Version::jdk(23), JDK_Version::jdk(24) }, +#if defined(X86) + { "UseRTMLocking", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) }, + { "UseRTMDeopt", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) }, + { "RTMRetryCount", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) }, +#endif // X86 #ifdef ASSERT { "DummyObsoleteTestFlag", JDK_Version::undefined(), JDK_Version::jdk(18), JDK_Version::undefined() }, #endif @@ -1847,14 +1847,6 @@ bool Arguments::check_vm_args_consistency() { "LockingMode == 0 (LM_MONITOR) is not fully implemented on this architecture\n"); return false; } -#endif -#if defined(X86) && !defined(ZERO) - if (LockingMode == LM_MONITOR && UseRTMForStackLocks) { - jio_fprintf(defaultStream::error_stream(), - "LockingMode == 0 (LM_MONITOR) and -XX:+UseRTMForStackLocks are mutually exclusive\n"); - - return false; - } #endif if (VerifyHeavyMonitors && LockingMode != LM_MONITOR) { jio_fprintf(defaultStream::error_stream(), diff --git a/src/hotspot/share/runtime/deoptimization.cpp b/src/hotspot/share/runtime/deoptimization.cpp index 1748768844563..cf82ad7c0277a 100644 --- a/src/hotspot/share/runtime/deoptimization.cpp +++ b/src/hotspot/share/runtime/deoptimization.cpp @@ -2076,8 +2076,7 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* current, jint tr gather_statistics(reason, action, trap_bc); // Ensure that we can record deopt. history: - // Need MDO to record RTM code generation state. - bool create_if_missing = ProfileTraps RTM_OPT_ONLY( || UseRTMLocking ); + bool create_if_missing = ProfileTraps; methodHandle profiled_method; #if INCLUDE_JVMCI @@ -2425,16 +2424,6 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* current, jint tr pdata->set_trap_state(tstate1); } -#if INCLUDE_RTM_OPT - // Restart collecting RTM locking abort statistic if the method - // is recompiled for a reason other than RTM state change. - // Assume that in new recompiled code the statistic could be different, - // for example, due to different inlining. - if ((reason != Reason_rtm_state_change) && (trap_mdo != nullptr) && - UseRTMDeopt && (nm->rtm_state() != ProfileRTM)) { - trap_mdo->atomic_set_rtm_state(ProfileRTM); - } -#endif // For code aging we count traps separately here, using make_not_entrant() // as a guard against simultaneous deopts in multiple threads. if (reason == Reason_tenured && trap_mdo != nullptr) { @@ -2724,7 +2713,6 @@ const char* Deoptimization::_trap_reason_name[] = { "speculate_class_check", "speculate_null_check", "speculate_null_assert", - "rtm_state_change", "unstable_if", "unstable_fused_if", "receiver_constraint", diff --git a/src/hotspot/share/runtime/deoptimization.hpp b/src/hotspot/share/runtime/deoptimization.hpp index 61e85d19fd7c5..0a2bafb383085 100644 --- a/src/hotspot/share/runtime/deoptimization.hpp +++ b/src/hotspot/share/runtime/deoptimization.hpp @@ -113,7 +113,6 @@ class Deoptimization : AllStatic { Reason_speculate_class_check, // saw unexpected object class from type speculation Reason_speculate_null_check, // saw unexpected null from type speculation Reason_speculate_null_assert, // saw unexpected null from type speculation - Reason_rtm_state_change, // rtm state change detected Reason_unstable_if, // a branch predicted always false was taken Reason_unstable_fused_if, // fused two ifs that had each one untaken branch. One is now taken. Reason_receiver_constraint, // receiver subtype check failed diff --git a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp index 2cd7371909d1e..ad2e755e69868 100644 --- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp +++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp @@ -378,20 +378,6 @@ JVMFlag::Error NodeLimitFudgeFactorConstraintFunc(intx value, bool verbose) { } #endif // COMPILER2 -JVMFlag::Error RTMTotalCountIncrRateConstraintFunc(int value, bool verbose) { -#if INCLUDE_RTM_OPT - if (UseRTMLocking && !is_power_of_2(RTMTotalCountIncrRate)) { - JVMFlag::printError(verbose, - "RTMTotalCountIncrRate (%d) must be " - "a power of 2, resetting it to 64\n", - RTMTotalCountIncrRate); - FLAG_SET_DEFAULT(RTMTotalCountIncrRate, 64); - } -#endif - - return JVMFlag::SUCCESS; -} - #ifdef COMPILER2 JVMFlag::Error LoopStripMiningIterConstraintFunc(uintx value, bool verbose) { if (UseCountedLoopSafepoints && LoopStripMiningIter == 0) { diff --git a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.hpp b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.hpp index 60adf4903a328..cfca8ecf8eef7 100644 --- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.hpp +++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.hpp @@ -49,7 +49,6 @@ f(uint, TypeProfileLevelConstraintFunc) \ f(uint, VerifyIterativeGVNConstraintFunc) \ f(intx, InitArrayShortSizeConstraintFunc) \ - f(int , RTMTotalCountIncrRateConstraintFunc) \ f(ccstrlist, DisableIntrinsicConstraintFunc) \ f(ccstrlist, ControlIntrinsicConstraintFunc) \ COMPILER2_PRESENT( \ diff --git a/src/hotspot/share/runtime/java.cpp b/src/hotspot/share/runtime/java.cpp index d78e35c4e6812..5271bdcda0be6 100644 --- a/src/hotspot/share/runtime/java.cpp +++ b/src/hotspot/share/runtime/java.cpp @@ -265,7 +265,7 @@ void print_statistics() { #endif //COMPILER1 } - if (PrintLockStatistics || PrintPreciseRTMLockingStatistics) { + if (PrintLockStatistics) { OptoRuntime::print_named_counters(); } #ifdef ASSERT diff --git a/src/hotspot/share/runtime/rtmLocking.cpp b/src/hotspot/share/runtime/rtmLocking.cpp deleted file mode 100644 index c375288242379..0000000000000 --- a/src/hotspot/share/runtime/rtmLocking.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#include "precompiled.hpp" -#include "compiler/compilerDefinitions.hpp" - -#if INCLUDE_RTM_OPT - -#include "memory/allocation.inline.hpp" -#include "runtime/task.hpp" -#include "runtime/rtmLocking.hpp" - - -// One-shot PeriodicTask subclass for enabling RTM locking -uintx RTMLockingCounters::_calculation_flag = 0; - -class RTMLockingCalculationTask : public PeriodicTask { - public: - RTMLockingCalculationTask(size_t interval_time) : PeriodicTask(interval_time){ } - - virtual void task() { - RTMLockingCounters::_calculation_flag = 1; - // Reclaim our storage and disenroll ourself - delete this; - } -}; - -void RTMLockingCounters::init() { - if (UseRTMLocking && RTMLockingCalculationDelay > 0) { - RTMLockingCalculationTask* task = new RTMLockingCalculationTask(RTMLockingCalculationDelay); - task->enroll(); - } else { - _calculation_flag = 1; - } -} - -const char* RTMLockingCounters::_abortX_desc[ABORT_STATUS_LIMIT] = { - "abort instruction ", - "may succeed on retry", - "thread conflict ", - "buffer overflow ", - "debug or trap hit ", - "maximum nested depth" -}; - -//------------------------------print_on------------------------------- -void RTMLockingCounters::print_on(outputStream* st) const { - tty->print_cr("# rtm locks total (estimated): " UINTX_FORMAT, _total_count * RTMTotalCountIncrRate); - tty->print_cr("# rtm lock aborts (total): " UINTX_FORMAT, _abort_count); - for (int i = 0; i < ABORT_STATUS_LIMIT; i++) { - tty->print_cr("# rtm lock aborts %d (%s): " UINTX_FORMAT, i, _abortX_desc[i], _abortX_count[i]); - } -} -void RTMLockingCounters::print() const { print_on(tty); } - -#endif diff --git a/src/hotspot/share/runtime/rtmLocking.hpp b/src/hotspot/share/runtime/rtmLocking.hpp deleted file mode 100644 index db9678b17b10d..0000000000000 --- a/src/hotspot/share/runtime/rtmLocking.hpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef SHARE_RUNTIME_RTMLOCKING_HPP -#define SHARE_RUNTIME_RTMLOCKING_HPP - -// Generate RTM (Restricted Transactional Memory) locking code for all inflated -// locks when "UseRTMLocking" option is on with normal locking mechanism as fall back -// handler. -// -// On abort/lock busy the lock will be retried a fixed number of times under RTM -// as specified by "RTMRetryCount" option. The locks which abort too often -// can be auto tuned or manually tuned. -// -// Auto-tuning can be done on an option like UseRTMDeopt and it will need abort -// ratio calculation for each lock. The abort ratio will be calculated after -// "RTMAbortThreshold" number of aborts is reached. The formulas are: -// -// Aborted transactions = abort_count * 100 -// All transactions = total_count * RTMTotalCountIncrRate -// -// Aborted transactions >= All transactions * RTMAbortRatio -// -// If "UseRTMDeopt" is on and the aborts ratio reaches "RTMAbortRatio" -// the method containing the lock will be deoptimized and recompiled with -// all locks as normal locks. If the abort ratio continues to remain low after -// "RTMLockingThreshold" locks are attempted, then the method will be deoptimized -// and recompiled with all locks as RTM locks without abort ratio calculation code. -// The abort ratio calculation can be delayed by specifying flag -// -XX:RTMLockingCalculationDelay in millisecond. -// -// For manual tuning the abort statistics for each lock needs to be provided -// to the user on some JVM option like "PrintPreciseRTMLockingStatistics". -// Based on the abort statistics users can create a .hotspot_compiler file -// or use -XX:CompileCommand=option,class::method,NoRTMLockEliding -// to specify for which methods to disable RTM locking. -// -// When UseRTMForStackLocks option is enabled along with UseRTMLocking option, -// the RTM locking code is generated for stack locks too. -// The retries, auto-tuning support and rtm locking statistics are all -// supported for stack locks just like inflated locks. - -// RTM locking counters -class RTMLockingCounters { - private: - uintx _total_count; // Total RTM locks count - uintx _abort_count; // Total aborts count - - public: - enum { ABORT_STATUS_LIMIT = 6 }; - // Counters per RTM Abort Status. Incremented with +PrintPreciseRTMLockingStatistics - // RTM uses the EAX register to communicate abort status to software. - // Following an RTM abort the EAX register has the following definition. - // - // EAX register bit position Meaning - // 0 Set if abort caused by XABORT instruction. - // 1 If set, the transaction may succeed on a retry. This bit is always clear if bit 0 is set. - // 2 Set if another logical processor conflicted with a memory address that was part of the transaction that aborted. - // 3 Set if an internal buffer overflowed. - // 4 Set if a debug breakpoint was hit. - // 5 Set if an abort occurred during execution of a nested transaction. - private: - uintx _abortX_count[ABORT_STATUS_LIMIT]; - static const char* _abortX_desc[ABORT_STATUS_LIMIT]; - - public: - static uintx _calculation_flag; - static uintx* rtm_calculation_flag_addr() { return &_calculation_flag; } - - static void init(); - - RTMLockingCounters() : _total_count(0), _abort_count(0) { - for (int i = 0; i < ABORT_STATUS_LIMIT; i++) { - _abortX_count[i] = 0; - } - } - - uintx* total_count_addr() { return &_total_count; } - - static int total_count_offset() { return (int)offset_of(RTMLockingCounters, _total_count); } - static int abort_count_offset() { return (int)offset_of(RTMLockingCounters, _abort_count); } - static int abortX_count_offset() { return (int)offset_of(RTMLockingCounters, _abortX_count[0]); } - - - bool nonzero() { return (_abort_count + _total_count) > 0; } - - void print_on(outputStream* st) const; - void print() const; -}; - -#endif // SHARE_RUNTIME_RTMLOCKING_HPP diff --git a/src/hotspot/share/runtime/threads.cpp b/src/hotspot/share/runtime/threads.cpp index 051c2901fa067..eb83dda1ff5ff 100644 --- a/src/hotspot/share/runtime/threads.cpp +++ b/src/hotspot/share/runtime/threads.cpp @@ -109,9 +109,6 @@ #ifdef COMPILER2 #include "opto/idealGraphPrinter.hpp" #endif -#if INCLUDE_RTM_OPT -#include "runtime/rtmLocking.hpp" -#endif #if INCLUDE_JFR #include "jfr/jfr.hpp" #endif @@ -802,10 +799,6 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { StatSampler::engage(); if (CheckJNICalls) JniPeriodicChecker::engage(); -#if INCLUDE_RTM_OPT - RTMLockingCounters::init(); -#endif - call_postVMInitHook(THREAD); // The Java side of PostVMInitHook.run must deal with all // exceptions and provide means of diagnosis. diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index 4381bb973bbec..8ff766af128b7 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -2259,7 +2259,6 @@ declare_constant(Deoptimization::Reason_speculate_class_check) \ declare_constant(Deoptimization::Reason_speculate_null_check) \ declare_constant(Deoptimization::Reason_speculate_null_assert) \ - declare_constant(Deoptimization::Reason_rtm_state_change) \ declare_constant(Deoptimization::Reason_unstable_if) \ declare_constant(Deoptimization::Reason_unstable_fused_if) \ declare_constant(Deoptimization::Reason_receiver_constraint) \ diff --git a/src/java.base/share/classes/java/lang/Double.java b/src/java.base/share/classes/java/lang/Double.java index c472f5c3fcf37..277e1c14480c1 100644 --- a/src/java.base/share/classes/java/lang/Double.java +++ b/src/java.base/share/classes/java/lang/Double.java @@ -411,41 +411,43 @@ public final class Double extends Number public static final double MIN_VALUE = 0x0.0000000000001P-1022; // 4.9e-324 /** - * The number of bits used to represent a {@code double} value. + * The number of bits used to represent a {@code double} value, + * {@value}. * * @since 1.5 */ public static final int SIZE = 64; /** - * The number of bits in the significand of a {@code double} value. - * This is the parameter N in section {@jls 4.2.3} of - * The Java Language Specification. + * The number of bits in the significand of a {@code double} + * value, {@value}. This is the parameter N in section {@jls + * 4.2.3} of The Java Language Specification. * * @since 19 */ public static final int PRECISION = 53; /** - * Maximum exponent a finite {@code double} variable may have. - * It is equal to the value returned by - * {@code Math.getExponent(Double.MAX_VALUE)}. + * Maximum exponent a finite {@code double} variable may have, + * {@value}. It is equal to the value returned by {@code + * Math.getExponent(Double.MAX_VALUE)}. * * @since 1.6 */ public static final int MAX_EXPONENT = (1 << (SIZE - PRECISION - 1)) - 1; // 1023 /** - * Minimum exponent a normalized {@code double} variable may - * have. It is equal to the value returned by - * {@code Math.getExponent(Double.MIN_NORMAL)}. + * Minimum exponent a normalized {@code double} variable may have, + * {@value}. It is equal to the value returned by {@code + * Math.getExponent(Double.MIN_NORMAL)}. * * @since 1.6 */ public static final int MIN_EXPONENT = 1 - MAX_EXPONENT; // -1022 /** - * The number of bytes used to represent a {@code double} value. + * The number of bytes used to represent a {@code double} value, + * {@value}. * * @since 1.8 */ diff --git a/src/java.base/share/classes/java/lang/Float.java b/src/java.base/share/classes/java/lang/Float.java index fab92d5c4c920..63a4cc0fab29b 100644 --- a/src/java.base/share/classes/java/lang/Float.java +++ b/src/java.base/share/classes/java/lang/Float.java @@ -127,15 +127,16 @@ public final class Float extends Number public static final float MIN_VALUE = 0x0.000002P-126f; // 1.4e-45f /** - * The number of bits used to represent a {@code float} value. + * The number of bits used to represent a {@code float} value, + * {@value}. * * @since 1.5 */ public static final int SIZE = 32; /** - * The number of bits in the significand of a {@code float} value. - * This is the parameter N in section {@jls 4.2.3} of + * The number of bits in the significand of a {@code float} value, + * {@value}. This is the parameter N in section {@jls 4.2.3} of * The Java Language Specification. * * @since 19 @@ -143,8 +144,8 @@ public final class Float extends Number public static final int PRECISION = 24; /** - * Maximum exponent a finite {@code float} variable may have. It - * is equal to the value returned by {@code + * Maximum exponent a finite {@code float} variable may have, + * {@value}. It is equal to the value returned by {@code * Math.getExponent(Float.MAX_VALUE)}. * * @since 1.6 @@ -152,8 +153,8 @@ public final class Float extends Number public static final int MAX_EXPONENT = (1 << (SIZE - PRECISION - 1)) - 1; // 127 /** - * Minimum exponent a normalized {@code float} variable may have. - * It is equal to the value returned by {@code + * Minimum exponent a normalized {@code float} variable may have, + * {@value}. It is equal to the value returned by {@code * Math.getExponent(Float.MIN_NORMAL)}. * * @since 1.6 @@ -161,7 +162,8 @@ public final class Float extends Number public static final int MIN_EXPONENT = 1 - MAX_EXPONENT; // -126 /** - * The number of bytes used to represent a {@code float} value. + * The number of bytes used to represent a {@code float} value, + * {@value}. * * @since 1.8 */ diff --git a/src/java.base/share/man/java.1 b/src/java.base/share/man/java.1 index 6cef707d19acd..4bd0306b2b804 100644 --- a/src/java.base/share/man/java.1 +++ b/src/java.base/share/man/java.1 @@ -36,7 +36,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JAVA" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JAVA" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP @@ -186,7 +186,7 @@ with new values added and old values removed. You\[aq]ll get an error message if you use a value of \f[I]N\f[R] that is no longer supported. The supported values of \f[I]N\f[R] are the current Java SE release -(\f[V]23\f[R]) and a limited number of previous releases, detailed in +(\f[V]24\f[R]) and a limited number of previous releases, detailed in the command-line help for \f[V]javac\f[R], under the \f[V]--source\f[R] and \f[V]--release\f[R] options. .RE @@ -1195,7 +1195,7 @@ or directories. \f[V]--source\f[R] \f[I]version\f[R] Sets the version of the source in source-file mode. .TP -\f[V]--sun-misc-unsafe-memory-acces=\f[R] \f[I]value\f[R] +\f[V]--sun-misc-unsafe-memory-access=\f[R] \f[I]value\f[R] Allow or deny usage of unsupported API \f[V]sun.misc.Unsafe\f[R]. \f[I]value\f[R] is one of: .RS @@ -3484,16 +3484,6 @@ By default, this option is disabled. Enables printing of information about adaptive-generation sizing. By default, this option is disabled. .TP -\f[V]-XX:+ScavengeBeforeFullGC\f[R] -Enables GC of the young generation before each full GC. -This option is enabled by default. -It is recommended that you \f[I]don\[aq]t\f[R] disable it, because -scavenging the young generation before a full GC can reduce the number -of objects reachable from the old generation space into the young -generation space. -To disable GC of the young generation before each full GC, specify the -option \f[V]-XX:-ScavengeBeforeFullGC\f[R]. -.TP \f[V]-XX:SoftRefLRUPolicyMSPerMB=\f[R]\f[I]time\f[R] Sets the amount of time (in milliseconds) a softly reachable object is kept active on the heap after the last time it was referenced. @@ -3786,6 +3776,28 @@ The default value is 2. .PP Use the option \f[V]-XX:MinRAMPercentage\f[R] instead. .RE +.SH OBSOLETE JAVA OPTIONS +.PP +These \f[V]java\f[R] options are still accepted but ignored, and a +warning is issued when they\[aq]re used. +.TP +\f[V]--illegal-access=\f[R]\f[I]parameter\f[R] +Controlled \f[I]relaxed strong encapsulation\f[R], as defined in +\f[B]JEP 261\f[R] +[https://openjdk.org/jeps/261#Relaxed-strong-encapsulation]. +This option was deprecated in JDK 16 by \f[B]JEP 396\f[R] +[https://openjdk.org/jeps/396] and made obsolete in JDK 17 by \f[B]JEP +403\f[R] [https://openjdk.org/jeps/403]. +.TP +\f[V]-XX:+ScavengeBeforeFullGC\f[R] +Enables GC of the young generation before each full GC. +This option is enabled by default. +It is recommended that you \f[I]don\[aq]t\f[R] disable it, because +scavenging the young generation before a full GC can reduce the number +of objects reachable from the old generation space into the young +generation space. +To disable GC of the young generation before each full GC, specify the +option \f[V]-XX:-ScavengeBeforeFullGC\f[R]. .TP \f[V]-XX:RTMAbortRatio=\f[R]\f[I]abort_ratio\f[R] Specifies the RTM abort ratio is specified as a percentage (%) of all @@ -3863,21 +3875,9 @@ As a result, the processors repeatedly invalidate the cache lines of other processors, which forces them to read from main memory instead of their cache. .RE -.SH OBSOLETE JAVA OPTIONS -.PP -These \f[V]java\f[R] options are still accepted but ignored, and a -warning is issued when they\[aq]re used. -.TP -\f[V]--illegal-access=\f[R]\f[I]parameter\f[R] -Controlled \f[I]relaxed strong encapsulation\f[R], as defined in -\f[B]JEP 261\f[R] -[https://openjdk.org/jeps/261#Relaxed-strong-encapsulation]. -This option was deprecated in JDK 16 by \f[B]JEP 396\f[R] -[https://openjdk.org/jeps/396] and made obsolete in JDK 17 by \f[B]JEP -403\f[R] [https://openjdk.org/jeps/403]. .SH REMOVED JAVA OPTIONS .PP -These \f[V]java\f[R] options have been removed in JDK 23 and using them +These \f[V]java\f[R] options have been removed in JDK 24 and using them results in an error of: .RS .PP diff --git a/src/java.base/share/man/keytool.1 b/src/java.base/share/man/keytool.1 index a61095d45048c..63a134eb932cc 100644 --- a/src/java.base/share/man/keytool.1 +++ b/src/java.base/share/man/keytool.1 @@ -1,4 +1,4 @@ -.\" Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. +.\" Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. .\" .\" This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "KEYTOOL" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "KEYTOOL" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP @@ -1747,7 +1747,7 @@ risk. The \f[V]keytool\f[R] command supports these named extensions. The names aren\[aq]t case-sensitive. .TP -\f[V]BC\f[R] or \f[V]BasicContraints\f[R] +\f[V]BC\f[R] or \f[V]BasicConstraints\f[R] Values: .RS .PP diff --git a/src/java.rmi/share/man/rmiregistry.1 b/src/java.rmi/share/man/rmiregistry.1 index 29a2e2c965aa9..c168e1482a6f3 100644 --- a/src/java.rmi/share/man/rmiregistry.1 +++ b/src/java.rmi/share/man/rmiregistry.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "RMIREGISTRY" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "RMIREGISTRY" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/java.scripting/share/man/jrunscript.1 b/src/java.scripting/share/man/jrunscript.1 index 43029582b3ea4..59389c274d1ea 100644 --- a/src/java.scripting/share/man/jrunscript.1 +++ b/src/java.scripting/share/man/jrunscript.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JRUNSCRIPT" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JRUNSCRIPT" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.compiler/share/man/javac.1 b/src/jdk.compiler/share/man/javac.1 index de374e7d0c7d6..ebee036923849 100644 --- a/src/jdk.compiler/share/man/javac.1 +++ b/src/jdk.compiler/share/man/javac.1 @@ -1,4 +1,4 @@ -.\" Copyright (c) 1994, 2024, Oracle and/or its affiliates. All rights reserved. +.\" Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved. .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. .\" .\" This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JAVAC" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JAVAC" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.compiler/share/man/serialver.1 b/src/jdk.compiler/share/man/serialver.1 index cd437b7e9bf3e..bad14872ee6d0 100644 --- a/src/jdk.compiler/share/man/serialver.1 +++ b/src/jdk.compiler/share/man/serialver.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "SERIALVER" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "SERIALVER" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.hotspot.agent/share/man/jhsdb.1 b/src/jdk.hotspot.agent/share/man/jhsdb.1 index 30b2d3fe95c82..5b65f7eafb465 100644 --- a/src/jdk.hotspot.agent/share/man/jhsdb.1 +++ b/src/jdk.hotspot.agent/share/man/jhsdb.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JHSDB" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JHSDB" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.httpserver/share/man/jwebserver.1 b/src/jdk.httpserver/share/man/jwebserver.1 index 3c48d81fc9cba..4fbaf9dd09dc2 100644 --- a/src/jdk.httpserver/share/man/jwebserver.1 +++ b/src/jdk.httpserver/share/man/jwebserver.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JWEBSERVER" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JWEBSERVER" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jartool/share/man/jar.1 b/src/jdk.jartool/share/man/jar.1 index 49a028e0f293b..2d983eb561e3b 100644 --- a/src/jdk.jartool/share/man/jar.1 +++ b/src/jdk.jartool/share/man/jar.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JAR" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JAR" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jartool/share/man/jarsigner.1 b/src/jdk.jartool/share/man/jarsigner.1 index ea8f686a4c84d..d085efcfcd079 100644 --- a/src/jdk.jartool/share/man/jarsigner.1 +++ b/src/jdk.jartool/share/man/jarsigner.1 @@ -36,7 +36,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JARSIGNER" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JARSIGNER" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.javadoc/share/man/javadoc.1 b/src/jdk.javadoc/share/man/javadoc.1 index 73d12efbf30f2..4e256a7ce38b2 100644 --- a/src/jdk.javadoc/share/man/javadoc.1 +++ b/src/jdk.javadoc/share/man/javadoc.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JAVADOC" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JAVADOC" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP @@ -218,7 +218,7 @@ summary is required. For more explicit control in any individual documentation comment, enclose the contents of the first sentence in a \f[V]{\[at]summary ...}\f[R] tag, or when applicable, in a -\[ga]{\[at]return ...} tag. +\f[V]{\[at]return ...}\f[R] tag. .RE .TP \f[V]-doclet\f[R] \f[I]class\f[R] @@ -522,7 +522,8 @@ Allow JavaScript in documentation comments, and options whose value is \f[I]html-code\f[R]. .TP \f[V]-author\f[R] -Includes the \f[V]\[at]author\f[R] text in the generated docs. +Includes the text of any \f[V]author\f[R] tags in the generated +documentation. .TP \f[V]-bottom\f[R] \f[I]html-code\f[R] Specifies the text to be placed at the bottom of each generated page. @@ -986,8 +987,8 @@ is used. .RE .TP \f[V]-nosince\f[R] -Omits from the generated documents the \f[V]Since\f[R] sections -associated with the \f[V]\[at]since\f[R] tags. +Omits from the generated documentation the \f[V]Since\f[R] sections +derived from any \f[V]since\f[R] tags. .TP \f[V]-notimestamp\f[R] Suppresses the time stamp, which is hidden in an HTML comment in the @@ -1020,9 +1021,6 @@ to the current working directory. .PP The file may be an HTML file, with a filename ending in \f[V].html\f[R], or a Markdown file, with a filename ending in \f[V].md\f[R]. -.PD 0 -.P -.PD If the file is an HTML file, the content for the overview documentation is taken from the \f[V]
\f[R] element in the file, if one is present, or from the \f[V]\f[R] element is there is no @@ -1213,10 +1211,11 @@ To access the generated Use page, go to the class or package and click the \f[B]USE\f[R] link in the navigation bar. .TP \f[V]-version\f[R] -Includes the version text in the generated docs. +Includes the text of any \f[V]version\f[R] tags in the generated +documentation. This text is omitted by default. -To find out what version of the \f[V]javadoc\f[R] tool you are using, -use the \f[V]--version\f[R] option (with two hyphens). +Note: To find out what version of the \f[V]javadoc\f[R] tool you are +using, use the \f[V]--version\f[R] option (with two hyphens). .TP \f[V]-windowtitle\f[R] \f[I]title\f[R] Specifies the title to be placed in the HTML \f[V]\f[R] tag. diff --git a/src/jdk.jcmd/share/man/jcmd.1 b/src/jdk.jcmd/share/man/jcmd.1 index c88d2a22a4134..2befaf5a94993 100644 --- a/src/jdk.jcmd/share/man/jcmd.1 +++ b/src/jdk.jcmd/share/man/jcmd.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JCMD" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JCMD" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jcmd/share/man/jinfo.1 b/src/jdk.jcmd/share/man/jinfo.1 index fc87807c6fec0..49d8a85263373 100644 --- a/src/jdk.jcmd/share/man/jinfo.1 +++ b/src/jdk.jcmd/share/man/jinfo.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JINFO" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JINFO" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jcmd/share/man/jmap.1 b/src/jdk.jcmd/share/man/jmap.1 index 4865f43d1c4cd..42831aa68acf5 100644 --- a/src/jdk.jcmd/share/man/jmap.1 +++ b/src/jdk.jcmd/share/man/jmap.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JMAP" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JMAP" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jcmd/share/man/jps.1 b/src/jdk.jcmd/share/man/jps.1 index be506be2e8209..cbc69872b607b 100644 --- a/src/jdk.jcmd/share/man/jps.1 +++ b/src/jdk.jcmd/share/man/jps.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JPS" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JPS" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jcmd/share/man/jstack.1 b/src/jdk.jcmd/share/man/jstack.1 index 9effcb0902f57..933db5fc80db5 100644 --- a/src/jdk.jcmd/share/man/jstack.1 +++ b/src/jdk.jcmd/share/man/jstack.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JSTACK" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JSTACK" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jcmd/share/man/jstat.1 b/src/jdk.jcmd/share/man/jstat.1 index dd7d383290896..22e111a812beb 100644 --- a/src/jdk.jcmd/share/man/jstat.1 +++ b/src/jdk.jcmd/share/man/jstat.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JSTAT" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JSTAT" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jconsole/share/man/jconsole.1 b/src/jdk.jconsole/share/man/jconsole.1 index ce1f948e6f160..ec70040acf4e8 100644 --- a/src/jdk.jconsole/share/man/jconsole.1 +++ b/src/jdk.jconsole/share/man/jconsole.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JCONSOLE" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JCONSOLE" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jdeps/share/man/javap.1 b/src/jdk.jdeps/share/man/javap.1 index f9ec998e0af83..27b0a29d0ba10 100644 --- a/src/jdk.jdeps/share/man/javap.1 +++ b/src/jdk.jdeps/share/man/javap.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JAVAP" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JAVAP" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jdeps/share/man/jdeprscan.1 b/src/jdk.jdeps/share/man/jdeprscan.1 index ac850cf78de11..fc13f05c4496e 100644 --- a/src/jdk.jdeps/share/man/jdeprscan.1 +++ b/src/jdk.jdeps/share/man/jdeprscan.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JDEPRSCAN" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JDEPRSCAN" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jdeps/share/man/jdeps.1 b/src/jdk.jdeps/share/man/jdeps.1 index 53891441665d0..d3dde37e3b9b7 100644 --- a/src/jdk.jdeps/share/man/jdeps.1 +++ b/src/jdk.jdeps/share/man/jdeps.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JDEPS" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JDEPS" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jdi/share/man/jdb.1 b/src/jdk.jdi/share/man/jdb.1 index 530c9bed6a118..88097ffeae4bc 100644 --- a/src/jdk.jdi/share/man/jdb.1 +++ b/src/jdk.jdi/share/man/jdb.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JDB" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JDB" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jfr/share/man/jfr.1 b/src/jdk.jfr/share/man/jfr.1 index c6a568582c09b..71a487f558ed2 100644 --- a/src/jdk.jfr/share/man/jfr.1 +++ b/src/jdk.jfr/share/man/jfr.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JFR" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JFR" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jlink/share/man/jlink.1 b/src/jdk.jlink/share/man/jlink.1 index 1a0b79a39c1ab..9f4bf38ffa580 100644 --- a/src/jdk.jlink/share/man/jlink.1 +++ b/src/jdk.jlink/share/man/jlink.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JLINK" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JLINK" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jlink/share/man/jmod.1 b/src/jdk.jlink/share/man/jmod.1 index b26685615ed4c..4475505e524a2 100644 --- a/src/jdk.jlink/share/man/jmod.1 +++ b/src/jdk.jlink/share/man/jmod.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JMOD" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JMOD" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jpackage/share/man/jpackage.1 b/src/jdk.jpackage/share/man/jpackage.1 index f98482000592f..13d9c41c31d6a 100644 --- a/src/jdk.jpackage/share/man/jpackage.1 +++ b/src/jdk.jpackage/share/man/jpackage.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JPACKAGE" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JPACKAGE" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jshell/share/man/jshell.1 b/src/jdk.jshell/share/man/jshell.1 index 28160bb49fd91..6f478e57442a0 100644 --- a/src/jdk.jshell/share/man/jshell.1 +++ b/src/jdk.jshell/share/man/jshell.1 @@ -36,7 +36,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JSHELL" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JSHELL" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/src/jdk.jstatd/share/man/jstatd.1 b/src/jdk.jstatd/share/man/jstatd.1 index cbbaeaf49f292..4bd90104624b1 100644 --- a/src/jdk.jstatd/share/man/jstatd.1 +++ b/src/jdk.jstatd/share/man/jstatd.1 @@ -35,7 +35,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "JSTATD" "1" "2024" "JDK 23-ea" "JDK Commands" +.TH "JSTATD" "1" "2025" "JDK 24-ea" "JDK Commands" .hy .SH NAME .PP diff --git a/test/hotspot/gtest/gc/parallel/test_psParallelCompact.cpp b/test/hotspot/gtest/gc/parallel/test_psParallelCompact.cpp deleted file mode 100644 index 4820a01cc5771..0000000000000 --- a/test/hotspot/gtest/gc/parallel/test_psParallelCompact.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include "precompiled.hpp" -#include "gc/parallel/parMarkBitMap.inline.hpp" -#include "gc/parallel/psCompactionManager.inline.hpp" -#include "gc/parallel/psParallelCompact.hpp" -#include "unittest.hpp" - -#ifndef PRODUCT - -class PSParallelCompactTest : public ::testing::Test { - public: - static void print_generic_summary_data(ParallelCompactData& summary_data, - HeapWord* const beg_addr, - HeapWord* const end_addr) { - PSParallelCompact::print_generic_summary_data(summary_data, - beg_addr, end_addr); - } -}; - -// @requires UseParallelGC -TEST_VM(PSParallelCompact, print_generic_summary_data) { - if (!UseParallelGC) { - return; - } - // Check that print_generic_summary_data() does not print the - // end region by placing a bad value in the destination of the - // end region. The end region should not be printed because it - // corresponds to the space after the end of the heap. - ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); - HeapWord* begin_heap = - (HeapWord*) heap->old_gen()->virtual_space()->low_boundary(); - HeapWord* end_heap = - (HeapWord*) heap->young_gen()->virtual_space()->high_boundary(); - - PSParallelCompactTest::print_generic_summary_data(PSParallelCompact::summary_data(), - begin_heap, end_heap); -} - -#endif diff --git a/test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp b/test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp index 40df20ba964b3..102ede42de63f 100644 --- a/test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp +++ b/test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp @@ -212,18 +212,6 @@ class TestGenCollectorPolicy { // depends on so many other configurable variables. These tests only try to // verify that there are some basic rules for NewSize honored by the policies. -// If NewSize has been ergonomically set, the collector policy -// should use it for min -// This test doesn't work with 64k pages. See JDK-8331675. -#if !defined(PPC) -TEST_VM(CollectorPolicy, young_min_ergo) { - TestGenCollectorPolicy::SetNewSizeErgo setter(20 * M); - TestGenCollectorPolicy::CheckYoungMin checker(20 * M); - - TestGenCollectorPolicy::TestWrapper::test(&setter, &checker); -} -#endif - // If NewSize has been ergonomically set, the collector policy // should use it for min but calculate the initial young size // using NewRatio. diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 55fc22b4e759c..78e09c0627afa 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -51,18 +51,6 @@ compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java 8190680 generic-all compiler/runtime/Test8168712.java 8211769,8211771 generic-ppc64,generic-ppc64le,linux-s390x compiler/loopopts/TestUnreachableInnerLoop.java 8288981 linux-s390x -compiler/rtm/locking/TestRTMAbortRatio.java 8183263 generic-x64,generic-i586 -compiler/rtm/locking/TestRTMAbortThreshold.java 8183263 generic-x64,generic-i586 -compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java 8183263 generic-x64,generic-i586 -compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java 8183263 generic-x64,generic-i586 -compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java 8183263 generic-x64,generic-i586 -compiler/rtm/locking/TestRTMLockingCalculationDelay.java 8183263 generic-x64,generic-i586 -compiler/rtm/locking/TestRTMLockingThreshold.java 8183263 generic-x64,generic-i586 -compiler/rtm/locking/TestRTMSpinLoopCount.java 8183263 generic-x64,generic-i586 -compiler/rtm/locking/TestUseRTMDeopt.java 8183263 generic-x64,generic-i586 -compiler/rtm/locking/TestUseRTMXendForLockBusy.java 8183263 generic-x64,generic-i586 -compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java 8183263 generic-x64,generic-i586 - compiler/c2/Test8004741.java 8235801 generic-all compiler/c2/irTests/TestDuplicateBackedge.java 8318904 generic-all @@ -134,6 +122,7 @@ serviceability/sa/TestRevPtrsForInvokeDynamic.java 8241235 generic-all serviceability/jvmti/ModuleAwareAgents/ThreadStart/MAAThreadStart.java 8225354 windows-all serviceability/jvmti/vthread/GetThreadStateMountedTest/GetThreadStateMountedTest.java 8318090,8318729 generic-all serviceability/jvmti/vthread/GetSetLocalTest/GetSetLocalTest.java 8286836 generic-all +serviceability/jvmti/vthread/CarrierThreadEventNotification/CarrierThreadEventNotification.java 8333681 generic-all serviceability/dcmd/gc/RunFinalizationTest.java 8227120 generic-all serviceability/sa/ClhsdbCDSCore.java 8267433 macosx-x64 diff --git a/test/hotspot/jtreg/TEST.groups b/test/hotspot/jtreg/TEST.groups index 78db6d017755b..ecded09f4cc0c 100644 --- a/test/hotspot/jtreg/TEST.groups +++ b/test/hotspot/jtreg/TEST.groups @@ -254,7 +254,6 @@ tier2_compiler = \ compiler/parsing/ \ compiler/rangechecks/ \ compiler/reflection/ \ - compiler/rtm/ \ compiler/runtime/Test6826736.java \ compiler/stable/ \ compiler/stringopts/ \ diff --git a/test/hotspot/jtreg/compiler/loopopts/TestPartialPeelAtUnsignedTestsNegativeLimit.java b/test/hotspot/jtreg/compiler/loopopts/TestPartialPeelAtUnsignedTestsNegativeLimit.java new file mode 100644 index 0000000000000..7809f79ce9d9b --- /dev/null +++ b/test/hotspot/jtreg/compiler/loopopts/TestPartialPeelAtUnsignedTestsNegativeLimit.java @@ -0,0 +1,327 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test id=Xbatch + * @bug 8332920 + * @summary Tests partial peeling at unsigned tests with limit being negative in exit tests "i >u limit". + * @run main/othervm -Xbatch -XX:-TieredCompilation + * -XX:CompileOnly=*TestPartialPeel*::original*,*TestPartialPeel*::test* + * compiler.loopopts.TestPartialPeelAtUnsignedTestsNegativeLimit + */ + +/* + * @test id=Xcomp-run-inline + * @bug 8332920 + * @summary Tests partial peeling at unsigned tests with limit being negative in exit tests "i >u limit". + * @run main/othervm -Xcomp -XX:-TieredCompilation + * -XX:CompileOnly=*TestPartialPeel*::original*,*TestPartialPeel*::run*,*TestPartialPeel*::test* + * -XX:CompileCommand=inline,*TestPartialPeelAtUnsignedTestsNegativeLimit::test* + * -XX:CompileCommand=dontinline,*TestPartialPeelAtUnsignedTestsNegativeLimit::check + * compiler.loopopts.TestPartialPeelAtUnsignedTestsNegativeLimit + */ + +/* + * @test id=Xcomp-compile-test + * @bug 8332920 + * @summary Tests partial peeling at unsigned tests with limit being negative in exit tests "i >u limit". + * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=*TestPartialPeel*::original*,*TestPartialPeel*::test* + * compiler.loopopts.TestPartialPeelAtUnsignedTestsNegativeLimit + */ + +/* + * @test id=vanilla + * @bug 8332920 + * @requires vm.flavor == "server" & (vm.opt.TieredStopAtLevel == null | vm.opt.TieredStopAtLevel == 4) + * @summary Tests partial peeling at unsigned tests with limit being negative in exit tests "i >u limit". + * Only run this test with C2 since it is time-consuming and only tests a C2 issue. + * @run main compiler.loopopts.TestPartialPeelAtUnsignedTestsNegativeLimit + */ + +package compiler.loopopts; + +import java.util.Random; + +import static java.lang.Integer.*; + +public class TestPartialPeelAtUnsignedTestsNegativeLimit { + static int iFld = 10000; + static int iterations = 0; + static int iFld2; + static boolean flag; + final static Random RANDOM = new Random(); + + public static void main(String[] args) { + compareUnsigned(3, 3); // Load Integer class for -Xcomp + for (int i = 0; i < 2; i++) { + if (!originalTest()) { + throw new RuntimeException("originalTest() failed"); + } + } + + for (int i = 0; i < 2000; i++) { + // For profiling + iFld = -1; + originalTestVariation1(); + + // Actual run + iFld = MAX_VALUE - 100_000; + if (!originalTestVariation1()) { + throw new RuntimeException("originalTestVariation1() failed"); + } + } + + for (int i = 0; i < 2000; ++i) { + // For profiling + iFld = MAX_VALUE; + originalTestVariation2(); + + // Actual run + iFld = MIN_VALUE + 100000; + if (!originalTestVariation2()) { + throw new RuntimeException("originalTestVariation2() failed"); + } + } + + runWhileLTIncr(); + runWhileLTDecr(); + } + + // Originally reported simplified regression test with 2 variations (see below). + public static boolean originalTest() { + for (int i = MAX_VALUE - 50_000; compareUnsigned(i, -1) < 0; i++) { + if (compareUnsigned(MIN_VALUE, i) < 0) { + return true; + } + } + return false; + } + + public static boolean originalTestVariation1() { + int a = 0; + for (int i = iFld; compareUnsigned(i, -1) < 0; ++i) { // i <u -1 + + if (i >= Integer.MIN_VALUE + 1 && i <= 100) { // Transformed to unsigned test. + return true; + } + a *= 23; + } + return false; + } + + public static boolean originalTestVariation2() { + int a = 0; + for (int i = iFld; compareUnsigned(i, -1000) < 0; i--) { // i <u -1 + if (compareUnsigned(MAX_VALUE - 20, i) > 0) { + return true; + } + a = i; + } + System.out.println(a); + return false; + } + + + public static void testWhileLTIncr(int init, int limit) { + int i = init; + while (true) { + // <Peeled Section> + + // Found as loop head in ciTypeFlow, but both paths inside loop -> head not cloned. + // As a result, this head has the safepoint as backedge instead of the loop exit test + // and we cannot create a counted loop (yet). We first need to partial peel. + if (flag) { + } + + iFld2++; + + // Loop exit test i >=u limit (i.e. "while (i <u limit)") to partial peel with. + // insert_cmpi_loop_exit() changes this exit condition into a signed and an unsigned test: + // i >= limit && i >=u limit + // where the signed condition can be used as proper loop exit condition for a counted loop + // (we cannot use an unsigned counted loop exit condition). + // + // After Partial Peeling, we have: + // if (i >= limit) goto Exit + // Loop: + // if (i >=u limit) goto Exit + // ... + // i++; + // if (i >= limit) goto Exit + // goto Loop + // Exit: + // ... + // + // If init = MAX_VALUE and limit = MIN_VALUE: + // i >= limit + // MAX_VALUE >= MIN_VALUE + // which is true where + // i >=u limit + // MAX_VALUE >=u MIN_VALUE + // MAX_VALUE >=u (uint)(MAX_INT + 1) + // is false and we wrongly never enter the loop even though we should have. + // This results in a wrong execution. + if (compareUnsigned(i, limit) >= 0) { + return; + } + // <-- Partial Peeling CUT --> + // Safepoint + // <Unpeeled Section> + iterations++; + i++; + } + } + + // Same as testWhileLTIncr() but with decrement instead. + public static void testWhileLTDecr(int init, int limit) { + int i = init; + while (true) { + if (flag) { + } + + // Loop exit test. + if (compareUnsigned(i, limit) >= 0) { // While (i <u limit) + return; + } + + iterations++; + i--; + } + } + + public static void runWhileLTIncr() { + // Currently works: + testWhileLTIncr(MAX_VALUE, -1); + check(MIN_VALUE); // MAX_VALUE + 1 iterations + testWhileLTIncr(-1, 1); + check(0); + testWhileLTIncr(0, 0); + check(0); + checkIncrWithRandom(0, 0); // Sanity check this method. + flag = !flag; // Change profiling + testWhileLTIncr(MAX_VALUE - 2000, MAX_VALUE); + check(2000); + testWhileLTIncr(MAX_VALUE - 1990, MAX_VALUE); + check(1990); + testWhileLTIncr(MAX_VALUE - 1, MAX_VALUE); + check(1); + testWhileLTIncr(MIN_VALUE, MIN_VALUE + 2000); + check(2000); + testWhileLTIncr(MIN_VALUE, MIN_VALUE + 1990); + check(1990); + testWhileLTIncr(MIN_VALUE, MIN_VALUE + 1); + check(1); + + flag = !flag; + // Overflow currently does not work with negative limit and is fixed with patch: + testWhileLTIncr(MAX_VALUE, MIN_VALUE); + check(1); + testWhileLTIncr(MAX_VALUE - 2000, MIN_VALUE); + check(2001); + testWhileLTIncr(MAX_VALUE, MIN_VALUE + 2000); + check(2001); + testWhileLTIncr(MAX_VALUE - 2000, MIN_VALUE + 2000); + check(4001); + + // Random values + int init = RANDOM.nextInt(0, MAX_VALUE); + int limit = RANDOM.nextInt(MIN_VALUE, 0); + testWhileLTIncr(init, limit); + checkIncrWithRandom(init, limit); + } + + public static void runWhileLTDecr() { + // Currently works: + testWhileLTDecr(1, -1); + check(2); + testWhileLTDecr(-1, 1); + check(0); + testWhileLTDecr(0, 0); + check(0); + checkDecrWithRandom(0, 0); // Sanity check this method. + flag = !flag; + testWhileLTDecr(MAX_VALUE, MIN_VALUE); + check(MIN_VALUE); // MAX_VALUE + 1 iterations + testWhileLTDecr(MAX_VALUE, -1); + check(MIN_VALUE); // MAX_VALUE + 1 iterations + testWhileLTDecr(MAX_VALUE, MIN_VALUE); + check(MIN_VALUE); // MAX_VALUE + 1 iterations + testWhileLTDecr(MIN_VALUE, 0); + check(0); + testWhileLTDecr(MIN_VALUE, 1); + check(0); + flag = !flag; + + // Underflow currently does not work with negative limit and is fixed with patch: + testWhileLTDecr(MIN_VALUE, -1); + check(MIN_VALUE + 1); // MAX_VALUE + 2 iterations + testWhileLTDecr(MIN_VALUE, -2000); + check(MIN_VALUE + 1); // MAX_VALUE + 2 iterations + testWhileLTDecr(MIN_VALUE, MIN_VALUE + 1); + check(MIN_VALUE + 1); // MAX_VALUE + 2 iterations + testWhileLTDecr(MIN_VALUE + 2000, -1); + check(MIN_VALUE + 2001); // MAX_VALUE + 2002 iterations + testWhileLTDecr(MIN_VALUE + 2000, -2000); + check(MIN_VALUE + 2001); // MAX_VALUE + 2002 iterations + testWhileLTDecr(MIN_VALUE + 2000, MIN_VALUE + 2001); + check(MIN_VALUE + 2001); // MAX_VALUE + 2002 iterations + + // Random values + int r1 = RANDOM.nextInt(MIN_VALUE, 0); + int r2 = RANDOM.nextInt(MIN_VALUE, 0); + int init = Math.min(r1, r2); + int limit = Math.max(r1, r2); + testWhileLTDecr(init, limit); + checkDecrWithRandom(init, limit); + } + + static void check(int expectedIterations) { + if (expectedIterations != iterations) { + throw new RuntimeException("Expected " + expectedIterations + " iterations but only got " + iterations); + } + iterations = 0; // Reset + } + + static void checkIncrWithRandom(long init, long limit) { + long expectedIterations = ((long)(MAX_VALUE) - init) + (limit - (long)MIN_VALUE) + 1; + if ((int)expectedIterations != iterations) { + String error = "Expected %d iterations but only got %d, init: %d, limit: %d" + .formatted(expectedIterations, iterations, init, limit); + throw new RuntimeException(error); + } + iterations = 0; // Reset + } + + static void checkDecrWithRandom(long init, long limit) { + long expectedIterations = init + MIN_VALUE + MAX_VALUE + 2; + if (init == limit) { + expectedIterations = 0; + } + if ((int)expectedIterations != iterations) { + String error = "Expected %d iterations but only got %d, init: %d, limit: %d" + .formatted(expectedIterations, iterations, init, limit); + throw new RuntimeException(error); + } + iterations = 0; // Reset + } +} diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestVectorFPReduction.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestVectorFPReduction.java new file mode 100644 index 0000000000000..327e6e5e12de0 --- /dev/null +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestVectorFPReduction.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2024, Arm Limited. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.loopopts.superword; + +import compiler.lib.ir_framework.*; + +/* + * @test + * @bug 8320725 + * @summary Ensure strictly ordered AddReductionVF/VD and MulReductionVF/VD nodes + are generated when these operations are auto-vectorized + * @library /test/lib / + * @run driver compiler.loopopts.superword.TestVectorFPReduction + */ + +public class TestVectorFPReduction { + + final private static int SIZE = 1024; + + private static double[] da = new double[SIZE]; + private static double[] db = new double[SIZE]; + private static float[] fa = new float[SIZE]; + private static float[] fb = new float[SIZE]; + private static float fresult; + private static double dresult; + + public static void main(String[] args) { + TestFramework.run(); + } + + @Test + @IR(failOn = {IRNode.ADD_REDUCTION_VF}, + applyIfCPUFeatureAnd = {"asimd", "true", "sve", "false"}) + @IR(counts = {"requires_strict_order", ">=1", IRNode.ADD_REDUCTION_VF, ">=1"}, + failOn = {"no_strict_order"}, + applyIfCPUFeatureOr = {"sve", "true", "sse2", "true"}, + phase = CompilePhase.PRINT_IDEAL) + private static void testAddReductionVF() { + float result = 1; + for (int i = 0; i < SIZE; i++) { + result += (fa[i] + fb[i]); + } + fresult += result; + } + + @Test + @IR(failOn = {IRNode.ADD_REDUCTION_VD}, + applyIfCPUFeatureAnd = {"asimd", "true", "sve", "false"}) + @IR(counts = {"requires_strict_order", ">=1", IRNode.ADD_REDUCTION_VD, ">=1"}, + failOn = {"no_strict_order"}, + applyIfCPUFeatureOr = {"sve", "true", "sse2", "true"}, + phase = CompilePhase.PRINT_IDEAL) + private static void testAddReductionVD() { + double result = 1; + for (int i = 0; i < SIZE; i++) { + result += (da[i] + db[i]); + } + dresult += result; + } + + @Test + @IR(failOn = {IRNode.MUL_REDUCTION_VF}, + applyIfCPUFeatureAnd = {"asimd", "true", "sve", "false"}) + @IR(counts = {"requires_strict_order", ">=1", IRNode.MUL_REDUCTION_VF, ">=1"}, + failOn = {"no_strict_order"}, + applyIfCPUFeatureOr = {"sve", "true", "sse2", "true"}, + phase = CompilePhase.PRINT_IDEAL) + private static void testMulReductionVF() { + float result = 1; + for (int i = 0; i < SIZE; i++) { + result *= (fa[i] + fb[i]); + } + fresult += result; + } + + @Test + @IR(failOn = {IRNode.MUL_REDUCTION_VD}, + applyIfCPUFeatureAnd = {"asimd", "true", "sve", "false"}) + @IR(counts = {"requires_strict_order", ">=1", IRNode.MUL_REDUCTION_VD, ">=1"}, + failOn = {"no_strict_order"}, + applyIfCPUFeatureOr = {"sve", "true", "sse2", "true"}, + phase = CompilePhase.PRINT_IDEAL) + private static void testMulReductionVD() { + double result = 1; + for (int i = 0; i < SIZE; i++) { + result *= (da[i] + db[i]); + } + dresult += result; + } +} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java b/test/hotspot/jtreg/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java deleted file mode 100644 index ffe510a0f3246..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.rtm.cli; - -import jdk.test.lib.process.ExitCode; -import jdk.test.lib.Platform; -import jdk.test.lib.cli.CommandLineOptionTest; - -import java.util.function.BooleanSupplier; - -/** - * Base for all RTM-related CLI tests. - */ -public abstract class RTMGenericCommandLineOptionTest { - - protected static final String RTM_INSTR_ERROR - = "RTM instructions are not available on this CPU"; - protected static final String RTM_UNSUPPORTED_VM_ERROR - = "RTM locking optimization is not supported in this VM"; - protected static final String RTM_FOR_STACK_LOCKS_WARNING - = "UseRTMForStackLocks flag should be off when UseRTMLocking " - + "flag is off"; - protected static final String RTM_COUNT_INCR_WARNING - = "must be a power of 2, resetting it to 64"; - - protected final String optionName; - protected final String errorMessage; - protected final String experimentalOptionError; - protected final boolean isExperimental; - protected final boolean isBoolean; - protected final String defaultValue; - protected final String[] optionValues; - - /** - * Constructs new genetic RTM CLI test, for option {@code optionName} which - * has default value {@code defaultValue}. Test cases will use option's - * values passed via {@code optionValues} for verification of correct - * option processing. - * - * Test constructed using this ctor will be started on any cpu regardless - * it's architecture and supported/unsupported features. - * - * @param optionName name of option to be tested - * @param isBoolean {@code true} if option is binary - * @param isExperimental {@code true} if option is experimental - * @param defaultValue default value of tested option - * @param optionValues different option values - */ - public RTMGenericCommandLineOptionTest( - String optionName, boolean isBoolean, boolean isExperimental, - String defaultValue, String... optionValues) { - this.optionName = optionName; - this.isExperimental = isExperimental; - this.isBoolean = isBoolean; - this.defaultValue = defaultValue; - this.optionValues = optionValues; - this.errorMessage = CommandLineOptionTest. - getUnrecognizedOptionErrorMessage(optionName); - this.experimentalOptionError = CommandLineOptionTest. - getExperimentalOptionErrorMessage(optionName); - } - - public void runTestCases() throws Throwable { - if (Platform.isX86() || Platform.isX64()) { - if (Platform.isServer()) { - runX86SupportedVMTestCases(); - } else { - runX86UnsupportedVMTestCases(); - } - } else { - runNonX86TestCases(); - } - } - - /** - * Runs test cases on X86 CPU if VM supports RTM locking. - * @throws Throwable - */ - protected void runX86SupportedVMTestCases() throws Throwable { - runGenericX86TestCases(); - } - - /** - * Runs test cases on X86 CPU if VM does not support RTM locking. - * @throws Throwable - */ - protected void runX86UnsupportedVMTestCases() throws Throwable { - runGenericX86TestCases(); - } - - /** - * Runs test cases on non-X86 CPU. - * @throws Throwable - */ - protected void runNonX86TestCases() throws Throwable { - CommandLineOptionTest.verifySameJVMStartup( - new String[] { errorMessage }, null, - String.format("Option '%s' should be unknown on non-X86CPUs.%n" - + "JVM startup should fail", optionName), "", ExitCode.FAIL, - prepareOptionValue(defaultValue)); - } - - /** - * Runs generic X86 test cases. - * @throws Throwable - */ - protected void runGenericX86TestCases() throws Throwable { - verifyJVMStartup(); - verifyOptionValues(); - } - - protected void verifyJVMStartup() throws Throwable { - String optionValue = prepareOptionValue(defaultValue); - String shouldFailMessage = String.format("VM option '%s' is " - + "experimental.%nVM startup expected to fail without " - + "-XX:+UnlockExperimentalVMOptions option", optionName); - String shouldPassMessage = String.format("VM option '%s' is " - + "experimental%nVM startup should pass with " - + "-XX:+UnlockExperimentalVMOptions option", optionName); - if (isExperimental) { - // verify that option is experimental - CommandLineOptionTest.verifySameJVMStartup( - new String[] { experimentalOptionError }, - new String[] { errorMessage }, shouldFailMessage, - shouldFailMessage, ExitCode.FAIL, optionValue); - // verify that it could be passed if experimental options - // are unlocked - CommandLineOptionTest.verifySameJVMStartup(null, - new String[] { - experimentalOptionError, - errorMessage - }, - shouldPassMessage, - "JVM should start without any warnings or errors", - ExitCode.OK, - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - optionValue); - } else { - // verify that option could be passed - CommandLineOptionTest.verifySameJVMStartup(null, - new String[]{errorMessage}, - String.format("VM startup shuld pass with '%s' option", - optionName), - "JVM should start without any warnings or errors", - ExitCode.OK, optionValue); - } - } - - protected void verifyOptionValues() throws Throwable { - // verify default value - if (isExperimental) { - CommandLineOptionTest.verifyOptionValueForSameVM(optionName, - defaultValue, - String.format("Option '%s' is expected to have '%s' " - + "default value", optionName, defaultValue), - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS); - } else { - CommandLineOptionTest.verifyOptionValueForSameVM(optionName, - defaultValue, - String.format("Option '%s' is expected to have '%s' " - + "default value", optionName, defaultValue)); - } - // verify other specified option values - if (optionValues == null) { - return; - } - - for (String value : optionValues) { - if (isExperimental) { - CommandLineOptionTest.verifyOptionValueForSameVM(optionName, - value, - String.format("Option '%s' is set to have '%s' value", - optionName, value), - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - prepareOptionValue(value)); - } else { - CommandLineOptionTest.verifyOptionValueForSameVM(optionName, - value, - String.format("Option '%s' is set to have '%s' value", - optionName, value), prepareOptionValue(value)); - } - } - } - - protected String prepareOptionValue(String value) { - if (isBoolean) { - return CommandLineOptionTest.prepareBooleanFlag(optionName, - Boolean.valueOf(value)); - } else { - return String.format("-XX:%s=%s", optionName, value); - } - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/RTMLockingAwareTest.java b/test/hotspot/jtreg/compiler/rtm/cli/RTMLockingAwareTest.java deleted file mode 100644 index 394d73e2283ec..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/RTMLockingAwareTest.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.rtm.cli; - -import jdk.test.lib.process.ExitCode; -import jdk.test.lib.cli.CommandLineOptionTest; - -import java.util.LinkedList; -import java.util.List; - -/** - * Base for all RTM-related CLI tests on options whose processing depends - * on UseRTMLocking value. - * - * Since UseRTMLocking option could be used when both CPU and VM supports RTM - * locking, this test will be skipped on all unsupported configurations. - */ -public abstract class RTMLockingAwareTest - extends RTMGenericCommandLineOptionTest { - protected final String warningMessage; - protected final String[] correctValues; - protected final String[] incorrectValues; - /** - * Constructs new test for option {@code optionName} that should be executed - * only on CPU with RTM support. - * Test will be executed using set of correct values from - * {@code correctValues} and set of incorrect values from - * {@code incorrectValues}. - * - * @param optionName name of option to be tested - * @param isBoolean {@code true} if tested option is binary - * @param isExperimental {@code true} if tested option is experimental - * @param defaultValue default value of tested option - * @param correctValues array with correct values, that should not emit - * {@code warningMessage} to VM output - * @param incorrectValues array with incorrect values, that should emit - * {@code waningMessage} to VM output - * @param warningMessage warning message associated with tested option - */ - protected RTMLockingAwareTest(String optionName, boolean isBoolean, - boolean isExperimental, String defaultValue, - String[] correctValues, String[] incorrectValues, - String warningMessage) { - super(optionName, isBoolean, isExperimental, defaultValue); - this.correctValues = correctValues; - this.incorrectValues = incorrectValues; - this.warningMessage = warningMessage; - } - - @Override - protected void verifyJVMStartup() throws Throwable { - // Run generic sanity checks - super.verifyJVMStartup(); - // Verify how option values will be processed depending on - // UseRTMLocking value. - if (correctValues != null) { - for (String correctValue : correctValues) { - // For correct values it is expected to see no warnings - // regardless to UseRTMLocking - verifyStartupWarning(correctValue, true, false); - verifyStartupWarning(correctValue, false, false); - } - } - - if (incorrectValues != null) { - for (String incorrectValue : incorrectValues) { - // For incorrect values it is expected to see warning - // only with -XX:+UseRTMLocking - verifyStartupWarning(incorrectValue, true, true); - verifyStartupWarning(incorrectValue, false, false); - } - } - } - - @Override - protected void verifyOptionValues() throws Throwable { - super.verifyOptionValues(); - // Verify how option values will be setup after processing - // depending on UseRTMLocking value - if (correctValues != null) { - for (String correctValue : correctValues) { - // Correct value could be set up regardless to UseRTMLocking - verifyOptionValues(correctValue, false, correctValue); - verifyOptionValues(correctValue, true, correctValue); - } - } - - if (incorrectValues != null) { - for (String incorrectValue : incorrectValues) { - // With -XX:+UseRTMLocking, incorrect value will be changed to - // default value. - verifyOptionValues(incorrectValue, false, incorrectValue); - verifyOptionValues(incorrectValue, true, defaultValue); - } - } - } - - private void verifyStartupWarning(String value, boolean useRTMLocking, - boolean isWarningExpected) throws Throwable { - String warnings[] = new String[] { warningMessage }; - List<String> options = new LinkedList<>(); - options.add(CommandLineOptionTest.prepareBooleanFlag("UseRTMLocking", - useRTMLocking)); - - if (isExperimental) { - options.add(CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS); - } - options.add(prepareOptionValue(value)); - - String errorString = String.format("JVM should start with option '%s'" - + "'%nWarnings should be shown: %s", optionName, - isWarningExpected); - CommandLineOptionTest.verifySameJVMStartup( - (isWarningExpected ? warnings : null), - (isWarningExpected ? null : warnings), - errorString, errorString, ExitCode.OK, - options.toArray(new String[options.size()])); - } - - private void verifyOptionValues(String value, boolean useRTMLocking, - String expectedValue) throws Throwable { - List<String> options = new LinkedList<>(); - options.add(CommandLineOptionTest.prepareBooleanFlag("UseRTMLocking", - useRTMLocking)); - - if (isExperimental) { - options.add(CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS); - } - options.add(prepareOptionValue(value)); - - CommandLineOptionTest.verifyOptionValueForSameVM(optionName, - expectedValue, String.format("Option '%s' should have '%s' " - + "value if '%s' flag set", - optionName, expectedValue, prepareOptionValue(value)), - options.toArray(new String[options.size()])); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java b/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java deleted file mode 100644 index 8cf3149904776..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.rtm.cli; - -import jdk.test.lib.process.ExitCode; -import jdk.test.lib.Platform; -import jdk.test.lib.cli.CommandLineOptionTest; - -public abstract class TestPrintPreciseRTMLockingStatisticsBase - extends RTMGenericCommandLineOptionTest { - protected static final String DEFAULT_VALUE = "false"; - - protected TestPrintPreciseRTMLockingStatisticsBase() { - super("PrintPreciseRTMLockingStatistics", true, false, - TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE); - } - - @Override - protected void runNonX86TestCases() throws Throwable { - verifyJVMStartup(); - verifyOptionValues(); - } - - @Override - protected void verifyJVMStartup() throws Throwable { - if (Platform.isServer()) { - if (!Platform.isDebugBuild()) { - String shouldFailMessage = String.format("VM option '%s' is " - + "diagnostic%nJVM startup should fail without " - + "-XX:\\+UnlockDiagnosticVMOptions flag", optionName); - String shouldPassMessage = String.format("VM option '%s' is " - + "diagnostic%nJVM startup should pass with " - + "-XX:\\+UnlockDiagnosticVMOptions in debug build", - optionName); - String errorMessage = CommandLineOptionTest. - getDiagnosticOptionErrorMessage(optionName); - // verify that option is actually diagnostic - CommandLineOptionTest.verifySameJVMStartup( - new String[] { errorMessage }, null, shouldFailMessage, - shouldFailMessage, ExitCode.FAIL, - prepareOptionValue("true")); - - CommandLineOptionTest.verifySameJVMStartup(null, - new String[] { errorMessage }, shouldPassMessage, - shouldPassMessage + "without any warnings", ExitCode.OK, - CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS, - prepareOptionValue("true")); - } else { - String shouldPassMessage = String.format("JVM startup should " - + "pass with '%s' option in debug build", - optionName); - CommandLineOptionTest.verifySameJVMStartup(null, null, - shouldPassMessage, shouldPassMessage, - ExitCode.OK, prepareOptionValue("true")); - } - } else { - String errorMessage = CommandLineOptionTest. - getUnrecognizedOptionErrorMessage(optionName); - String shouldFailMessage = String.format("JVM startup should fail" - + " with '%s' option in not debug build", optionName); - CommandLineOptionTest.verifySameJVMStartup( - new String[]{errorMessage}, null, shouldFailMessage, - shouldFailMessage, ExitCode.FAIL, - CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS, - prepareOptionValue("true")); - } - } - - @Override - protected void verifyOptionValues() throws Throwable { - if (Platform.isServer()) { - // Verify default value - CommandLineOptionTest.verifyOptionValueForSameVM(optionName, - TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE, - String.format("Option '%s' should have '%s' default value", - optionName, - TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE), - CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS); - } - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java deleted file mode 100644 index b4a71cd21b6d3..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify PrintPreciseRTMLockingStatistics on CPUs and OSs with - * rtm support and on VM with rtm locking support, - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires vm.rtm.cpu & vm.rtm.compiler - * @run driver compiler.rtm.cli.TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig - */ - -package compiler.rtm.cli; - -import jdk.test.lib.cli.CommandLineOptionTest; - -public class TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig - extends TestPrintPreciseRTMLockingStatisticsBase { - - @Override - protected void verifyOptionValues() throws Throwable { - super.verifyOptionValues(); - // verify default value - CommandLineOptionTest.verifyOptionValueForSameVM(optionName, - TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE, - String.format("Option '%s' should have '%s' default value on" - + " supported CPU", optionName, - TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE), - CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS, - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:+UseRTMLocking"); - - CommandLineOptionTest.verifyOptionValueForSameVM(optionName, - TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE, - String.format("Option '%s' should have '%s' default value on" - + " supported CPU when -XX:-UseRTMLocking flag set", - optionName, - TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE), - CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS, - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:-UseRTMLocking", prepareOptionValue("true")); - - // verify that option could be turned on - CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true", - String.format("Option '%s' should have 'true' value when set " - + "on supported CPU and -XX:+UseRTMLocking flag set", - optionName), - CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS, - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:+UseRTMLocking", prepareOptionValue("true")); - } - - public static void main(String args[]) throws Throwable { - new TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig() - .runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java deleted file mode 100644 index 274c335363743..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify PrintPreciseRTMLockingStatistics on CPUs or OSs without - * rtm support and/or unsupported VM. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires !vm.rtm.cpu & vm.rtm.compiler - * @run driver compiler.rtm.cli.TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig - */ - -package compiler.rtm.cli; - -public class TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig - extends TestPrintPreciseRTMLockingStatisticsBase { - - public static void main(String args[]) throws Throwable { - new TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig() - .runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMAbortThresholdOption.java b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMAbortThresholdOption.java deleted file mode 100644 index 54690fec69181..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMAbortThresholdOption.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify processing of RTMAbortThreshold option. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires vm.rtm.compiler - * @run driver compiler.rtm.cli.TestRTMAbortThresholdOption - */ - -package compiler.rtm.cli; - -public class TestRTMAbortThresholdOption - extends RTMGenericCommandLineOptionTest { - private static final String DEFAULT_VALUE = "1000"; - - private TestRTMAbortThresholdOption() { - super("RTMAbortThreshold", false, true, - TestRTMAbortThresholdOption.DEFAULT_VALUE, - "0", "42", "100", "10000"); - } - - public static void main(String args[]) throws Throwable { - new TestRTMAbortThresholdOption().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java deleted file mode 100644 index bc6185f62b05c..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify processing of RTMLockingCalculationDelay option. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires vm.rtm.compiler - * @run driver compiler.rtm.cli.TestRTMLockingCalculationDelayOption - */ - -package compiler.rtm.cli; - -public class TestRTMLockingCalculationDelayOption - extends RTMGenericCommandLineOptionTest { - private static final String DEFAULT_VALUE = "0"; - - private TestRTMLockingCalculationDelayOption() { - super("RTMLockingCalculationDelay", false, - true, TestRTMLockingCalculationDelayOption.DEFAULT_VALUE); - } - - public static void main(String agrs[]) throws Throwable { - new TestRTMLockingCalculationDelayOption().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingThresholdOption.java b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingThresholdOption.java deleted file mode 100644 index 0eb0cc24dc42c..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingThresholdOption.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify processing of RTMLockingThreshold option. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires vm.rtm.compiler - * @run driver compiler.rtm.cli.TestRTMLockingThresholdOption - */ - -package compiler.rtm.cli; - -public class TestRTMLockingThresholdOption - extends RTMGenericCommandLineOptionTest { - private static final String DEFAULT_VALUE = "10000"; - - private TestRTMLockingThresholdOption() { - super("RTMLockingThreshold", false, true, - TestRTMLockingThresholdOption.DEFAULT_VALUE); - } - - public static void main(String args[]) throws Throwable { - new TestRTMLockingThresholdOption().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMRetryCountOption.java b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMRetryCountOption.java deleted file mode 100644 index 79e32af0e52e3..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMRetryCountOption.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify processing of RTMRetryCount option. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires vm.rtm.compiler - * @run driver compiler.rtm.cli.TestRTMRetryCountOption - */ - -package compiler.rtm.cli; - -public class TestRTMRetryCountOption extends RTMGenericCommandLineOptionTest { - private static final String DEFAULT_VALUE = "5"; - - private TestRTMRetryCountOption() { - super("RTMRetryCount", false, false, - TestRTMRetryCountOption.DEFAULT_VALUE, - "0", "10", "100", "1000"); - } - - public static void main(String args[]) throws Throwable { - new TestRTMRetryCountOption().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMSpinLoopCountOption.java b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMSpinLoopCountOption.java deleted file mode 100644 index e138b3372ff6a..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMSpinLoopCountOption.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify processing of RTMSpinLoopCount option. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires vm.rtm.compiler - * @run driver compiler.rtm.cli.TestRTMSpinLoopCountOption - */ - -package compiler.rtm.cli; - -public class TestRTMSpinLoopCountOption - extends RTMGenericCommandLineOptionTest { - private static final String DEFAULT_VALUE = "100"; - - private TestRTMSpinLoopCountOption() { - super("RTMSpinLoopCount", false, true, - TestRTMSpinLoopCountOption.DEFAULT_VALUE, - "0", "10", "42", "1000"); - } - - public static void main(String args[]) throws Throwable { - new TestRTMSpinLoopCountOption().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java deleted file mode 100644 index 929838dad060b..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify RTMTotalCountIncrRate option processing on CPU and OS with - * rtm support and on VM with rtm locking support. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires vm.rtm.cpu & vm.rtm.compiler - * @run driver compiler.rtm.cli.TestRTMTotalCountIncrRateOptionOnSupportedConfig - */ - -package compiler.rtm.cli; - -public class TestRTMTotalCountIncrRateOptionOnSupportedConfig - extends RTMLockingAwareTest { - private static final String DEFAULT_VALUE = "64"; - - private TestRTMTotalCountIncrRateOptionOnSupportedConfig() { - super("RTMTotalCountIncrRate", false, true, - TestRTMTotalCountIncrRateOptionOnSupportedConfig.DEFAULT_VALUE, - /* correct values */ - new String[] { "1", "2", "128", "1024" }, - /* incorrect values */ - new String[] { "3", "5", "7", "42" }, - RTMGenericCommandLineOptionTest.RTM_COUNT_INCR_WARNING); - } - - public static void main(String args[]) throws Throwable { - new TestRTMTotalCountIncrRateOptionOnSupportedConfig().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java deleted file mode 100644 index cc9f93165d029..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify UseRTMDeopt option processing on CPUs with rtm support - * when rtm locking is supported by VM. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires vm.rtm.cpu & vm.rtm.compiler - * @run driver compiler.rtm.cli.TestUseRTMDeoptOptionOnSupportedConfig - */ - -package compiler.rtm.cli; - -import jdk.test.lib.process.ExitCode; -import jdk.test.lib.cli.CommandLineOptionTest; - -public class TestUseRTMDeoptOptionOnSupportedConfig { - private static final String DEFAULT_VALUE = "false"; - - public void runTestCases() throws Throwable { - String shouldPassMessage = " JVM should startup with option '" - + "-XX:+UseRTMDeopt' without any warnings"; - // verify that option could be turned on - CommandLineOptionTest.verifySameJVMStartup( - null, null, shouldPassMessage, shouldPassMessage, ExitCode.OK, - "-XX:+UseRTMDeopt"); - shouldPassMessage = " JVM should startup with option '" - + "-XX:-UseRTMDeopt' without any warnings"; - // verify that option could be turned off - CommandLineOptionTest.verifySameJVMStartup( - null, null, shouldPassMessage, shouldPassMessage, ExitCode.OK, - "-XX:-UseRTMDeopt"); - String defValMessage = String.format("UseRTMDeopt should have '%s'" - + "default value", - TestUseRTMDeoptOptionOnSupportedConfig.DEFAULT_VALUE); - // verify default value - CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt", - TestUseRTMDeoptOptionOnSupportedConfig.DEFAULT_VALUE, - defValMessage); - // verify default value - CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt", - TestUseRTMDeoptOptionOnSupportedConfig.DEFAULT_VALUE, - defValMessage, - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:+UseRTMLocking"); - // verify that option is off when UseRTMLocking is off - CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt", - "false", "UseRTMDeopt should be off when UseRTMLocking is off", - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:-UseRTMLocking", "-XX:+UseRTMDeopt"); - // verify that option could be turned on - CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt", "true", - "UseRTMDeopt should be on when UseRTMLocking is on and " - + "'-XX:+UseRTMDeopt' flag set", - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:+UseRTMLocking", "-XX:+UseRTMDeopt"); - } - - public static void main(String args[]) throws Throwable { - new TestUseRTMDeoptOptionOnSupportedConfig().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java deleted file mode 100644 index b018e8d078f6f..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify UseRTMDeopt option processing on CPUs or OSs without rtm support - * or on VMs without rtm locking support. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires !vm.rtm.cpu & vm.rtm.compiler - * @run driver compiler.rtm.cli.TestUseRTMDeoptOptionOnUnsupportedConfig - */ - -package compiler.rtm.cli; - -import jdk.test.lib.cli.CommandLineOptionTest; - -public class TestUseRTMDeoptOptionOnUnsupportedConfig - extends RTMGenericCommandLineOptionTest { - private static final String DEFAULT_VALUE = "false"; - - private TestUseRTMDeoptOptionOnUnsupportedConfig() { - super("UseRTMDeopt", true, false, - TestUseRTMDeoptOptionOnUnsupportedConfig.DEFAULT_VALUE, - "true"); - } - - @Override - protected void runX86SupportedVMTestCases() throws Throwable { - super.verifyJVMStartup(); - // verify default value - CommandLineOptionTest.verifyOptionValueForSameVM(optionName, - defaultValue, String.format("'%s' should have '%s' " - + "default value on unsupported configs.", - optionName, DEFAULT_VALUE)); - // verify that until RTMLocking is not used, value - // will be set to default false. - CommandLineOptionTest.verifyOptionValueForSameVM(optionName, - defaultValue, String.format("'%s' should be off on unsupported" - + " configs even if '-XX:+%s' flag set", optionName, - optionName), - "-XX:+UseRTMDeopt"); - } - - public static void main(String args[]) throws Throwable { - new TestUseRTMDeoptOptionOnUnsupportedConfig().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java deleted file mode 100644 index 37d8a6bcaaa48..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify UseRTMForStackLocks option processing on CPU and OS with - * rtm support when VM supports rtm locking. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires vm.rtm.cpu & vm.rtm.compiler - * @run driver compiler.rtm.cli.TestUseRTMForStackLocksOptionOnSupportedConfig - */ - -package compiler.rtm.cli; - -import jdk.test.lib.process.ExitCode; -import jdk.test.lib.cli.CommandLineOptionTest; - -public class TestUseRTMForStackLocksOptionOnSupportedConfig { - private static final String DEFAULT_VALUE = "false"; - - public void runTestCases() throws Throwable { - String errorMessage - = CommandLineOptionTest.getExperimentalOptionErrorMessage( - "UseRTMForStackLocks"); - String warningMessage - = RTMGenericCommandLineOptionTest.RTM_FOR_STACK_LOCKS_WARNING; - - String shouldFailMessage = " VM option 'UseRTMForStackLocks' is " - + "experimental%nJVM startup should fail without " - + "-XX:+UnlockExperimentalVMOptions flag"; - - CommandLineOptionTest.verifySameJVMStartup( - new String[] { errorMessage }, null, shouldFailMessage, - shouldFailMessage + "%nError message expected", ExitCode.FAIL, - "-XX:+UseRTMForStackLocks"); - String shouldPassMessage = " VM option 'UseRTMForStackLocks'" - + " is experimental%nJVM startup should pass with " - + "-XX:+UnlockExperimentalVMOptions flag"; - // verify that we get a warning when trying to use rtm for stack - // lock, but not using rtm locking. - CommandLineOptionTest.verifySameJVMStartup( - new String[] { warningMessage }, null, shouldPassMessage, - "There should be warning when trying to use rtm for stack " - + "lock, but not using rtm locking", ExitCode.OK, - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:+UseRTMForStackLocks", - "-XX:-UseRTMLocking"); - // verify that we don't get a warning when no using rtm for stack - // lock and not using rtm locking. - CommandLineOptionTest.verifySameJVMStartup(null, - new String[] { warningMessage }, shouldPassMessage, - "There should not be any warning when use both " - + "-XX:-UseRTMForStackLocks and -XX:-UseRTMLocking " - + "flags", - ExitCode.OK, - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:-UseRTMForStackLocks", - "-XX:-UseRTMLocking"); - // verify that we don't get a warning when using rtm for stack - // lock and using rtm locking. - CommandLineOptionTest.verifySameJVMStartup(null, - new String[] { warningMessage }, shouldPassMessage, - "There should not be any warning when use both " - + "-XX:+UseRTMForStackLocks and -XX:+UseRTMLocking" - + " flags", - ExitCode.OK, - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:+UseRTMForStackLocks", - "-XX:+UseRTMLocking"); - // verify that default value if false - CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks", - TestUseRTMForStackLocksOptionOnSupportedConfig.DEFAULT_VALUE, - "Default value of option 'UseRTMForStackLocks' should be false", - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS); - // verify that default value is false even with +UseRTMLocking - CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks", - TestUseRTMForStackLocksOptionOnSupportedConfig.DEFAULT_VALUE, - "Default value of option 'UseRTMForStackLocks' should be false", - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:+UseRTMLocking"); - // verify that we can turn the option on - CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks", - "true", "Value of option 'UseRTMForStackLocks' should " - + "be able to be set as 'true' when both " - + "-XX:+UseRTMForStackLocks and " - + "-XX:+UseRTMLocking flags used", - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:+UseRTMLocking", "-XX:+UseRTMForStackLocks"); - } - - public static void main(String args[]) throws Throwable { - new TestUseRTMForStackLocksOptionOnSupportedConfig().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java deleted file mode 100644 index 13159dbd8955e..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify UseRTMForStackLocks option processing on CPUs or OSs without - * rtm support and/or on VMs without rtm locking support. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires !vm.rtm.cpu & vm.rtm.compiler - * @run driver compiler.rtm.cli.TestUseRTMForStackLocksOptionOnUnsupportedConfig - */ - -package compiler.rtm.cli; - -import jdk.test.lib.process.ExitCode; -import jdk.test.lib.cli.CommandLineOptionTest; - -public class TestUseRTMForStackLocksOptionOnUnsupportedConfig - extends RTMGenericCommandLineOptionTest { - private static final String DEFAULT_VALUE = "false"; - - private TestUseRTMForStackLocksOptionOnUnsupportedConfig() { - super("UseRTMForStackLocks", true, true, - TestUseRTMForStackLocksOptionOnUnsupportedConfig.DEFAULT_VALUE, - "true"); - } - - @Override - protected void runX86SupportedVMTestCases() throws Throwable { - String shouldFailMessage = String.format("VM option '%s' is " - + "experimental%nJVM startup should fail without " - + "-XX:+UnlockExperimentalVMOptions flag", optionName); - - // verify that option is experimental - CommandLineOptionTest.verifySameJVMStartup( - new String[] { experimentalOptionError }, null, - shouldFailMessage, shouldFailMessage + "%nError message " - + "should be shown", ExitCode.FAIL, - prepareOptionValue("true")); - - CommandLineOptionTest.verifySameJVMStartup( - new String[]{ experimentalOptionError }, null, - shouldFailMessage, shouldFailMessage + "%nError message " - + "should be shown", ExitCode.FAIL, - prepareOptionValue("false")); - - String shouldPassMessage = String.format("VM option '%s' is " - + " experimental%nJVM startup should pass with " - + "-XX:+UnlockExperimentalVMOptions flag", optionName); - // verify that if we turn it on, then VM output will contain - // warning saying that this option could be turned on only - // when we use rtm locking - CommandLineOptionTest.verifySameJVMStartup( - new String[]{ - RTMGenericCommandLineOptionTest.RTM_FOR_STACK_LOCKS_WARNING - }, null, shouldPassMessage, "There should be warning when try " - + "to use rtm for stack lock, but not using rtm locking", - ExitCode.OK, - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - prepareOptionValue("true") - ); - // verify that options is turned off by default - CommandLineOptionTest.verifyOptionValueForSameVM(optionName, - TestUseRTMForStackLocksOptionOnUnsupportedConfig.DEFAULT_VALUE, - String.format("Default value of option '%s' should be '%s'", - optionName, DEFAULT_VALUE), - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS); - // verify that it could not be turned on without rtm locking - CommandLineOptionTest.verifyOptionValueForSameVM(optionName, - TestUseRTMForStackLocksOptionOnUnsupportedConfig.DEFAULT_VALUE, - String.format("Value of '%s' shouldn't able to be set to " - + "'true' without setting -XX:+UseRTMLocking flag", - optionName), - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - prepareOptionValue("true")); - } - - public static void main(String args[]) throws Throwable { - new TestUseRTMForStackLocksOptionOnUnsupportedConfig().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java deleted file mode 100644 index ff0a7623da0e5..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify UseRTMLocking option processing on CPU and OS with rtm support and - * on VM with rtm locking support. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires vm.rtm.cpu & vm.rtm.compiler - * @run driver compiler.rtm.cli.TestUseRTMLockingOptionOnSupportedConfig - */ - -package compiler.rtm.cli; - -import jdk.test.lib.process.ExitCode; -import jdk.test.lib.cli.CommandLineOptionTest; - -public class TestUseRTMLockingOptionOnSupportedConfig { - private static final String DEFAULT_VALUE = "false"; - - public void runTestCases() throws Throwable { - String unrecongnizedOption - = CommandLineOptionTest.getUnrecognizedOptionErrorMessage( - "UseRTMLocking"); - String shouldPassMessage = "VM option 'UseRTMLocking' is experimental" - + "%nJVM startup should pass with " - + "-XX:+UnlockExperimentalVMOptions flag"; - // verify that there are no warning or error in VM output - CommandLineOptionTest.verifySameJVMStartup(null, - new String[]{ - RTMGenericCommandLineOptionTest.RTM_INSTR_ERROR, - unrecongnizedOption - }, shouldPassMessage, "There should not be any warning when use" - + "with -XX:+UnlockExperimentalVMOptions", ExitCode.OK, - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:+UseRTMLocking" - ); - - CommandLineOptionTest.verifySameJVMStartup(null, - new String[]{ - RTMGenericCommandLineOptionTest.RTM_INSTR_ERROR, - unrecongnizedOption - }, shouldPassMessage, "There should not be any warning when use" - + "with -XX:+UnlockExperimentalVMOptions", ExitCode.OK, - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:-UseRTMLocking" - ); - // verify that UseRTMLocking is of by default - CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking", - TestUseRTMLockingOptionOnSupportedConfig.DEFAULT_VALUE, - String.format("Default value of option 'UseRTMLocking' should " - + "be '%s'", DEFAULT_VALUE), - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS); - // verify that we can change UseRTMLocking value - CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking", - TestUseRTMLockingOptionOnSupportedConfig.DEFAULT_VALUE, - String.format("Default value of option 'UseRTMLocking' should " - + "be '%s'", DEFAULT_VALUE), - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:-UseRTMLocking"); - CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking", - "true", "Value of 'UseRTMLocking' should be set " - + "to 'true' if -XX:+UseRTMLocking flag set", - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-XX:+UseRTMLocking"); - } - - public static void main(String args[]) throws Throwable { - new TestUseRTMLockingOptionOnSupportedConfig().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java deleted file mode 100644 index 973c5cccbd96a..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify UseRTMLocking option processing on CPUs without - * rtm support. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires !vm.rtm.cpu & vm.rtm.compiler - * @run driver compiler.rtm.cli.TestUseRTMLockingOptionOnUnsupportedCPU - */ - -package compiler.rtm.cli; - -import jdk.test.lib.process.ExitCode; -import jdk.test.lib.Platform; -import jdk.test.lib.cli.CommandLineOptionTest; - -public class TestUseRTMLockingOptionOnUnsupportedCPU { - private static final String DEFAULT_VALUE = "false"; - - public void runTestCases() throws Throwable { - String unrecognizedOption - = CommandLineOptionTest.getUnrecognizedOptionErrorMessage( - "UseRTMLocking"); - String errorMessage = RTMGenericCommandLineOptionTest.RTM_INSTR_ERROR; - - if (Platform.isX86() || Platform.isX64()) { - String shouldFailMessage = "JVM startup should fail with option " + - "-XX:+UseRTMLocking on unsupported CPU"; - - // verify that we get an error when use +UseRTMLocking - // on unsupported CPU - CommandLineOptionTest.verifySameJVMStartup( - new String[] { errorMessage }, - new String[] { unrecognizedOption }, shouldFailMessage, - shouldFailMessage + ". Error message should be shown.", - ExitCode.FAIL, "-XX:+UseRTMLocking"); - - String shouldPassMessage = "JVM startup should pass with option " - + "-XX:-UseRTMLocking even on unsupported CPU"; - // verify that we can pass -UseRTMLocking without - // getting any error messages - CommandLineOptionTest.verifySameJVMStartup(null, new String[] { - errorMessage, unrecognizedOption }, shouldPassMessage, - shouldPassMessage + " without any warnings", ExitCode.OK, - "-XX:-UseRTMLocking"); - - // verify that UseRTMLocking is false by default - CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking", - TestUseRTMLockingOptionOnUnsupportedCPU.DEFAULT_VALUE, - String.format("Default value of option 'UseRTMLocking' " - +"should be '%s'", DEFAULT_VALUE)); - } else { - String shouldFailMessage = "RTMLocking should be unrecognized" - + " on non-x86 CPUs. JVM startup should fail." - + "Error message should be shown"; - // verify that on non-x86 CPUs RTMLocking could not be used - CommandLineOptionTest.verifySameJVMStartup( - new String[] { unrecognizedOption }, - null, shouldFailMessage, shouldFailMessage, - ExitCode.FAIL, "-XX:+UseRTMLocking"); - - CommandLineOptionTest.verifySameJVMStartup( - new String[] { unrecognizedOption }, - null, shouldFailMessage, shouldFailMessage, - ExitCode.FAIL, "-XX:-UseRTMLocking"); - } - } - - public static void main(String args[]) throws Throwable { - new TestUseRTMLockingOptionOnUnsupportedCPU().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java deleted file mode 100644 index a26b8ffbad57c..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify UseRTMLocking option processing on CPU with rtm support - * in case when VM should not support this option. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires vm.rtm.cpu & !(vm.flavor == "server" & !vm.emulatedClient) - * @run driver compiler.rtm.cli.TestUseRTMLockingOptionOnUnsupportedVM - */ - -package compiler.rtm.cli; - -import jdk.test.lib.process.ExitCode; -import jdk.test.lib.cli.CommandLineOptionTest; - -public class TestUseRTMLockingOptionOnUnsupportedVM { - private static final String DEFAULT_VALUE = "false"; - - public void runTestCases() throws Throwable { - String errorMessage - = RTMGenericCommandLineOptionTest.RTM_UNSUPPORTED_VM_ERROR; - String shouldFailMessage = "JVM startup should fail with option " - + "-XX:+UseRTMLocking even on unsupported VM. Error message" - + " should be shown"; - String shouldPassMessage = "JVM startup should pass with option " - + "-XX:-UseRTMLocking even on unsupported VM"; - // verify that we can't use +UseRTMLocking - CommandLineOptionTest.verifySameJVMStartup( - new String[] { errorMessage }, null, shouldFailMessage, - shouldFailMessage, ExitCode.FAIL, - "-XX:+UseRTMLocking"); - // verify that we can turn it off - CommandLineOptionTest.verifySameJVMStartup(null, - new String[] { errorMessage }, shouldPassMessage, - shouldPassMessage + " without any warnings", ExitCode.OK, - "-XX:-UseRTMLocking"); - // verify that it is off by default - CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking", - TestUseRTMLockingOptionOnUnsupportedVM.DEFAULT_VALUE, - String.format("Default value of option 'UseRTMLocking' should" - + " be '%s'", DEFAULT_VALUE)); - } - - public static void main(String args[]) throws Throwable { - new TestUseRTMLockingOptionOnUnsupportedVM().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java deleted file mode 100644 index d38bf0a7f2ba7..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify processing of UseRTMXendForLockBusy option. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.flagless - * @requires vm.rtm.compiler - * @run driver compiler.rtm.cli.TestUseRTMXendForLockBusyOption - */ - -package compiler.rtm.cli; - -public class TestUseRTMXendForLockBusyOption - extends RTMGenericCommandLineOptionTest { - private static final String DEFAULT_VALUE = "true"; - - public TestUseRTMXendForLockBusyOption() { - super("UseRTMXendForLockBusy", true, true, - TestUseRTMXendForLockBusyOption.DEFAULT_VALUE, "true"); - } - - public static void main(String agrs[]) throws Throwable { - new TestUseRTMXendForLockBusyOption().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortRatio.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortRatio.java deleted file mode 100644 index 20713301da57b..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortRatio.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that RTMAbortRatio affects amount of aborts before - * deoptimization. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestRTMAbortRatio - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.XAbortProvoker; -import compiler.testlibrary.rtm.CompilableTest; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.cli.CommandLineOptionTest; - -import java.util.List; - -/** - * Test verifies that method will be deoptimized on high abort ratio - * as soon as abort ratio reaches RTMAbortRatio's value. - */ -public class TestRTMAbortRatio { - - protected void runTestCases() throws Throwable { - verifyAbortRatio(0, false); - verifyAbortRatio(10, false); - verifyAbortRatio(50, false); - verifyAbortRatio(100, false); - - verifyAbortRatio(0, true); - verifyAbortRatio(10, true); - verifyAbortRatio(50, true); - verifyAbortRatio(100, true); - } - - private void verifyAbortRatio(int abortRatio, boolean useStackLock) - throws Throwable { - CompilableTest test = new Test(); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - test, - CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks", - useStackLock), - "-XX:+UseRTMDeopt", - "-XX:RTMTotalCountIncrRate=1", - "-XX:RTMAbortThreshold=0", - CommandLineOptionTest.prepareNumericFlag("RTMLockingThreshold", - 10 * Test.TOTAL_ITERATIONS), - CommandLineOptionTest.prepareNumericFlag("RTMAbortRatio", - abortRatio), - "-XX:+PrintPreciseRTMLockingStatistics", - test.getClass().getName(), - Boolean.toString(!useStackLock)); - - outputAnalyzer.shouldHaveExitValue(0); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - test.getMethodWithLockName(), outputAnalyzer.getOutput()); - - Asserts.assertEQ(statistics.size(), 1, "VM output should contain " - + "exactly one RTM locking statistics entry."); - - RTMLockingStatistics lock = statistics.get(0); - int actualRatio; - - if (lock.getTotalAborts() == 1L) { - actualRatio = 0; - } else { - actualRatio = (int) (lock.getTotalLocks() - / (lock.getTotalAborts() - 1L)); - } - - Asserts.assertLTE(actualRatio, abortRatio, String.format( - "Actual abort ratio (%d) should lower or equal to " - + "specified (%d).", actualRatio, abortRatio)); - } - - /** - * Force abort after {@code Test.WARMUP_ITERATIONS} is done. - */ - public static class Test implements CompilableTest { - private static final int TOTAL_ITERATIONS = 10000; - private static final int WARMUP_ITERATIONS = 1000; - private final XAbortProvoker xabort = new XAbortProvoker(); - private final Object monitor = new Object(); - // Following field have to be static in order to avoid escape analysis. - @SuppressWarnings("UnsuedDeclaration") - private static int field = 0; - - @Override - public String getMethodWithLockName() { - return this.getClass().getName() + "::lock"; - } - - @Override - public String[] getMethodsToCompileNames() { - return new String[] { getMethodWithLockName(), "*.doAbort" }; - } - - public void lock(boolean abort) { - synchronized(monitor) { - if (abort) { - xabort.doAbort(); - } - } - } - - /** - * Usage: - * Test <inflate monitor> - */ - public static void main(String args[]) throws Throwable { - Asserts.assertGTE(args.length, 1, "One argument required."); - Test t = new Test(); - boolean shouldBeInflated = Boolean.valueOf(args[0]); - if (shouldBeInflated) { - AbortProvoker.inflateMonitor(t.monitor); - } - for (int i = 0; i < Test.TOTAL_ITERATIONS; i++) { - AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated); - t.lock(i >= Test.WARMUP_ITERATIONS); - } - } - } - - public static void main(String args[]) throws Throwable { - new TestRTMAbortRatio().runTestCases(); - } -} - diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortThreshold.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortThreshold.java deleted file mode 100644 index 4eddead8e5e22..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortThreshold.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that RTMAbortThreshold option affects - * amount of aborts after which abort ratio is calculated. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestRTMAbortThreshold - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.AbortType; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.cli.CommandLineOptionTest; - -import java.util.List; - -/** - * Test verifies that on RTMAbortThreshold option actually affects how soon - * method will be deoptimized on high abort ratio. - */ -public class TestRTMAbortThreshold { - - protected void runTestCases() throws Throwable { - verifyAbortThreshold(false, 1); - verifyAbortThreshold(false, 10); - verifyAbortThreshold(false, 1000); - - verifyAbortThreshold(true, 1); - verifyAbortThreshold(true, 10); - verifyAbortThreshold(true, 1000); - } - - private void verifyAbortThreshold(boolean useStackLock, - long abortThreshold) throws Throwable { - AbortProvoker provoker = AbortType.XABORT.provoker(); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - provoker, - "-XX:+UseRTMDeopt", - "-XX:RTMAbortRatio=0", - CommandLineOptionTest.prepareNumericFlag("RTMAbortThreshold", - abortThreshold), - CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks", - useStackLock), - "-XX:RTMTotalCountIncrRate=1", - "-XX:+PrintPreciseRTMLockingStatistics", - AbortProvoker.class.getName(), - AbortType.XABORT.toString(), - Boolean.toString(!useStackLock)); - - outputAnalyzer.shouldHaveExitValue(0); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - provoker.getMethodWithLockName(), outputAnalyzer.getOutput()); - - Asserts.assertEQ(statistics.size(), 1, "VM output should contain " - + "exactly one RTM locking statistics entry for method " - + provoker.getMethodWithLockName()); - - Asserts.assertEQ(statistics.get(0).getTotalLocks(), abortThreshold, - String.format("Expected that method with rtm lock elision was" - + " deoptimized after %d lock attempts", - abortThreshold)); - } - - public static void main(String args[]) throws Throwable { - new TestRTMAbortThreshold().runTestCases(); - } -} - diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java deleted file mode 100644 index 03f56769bffeb..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that if we use RTMDeopt, then deoptimization - * caused by reason other then rtm_state_change will reset - * method's RTM state. And if we don't use RTMDeopt, then - * RTM state remain the same after such deoptimization. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestRTMAfterNonRTMDeopt - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.XAbortProvoker; -import compiler.testlibrary.rtm.CompilableTest; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.cli.CommandLineOptionTest; - -import java.util.List; - -/** - * To verify that with +UseRTMDeopt method's RTM state will be - * changed to ProfileRTM on deoptimization unrelated to - * rtm_state_change following sequence of events is used: - * <pre> - * - * rtm state ^ - * | - * UseRTM | ******| ****** - * | | - * ProfileRTM |******| |*****| - * | | | | - * 0-------|-----|-----|---------------------> time - * | | \ force abort - * | | - * | \ force deoptimization - * | - * \ force xabort - * </pre> - * When xabort is forced by native method call method should - * change it's state to UseRTM, because we use RTMAbortRatio=100 - * and low RTMLockingThreshold, so at this point actual abort - * ratio will be below 100% and there should be enough lock - * attempts to recompile method without RTM profiling. - */ -public class TestRTMAfterNonRTMDeopt { - private static final int ABORT_THRESHOLD = 1000; - private static final String RANGE_CHECK = "range_check"; - - protected void runTestCases() throws Throwable { - verifyRTMAfterDeopt(false, false); - verifyRTMAfterDeopt(true, false); - - verifyRTMAfterDeopt(false, true); - verifyRTMAfterDeopt(true, true); - } - - private void verifyRTMAfterDeopt(boolean useStackLock, - boolean useRTMDeopt) throws Throwable { - CompilableTest test = new Test(); - String logFile = String.format("rtm_%s_stack_lock_%s_deopt.xml", - (useStackLock ? "use" : "no"), (useRTMDeopt ? "use" : "no")); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - logFile, - test, - "-XX:CompileThreshold=1", - CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks", - useStackLock), - CommandLineOptionTest.prepareBooleanFlag("UseRTMDeopt", - useRTMDeopt), - "-XX:RTMAbortRatio=100", - CommandLineOptionTest.prepareNumericFlag("RTMAbortThreshold", - TestRTMAfterNonRTMDeopt.ABORT_THRESHOLD), - CommandLineOptionTest.prepareNumericFlag("RTMLockingThreshold", - TestRTMAfterNonRTMDeopt.ABORT_THRESHOLD / 2L), - "-XX:RTMTotalCountIncrRate=1", - "-XX:+PrintPreciseRTMLockingStatistics", - Test.class.getName(), - Boolean.toString(!useStackLock) - ); - - outputAnalyzer.shouldHaveExitValue(0); - - int traps = RTMTestBase.firedRTMStateChangeTraps(logFile); - - if (useRTMDeopt) { - Asserts.assertEQ(traps, 2, "Two uncommon traps with " - + "reason rtm_state_change should be fired."); - } else { - Asserts.assertEQ(traps, 0, "No uncommon traps with " - + "reason rtm_state_change should be fired."); - } - - int rangeCheckTraps = RTMTestBase.firedUncommonTraps(logFile, - TestRTMAfterNonRTMDeopt.RANGE_CHECK); - - Asserts.assertEQ(rangeCheckTraps, 1, - "One range_check uncommon trap should be fired."); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - test.getMethodWithLockName(), outputAnalyzer.getOutput()); - - int expectedStatEntries = (useRTMDeopt ? 4 : 2); - - Asserts.assertEQ(statistics.size(), expectedStatEntries, - String.format("VM output should contain %d RTM locking " - + "statistics entries.", expectedStatEntries)); - } - - public static class Test implements CompilableTest { - // Following field have to be static in order to avoid escape analysis. - @SuppressWarnings("UnsuedDeclaration") - private static int field = 0; - private static final int ITERATIONS = 10000; - private static final int RANGE_CHECK_AT = ITERATIONS / 2; - private final XAbortProvoker xabort = new XAbortProvoker(); - private final Object monitor = new Object(); - - @Override - public String getMethodWithLockName() { - return this.getClass().getName() + "::forceAbort"; - } - - @Override - public String[] getMethodsToCompileNames() { - return new String[] { getMethodWithLockName(), - XAbortProvoker.class.getName() + "::doAbort()" }; - } - - public void forceAbort(int a[], boolean abort) { - try { - synchronized(monitor) { - a[0]++; - if (abort) { - Test.field = xabort.doAbort(); - } - } - } catch (Throwable t) { - // suppress any throwables - } - } - - /** - * Usage: - * Test <inflate monitor> - */ - public static void main(String args[]) throws Throwable { - Test t = new Test(); - - boolean shouldBeInflated = Boolean.valueOf(args[0]); - if (shouldBeInflated) { - AbortProvoker.inflateMonitor(t.monitor); - } - - int tmp[] = new int[1]; - - for (int i = 0; i < Test.ITERATIONS; i++ ) { - AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated); - if (i == Test.RANGE_CHECK_AT) { - t.forceAbort(new int[0], false); - } else { - boolean isThreshold - = (i == TestRTMAfterNonRTMDeopt.ABORT_THRESHOLD); - boolean isThresholdPlusRange - = (i == TestRTMAfterNonRTMDeopt.ABORT_THRESHOLD - + Test.RANGE_CHECK_AT); - t.forceAbort(tmp, isThreshold || isThresholdPlusRange); - } - } - } - } - - public static void main(String args[]) throws Throwable { - new TestRTMAfterNonRTMDeopt().runTestCases(); - } -} - diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java deleted file mode 100644 index 5faec082fc29c..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that on high abort ratio method will be recompiled - * without rtm locking. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestRTMDeoptOnHighAbortRatio - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.AbortType; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.cli.CommandLineOptionTest; - -import java.util.List; - -/** - * Test verifies that on high abort ratio method wil be deoptimized with - * <i>rtm_state_change</i> reason and after that RTM-based lock elision will not - * be used for that method. - * This test make asserts on total locks count done by compiled method, - * so in order to avoid issue with retriable locks -XX:RTMRetryCount=0 is used. - * For more details on that issue see {@link TestUseRTMAfterLockInflation}. - */ -public class TestRTMDeoptOnHighAbortRatio { - private static final long ABORT_THRESHOLD - = AbortProvoker.DEFAULT_ITERATIONS / 2L; - - protected void runTestCases() throws Throwable { - verifyDeopt(false); - verifyDeopt(true); - } - - private void verifyDeopt(boolean useStackLock) throws Throwable { - AbortProvoker provoker = AbortType.XABORT.provoker(); - String logFileName = String.format("rtm_deopt_%s_stack_lock.xml", - (useStackLock ? "use" : "no")); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - logFileName, - provoker, - "-XX:+UseRTMDeopt", - CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks", - useStackLock), - "-XX:RTMRetryCount=0", - CommandLineOptionTest.prepareNumericFlag("RTMAbortThreshold", - TestRTMDeoptOnHighAbortRatio.ABORT_THRESHOLD), - "-XX:RTMAbortRatio=100", - "-XX:CompileThreshold=1", - "-XX:RTMTotalCountIncrRate=1", - "-XX:+PrintPreciseRTMLockingStatistics", - AbortProvoker.class.getName(), - AbortType.XABORT.toString(), - Boolean.toString(!useStackLock) - ); - - outputAnalyzer.shouldHaveExitValue(0); - - int firedTraps = RTMTestBase.firedRTMStateChangeTraps(logFileName); - - Asserts.assertEQ(firedTraps, 1, "Expected to get only one " - + "deoptimization due to rtm state change"); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - provoker.getMethodWithLockName(), outputAnalyzer.getOutput()); - - Asserts.assertEQ(statistics.size(), 1, "VM output should contain " - + "exactly one RTM locking statistics entry for method " - + provoker.getMethodWithLockName()); - - Asserts.assertEQ(statistics.get(0).getTotalLocks(), - TestRTMDeoptOnHighAbortRatio.ABORT_THRESHOLD, - "After AbortThreshold was reached, method should be" - + " recompiled without rtm lock eliding."); - } - - public static void main(String args[]) throws Throwable { - new TestRTMDeoptOnHighAbortRatio().runTestCases(); - } -} - diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java deleted file mode 100644 index 404d076e5caa6..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that on low abort ratio method will be recompiled. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestRTMDeoptOnLowAbortRatio - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.XAbortProvoker; -import compiler.testlibrary.rtm.CompilableTest; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.cli.CommandLineOptionTest; - -import java.util.List; - -/** - * Test verifies that low abort ratio method will be deoptimized with - * <i>rtm_state_change</i> reason and will continue to use RTM-based lock - * elision after that. - * This test make asserts on total locks count done by compiled method, - * so in order to avoid issue with retriable locks -XX:RTMRetryCount=0 is used. - * For more details on that issue see {@link TestUseRTMAfterLockInflation}. - */ -public class TestRTMDeoptOnLowAbortRatio { - private static final long LOCKING_THRESHOLD = 100L; - private static final long ABORT_THRESHOLD = LOCKING_THRESHOLD / 2L; - - protected void runTestCases() throws Throwable { - verifyRTMDeopt(false); - verifyRTMDeopt(true); - } - - private void verifyRTMDeopt(boolean useStackLock) throws Throwable { - CompilableTest test = new Test(); - String logFileName = String.format("rtm_deopt_%s_stack_lock.xml", - useStackLock ? "use" : "no"); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - logFileName, - test, - "-XX:+UseRTMDeopt", - CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks", - useStackLock), - CommandLineOptionTest.prepareNumericFlag("RTMLockingThreshold", - TestRTMDeoptOnLowAbortRatio.LOCKING_THRESHOLD), - CommandLineOptionTest.prepareNumericFlag("RTMAbortThreshold", - TestRTMDeoptOnLowAbortRatio.ABORT_THRESHOLD), - "-XX:RTMAbortRatio=100", - "-XX:CompileThreshold=1", - "-XX:RTMRetryCount=0", - "-XX:RTMTotalCountIncrRate=1", - "-XX:+PrintPreciseRTMLockingStatistics", - Test.class.getName(), - Boolean.toString(!useStackLock) - ); - - outputAnalyzer.shouldHaveExitValue(0); - - int firedTraps = RTMTestBase.firedRTMStateChangeTraps(logFileName); - - Asserts.assertEQ(firedTraps, 1, - "Expected to get only one deoptimization due to rtm" - + " state change"); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - test.getMethodWithLockName(), outputAnalyzer.getOutput()); - - Asserts.assertEQ(statistics.size(), 2, - "VM output should contain two RTM locking " - + "statistics entries for method " - + test.getMethodWithLockName()); - - RTMLockingStatistics statisticsBeforeDeopt = null; - - for (RTMLockingStatistics s : statistics) { - if (s.getTotalLocks() - == TestRTMDeoptOnLowAbortRatio.LOCKING_THRESHOLD) { - Asserts.assertNull(statisticsBeforeDeopt, - "Only one abort was expected during test run"); - statisticsBeforeDeopt = s; - } - } - - Asserts.assertNotNull(statisticsBeforeDeopt, - "After LockThreshold was reached, method should be recompiled " - + "with rtm lock eliding."); - } - - public static class Test implements CompilableTest { - private final XAbortProvoker xabort = new XAbortProvoker(); - private final Object monitor = new Object(); - - @Override - public String getMethodWithLockName() { - return this.getClass().getName() + "::forceAbort"; - } - - @Override - public String[] getMethodsToCompileNames() { - return new String[] { getMethodWithLockName(), - XAbortProvoker.class.getName() + "::doAbort" }; - } - - public void forceAbort(boolean abort) { - synchronized(monitor) { - if (abort) { - xabort.doAbort(); - } - } - } - - /** - * Usage: - * Test <inflate monitor> - */ - public static void main(String args[]) throws Throwable { - Asserts.assertGTE(args.length, 1, "One argument required."); - Test t = new Test(); - boolean shouldBeInflated = Boolean.valueOf(args[0]); - if (shouldBeInflated) { - AbortProvoker.inflateMonitor(t.monitor); - } - for (int i = 0; i < AbortProvoker.DEFAULT_ITERATIONS; i++) { - AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated); - t.forceAbort(i >= TestRTMDeoptOnLowAbortRatio.ABORT_THRESHOLD); - } - } - } - - public static void main(String args[]) throws Throwable { - new TestRTMDeoptOnLowAbortRatio().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java deleted file mode 100644 index 053e14d583fb8..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that RTMLockingCalculationDelay affect when - * abort ratio calculation is started. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestRTMLockingCalculationDelay - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.AbortType; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.cli.CommandLineOptionTest; - -/** - * Test verifies that abort ratio calculation could be delayed using - * RTMLockingCalculationDelay option. - */ -public class TestRTMLockingCalculationDelay { - private static final boolean INFLATE_MONITOR = true; - - protected void runTestCases() throws Throwable { - // verify that calculation will be started immediately - verifyLockingCalculationDelay(0, 0, true); - - // verify that calculation will not be started during - // first 10 minutes, while test will be started immediately - verifyLockingCalculationDelay(600000, 0, false); - - // verify that calculation will be started after a second - verifyLockingCalculationDelay(1000, 1000, true); - } - - private void verifyLockingCalculationDelay(long delay, long testDelay, - boolean deoptExpected) throws Throwable { - AbortProvoker provoker = AbortType.XABORT.provoker(); - String logFileName = String.format("rtm_delay_%d_%d.xml", delay, - testDelay); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - logFileName, - provoker, - "-XX:+UseRTMDeopt", - CommandLineOptionTest.prepareNumericFlag( - "RTMLockingCalculationDelay", delay), - "-XX:RTMAbortRatio=0", - "-XX:RTMAbortThreshold=0", - AbortProvoker.class.getName(), - AbortType.XABORT.toString(), - Boolean.toString( - TestRTMLockingCalculationDelay.INFLATE_MONITOR), - Long.toString(AbortProvoker.DEFAULT_ITERATIONS), - Long.toString(testDelay) - ); - - outputAnalyzer.shouldHaveExitValue(0); - - int deopts = RTMTestBase.firedRTMStateChangeTraps(logFileName); - - if (deoptExpected) { - Asserts.assertGT(deopts, 0, "At least one deoptimization due to " - + "rtm_state_chage is expected"); - } else { - Asserts.assertEQ(deopts, 0, "No deoptimizations due to " - + "rtm_state_chage are expected"); - } - } - - public static void main(String args[]) throws Throwable { - new TestRTMLockingCalculationDelay().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java deleted file mode 100644 index 913fac3068b21..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that RTMLockingThreshold affects rtm state transition - * ProfileRTM => UseRTM. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestRTMLockingThreshold - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.XAbortProvoker; -import compiler.testlibrary.rtm.CompilableTest; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.cli.CommandLineOptionTest; - -import java.util.List; - -/** - * Test verifies that RTMLockingThreshold option actually affects how soon - * method will be deoptimized on low abort ratio. - */ -public class TestRTMLockingThreshold { - - /** - * We use non-zero abort threshold to avoid abort related to - * interrupts, VMM calls, etc. during first lock attempt. - * - */ - private static final int MIN_ABORT_THRESHOLD = 10; - - protected void runTestCases() throws Throwable { - verifyLockingThreshold(0, false); - verifyLockingThreshold(100, false); - verifyLockingThreshold(1000, false); - - verifyLockingThreshold(0, true); - verifyLockingThreshold(100, true); - verifyLockingThreshold(1000, true); - } - - private void verifyLockingThreshold(int lockingThreshold, - boolean useStackLock) throws Throwable { - CompilableTest test = new Test(); - - int abortThreshold = Math.max(lockingThreshold / 2, - TestRTMLockingThreshold.MIN_ABORT_THRESHOLD); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - test, - "-XX:CompileThreshold=1", - CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks", - useStackLock), - "-XX:+UseRTMDeopt", - "-XX:RTMTotalCountIncrRate=1", - "-XX:RTMRetryCount=0", - CommandLineOptionTest.prepareNumericFlag("RTMAbortThreshold", - abortThreshold), - CommandLineOptionTest.prepareNumericFlag("RTMLockingThreshold", - lockingThreshold), - "-XX:RTMAbortRatio=100", - "-XX:+PrintPreciseRTMLockingStatistics", - Test.class.getName(), - Boolean.toString(!useStackLock), - Integer.toString(lockingThreshold) - ); - - outputAnalyzer.shouldHaveExitValue(0); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - test.getMethodWithLockName(), outputAnalyzer.getOutput()); - - Asserts.assertEQ(statistics.size(), 2, "VM output should contain two " - + "RTM locking statistics entries."); - - /** - * If RTMLockingThreshold==0, then we have to make at least 1 call. - */ - long expectedValue = lockingThreshold; - if (expectedValue == 0) { - expectedValue++; - } - - RTMLockingStatistics statBeforeDeopt = null; - for (RTMLockingStatistics s : statistics) { - if (s.getTotalLocks() == expectedValue) { - Asserts.assertNull(statBeforeDeopt, - "Only one statistics entry should contain aborts"); - statBeforeDeopt = s; - } - } - - Asserts.assertNotNull(statBeforeDeopt, "There should be exactly one " - + "statistics entry corresponding to ProfileRTM state."); - } - - public static class Test implements CompilableTest { - // Following field have to be static in order to avoid escape analysis. - @SuppressWarnings("UnsuedDeclaration") - private static int field = 0; - private static final int TOTAL_ITERATIONS = 10000; - private final XAbortProvoker xabort = new XAbortProvoker(); - private final Object monitor = new Object(); - - @Override - public String getMethodWithLockName() { - return this.getClass().getName() + "::lock"; - } - - @Override - public String[] getMethodsToCompileNames() { - return new String[] { getMethodWithLockName(), - XAbortProvoker.class.getName() + "::doAbort" }; - } - - public void lock(boolean abort) { - synchronized(monitor) { - if (abort) { - Test.field += xabort.doAbort(); - } - } - } - - /** - * Usage: - * Test <inflate monitor> - */ - public static void main(String args[]) throws Throwable { - Asserts.assertGTE(args.length, 2, "Two arguments required."); - Test t = new Test(); - boolean shouldBeInflated = Boolean.valueOf(args[0]); - int lockingThreshold = Integer.valueOf(args[1]); - if (shouldBeInflated) { - AbortProvoker.inflateMonitor(t.monitor); - } - for (int i = 0; i < Test.TOTAL_ITERATIONS; i++) { - AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated); - t.lock(i >= lockingThreshold / 2); - } - } - } - - public static void main(String args[]) throws Throwable { - new TestRTMLockingThreshold().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMRetryCount.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMRetryCount.java deleted file mode 100644 index ed09be05d212d..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMRetryCount.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that RTMRetryCount affects actual amount of retries. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestRTMRetryCount - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.BusyLock; -import compiler.testlibrary.rtm.CompilableTest; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.cli.CommandLineOptionTest; - -import java.util.List; - -/** - * Test verifies that RTMRetryCount option actually affects amount of - * retries on lock busy. - */ -public class TestRTMRetryCount { - /** - * Time in ms, during which busy lock will be locked. - */ - private static final int LOCKING_TIME = 5000; - private static final boolean INFLATE_MONITOR = true; - - protected void runTestCases() throws Throwable { - verifyRTMRetryCount(0); - verifyRTMRetryCount(1); - verifyRTMRetryCount(5); - verifyRTMRetryCount(10); - } - - private void verifyRTMRetryCount(int retryCount) throws Throwable { - CompilableTest busyLock = new BusyLock(); - long expectedAborts = retryCount + 1L; - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - busyLock, - "-XX:-UseRTMXendForLockBusy", - "-XX:RTMTotalCountIncrRate=1", - CommandLineOptionTest.prepareNumericFlag("RTMRetryCount", - retryCount), - "-XX:RTMTotalCountIncrRate=1", - "-XX:+PrintPreciseRTMLockingStatistics", - BusyLock.class.getName(), - Boolean.toString(TestRTMRetryCount.INFLATE_MONITOR), - Integer.toString(TestRTMRetryCount.LOCKING_TIME) - ); - - outputAnalyzer.shouldHaveExitValue(0); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - busyLock.getMethodWithLockName(), outputAnalyzer.getStdout()); - - Asserts.assertEQ(statistics.size(), 1, "VM output should contain " - + "exactly one rtm locking statistics entry for method " - + busyLock.getMethodWithLockName()); - - Asserts.assertEQ(statistics.get(0).getTotalAborts(), expectedAborts, - String.format("It is expected to get %d aborts", - expectedAborts)); - } - - public static void main(String args[]) throws Throwable { - new TestRTMRetryCount().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMSpinLoopCount.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMSpinLoopCount.java deleted file mode 100644 index 8702ae0b73439..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMSpinLoopCount.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that RTMSpinLoopCount affects time spent - * between locking attempts. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestRTMSpinLoopCount - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.BusyLock; -import compiler.testlibrary.rtm.CompilableTest; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.cli.CommandLineOptionTest; -import jdk.test.lib.Platform; - -import java.util.List; - -/** - * Test verifies that RTMSpinLoopCount increase time spent between retries - * by comparing amount of retries done with different RTMSpinLoopCount's values. - */ -public class TestRTMSpinLoopCount { - private static final int LOCKING_TIME = 1000; - private static final int RTM_RETRY_COUNT = 1000; - private static final boolean INFLATE_MONITOR = true; - private static final long MAX_ABORTS = RTM_RETRY_COUNT + 1L; - private static int[] SPIN_LOOP_COUNTS; - - protected void runTestCases() throws Throwable { - - SPIN_LOOP_COUNTS = new int[] { 0, 100, 1_000, 10_000, 100_000 }; - - long[] aborts = new long[TestRTMSpinLoopCount.SPIN_LOOP_COUNTS.length]; - - for (int i = 0; i < TestRTMSpinLoopCount.SPIN_LOOP_COUNTS.length; i++) { - aborts[i] = getAbortsCountOnLockBusy( - TestRTMSpinLoopCount.SPIN_LOOP_COUNTS[i]); - } - - for (int i = 1; i < aborts.length; i++) { - Asserts.assertLTE(aborts[i], aborts[i - 1], "Increased spin loop " - + "count should not increase retries count."); - } - } - - private long getAbortsCountOnLockBusy(int spinLoopCount) throws Throwable { - CompilableTest test = new BusyLock(); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - test, - CommandLineOptionTest.prepareNumericFlag("RTMRetryCount", - TestRTMSpinLoopCount.RTM_RETRY_COUNT), - CommandLineOptionTest.prepareNumericFlag("RTMSpinLoopCount", - spinLoopCount), - "-XX:-UseRTMXendForLockBusy", - "-XX:RTMTotalCountIncrRate=1", - "-XX:+PrintPreciseRTMLockingStatistics", - BusyLock.class.getName(), - Boolean.toString(TestRTMSpinLoopCount.INFLATE_MONITOR), - Integer.toString(TestRTMSpinLoopCount.LOCKING_TIME) - ); - - outputAnalyzer.shouldHaveExitValue(0); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - test.getMethodWithLockName(), outputAnalyzer.getOutput()); - - Asserts.assertEQ(statistics.size(), 1, - "VM output should contain exactly one entry for method " - + test.getMethodWithLockName()); - - RTMLockingStatistics lock = statistics.get(0); - - Asserts.assertLTE(lock.getTotalAborts(), - TestRTMSpinLoopCount.MAX_ABORTS, String.format("Total aborts " - + "count (%d) should be less or equal to %d", - lock.getTotalAborts(), - TestRTMSpinLoopCount.MAX_ABORTS)); - - return lock.getTotalAborts(); - } - - public static void main(String args[]) throws Throwable { - new TestRTMSpinLoopCount().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java deleted file mode 100644 index e0a8394570e03..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that RTMTotalCountIncrRate option affects - * RTM locking statistics. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestRTMTotalCountIncrRate - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.XAbortProvoker; -import compiler.testlibrary.rtm.CompilableTest; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.cli.CommandLineOptionTest; - -import java.util.List; - -/** - * Test verifies that with RTMTotalCountIncrRate=1 RTM locking statistics - * contains precise information abort attempted locks and that with other values - * statistics contains information abort non-zero locking attempts. - * Since assert done for RTMTotalCountIncrRate=1 is pretty strict, test uses - * -XX:RTMRetryCount=0 to avoid issue with retriable aborts. For more details on - * that issue see {@link TestUseRTMAfterLockInflation}. - */ -public class TestRTMTotalCountIncrRate { - protected void runTestCases() throws Throwable { - verifyLocksCount(1, false); - verifyLocksCount(64, false); - verifyLocksCount(128, false); - verifyLocksCount(1, true); - verifyLocksCount(64, true); - verifyLocksCount(128, true); - } - - private void verifyLocksCount(int incrRate, boolean useStackLock) - throws Throwable{ - CompilableTest test = new Test(); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - test, - CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks", - useStackLock), - CommandLineOptionTest.prepareNumericFlag( - "RTMTotalCountIncrRate", incrRate), - "-XX:RTMRetryCount=0", - "-XX:+PrintPreciseRTMLockingStatistics", - Test.class.getName(), - Boolean.toString(!useStackLock) - ); - - outputAnalyzer.shouldHaveExitValue(0); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - test.getMethodWithLockName(), outputAnalyzer.getOutput()); - - Asserts.assertEQ(statistics.size(), 1, "VM output should contain " - + "exactly one RTM locking statistics entry for method " - + test.getMethodWithLockName()); - - RTMLockingStatistics lock = statistics.get(0); - if (incrRate == 1) { - Asserts.assertEQ(lock.getTotalLocks(), Test.TOTAL_ITERATIONS, - "Total locks should be exactly the same as amount of " - + "iterations."); - } - } - - public static class Test implements CompilableTest { - private static final long TOTAL_ITERATIONS = 10000L; - private final XAbortProvoker xabort = new XAbortProvoker(); - private final Object monitor = new Object(); - // Following field have to be static in order to avoid escape analysis. - @SuppressWarnings("UnsuedDeclaration") - private static int field = 0; - - @Override - public String getMethodWithLockName() { - return this.getClass().getName() + "::lock"; - } - - @Override - public String[] getMethodsToCompileNames() { - return new String[] { getMethodWithLockName(), "*.doAbort" }; - } - - public void lock(boolean forceAbort) { - synchronized(monitor) { - if (forceAbort) { - // We're calling native method in order to force - // abort. It's done by explicit xabort call emitted - // in SharedRuntime::generate_native_wrapper. - // If an actual JNI call will be replaced by - // intrinsic - we'll be in trouble, since xabort - // will be no longer called and test may fail. - xabort.doAbort(); - } - Test.field++; - } - } - - /** - * Usage: - * Test <inflate monitor> - */ - public static void main(String args[]) throws Throwable { - Asserts.assertGTE(args.length, 1, "One argument required."); - Test test = new Test(); - boolean shouldBeInflated = Boolean.valueOf(args[0]); - if (shouldBeInflated) { - AbortProvoker.inflateMonitor(test.monitor); - } - for (long i = 0L; i < Test.TOTAL_ITERATIONS; i++) { - AbortProvoker.verifyMonitorState(test.monitor, - shouldBeInflated); - // Force abort on first iteration to avoid rare case when - // there were no aborts and locks count was not incremented - // with RTMTotalCountIncrRate > 1 (in such case JVM won't - // print JVM locking statistics). - test.lock(i == 0); - } - } - } - - public static void main(String args[]) throws Throwable { - new TestRTMTotalCountIncrRate().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java deleted file mode 100644 index d99a59ab84fd7..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that rtm locking is used for stack locks before - * inflation and after it used for inflated locks. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestUseRTMAfterLockInflation - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.AbortType; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; - -import java.util.List; - -/** - * Test verifies that RTM is used after lock inflation by executing compiled - * method with RTM-based lock elision using stack lock first, then that lock - * is inflated and the same compiled method invoked again. - * - * Compiled method invoked {@code AbortProvoker.DEFAULT_ITERATIONS} times before - * lock inflation and the same amount of times after inflation. - * As a result total locks count should be equal to - * {@code 2 * AbortProvoker.DEFAULT_ITERATIONS}. - * It is a pretty strict assertion which could fail if some retriable abort - * happened: it could be {@code AbortType.RETRIABLE} or - * {@code AbortType.MEM_CONFLICT}, but unfortunately abort can has both these - * reasons simultaneously. In order to avoid false negative failures related - * to incorrect aborts counting, -XX:RTMRetryCount=0 is used. - */ -public class TestUseRTMAfterLockInflation { - private static final long EXPECTED_LOCKS - = 2L * AbortProvoker.DEFAULT_ITERATIONS; - - protected void runTestCases() throws Throwable { - AbortProvoker provoker = AbortType.XABORT.provoker(); - long totalLocksCount = 0; - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - provoker, - "-XX:+UseRTMForStackLocks", - "-XX:RTMTotalCountIncrRate=1", - "-XX:RTMRetryCount=0", - "-XX:+PrintPreciseRTMLockingStatistics", - Test.class.getName(), - AbortType.XABORT.toString()); - - outputAnalyzer.shouldHaveExitValue(0); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - provoker.getMethodWithLockName(), outputAnalyzer.getOutput()); - - Asserts.assertEQ(statistics.size(), 2, - "VM output should contain two rtm locking statistics entries " - + "for method " + provoker.getMethodWithLockName()); - - for (RTMLockingStatistics s : statistics) { - totalLocksCount += s.getTotalLocks(); - } - - Asserts.assertEQ(totalLocksCount, - TestUseRTMAfterLockInflation.EXPECTED_LOCKS, - "Total lock count should be greater or equal to " - + TestUseRTMAfterLockInflation.EXPECTED_LOCKS); - } - - public static class Test { - /** - * Usage: - * Test <provoker type> - */ - public static void main(String args[]) throws Throwable { - Asserts.assertGT(args.length, 0, - "AbortType name is expected as first argument."); - - AbortProvoker provoker - = AbortType.lookup(Integer.valueOf(args[0])).provoker(); - for (int i = 0; i < AbortProvoker.DEFAULT_ITERATIONS; i++) { - AbortProvoker.verifyMonitorState(provoker, false /*deflated*/); - provoker.forceAbort(); - } - provoker.inflateMonitor(); - for (int i = 0; i < AbortProvoker.DEFAULT_ITERATIONS; i++) { - AbortProvoker.verifyMonitorState(provoker, true /*inflated*/); - provoker.forceAbort(); - } - } - } - - public static void main(String args[]) throws Throwable { - new TestUseRTMAfterLockInflation().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java deleted file mode 100644 index facf686739c92..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that UseRTMDeopt affects uncommon trap installation in - * compiled methods with synchronized block. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestUseRTMDeopt - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.AbortType; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.cli.CommandLineOptionTest; - -/** - * Test verifies that usage of UseRTMDeopt option affects uncommon traps usage - * for methods that use locking. - */ -public class TestUseRTMDeopt { - - protected void runTestCases() throws Throwable { - verifyUseRTMDeopt(false); - verifyUseRTMDeopt(true); - } - - private void verifyUseRTMDeopt(boolean useRTMDeopt) throws Throwable { - AbortProvoker provoker = AbortType.XABORT.provoker(); - String logFileName = String.format("rtm_%s_deopt.xml", - useRTMDeopt ? "use" : "no"); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - logFileName, - provoker, - CommandLineOptionTest.prepareBooleanFlag("UseRTMDeopt", - useRTMDeopt), - AbortProvoker.class.getName(), - AbortType.XABORT.toString() - ); - - outputAnalyzer.shouldHaveExitValue(0); - - int expectedUncommonTraps = useRTMDeopt ? 1 : 0; - int installedUncommonTraps - = RTMTestBase.installedRTMStateChangeTraps(logFileName); - - Asserts.assertEQ(expectedUncommonTraps, installedUncommonTraps, - String.format("Expected to find %d uncommon traps " - + "installed with reason rtm_state_change.", - expectedUncommonTraps)); - } - - public static void main(String args[]) throws Throwable { - new TestUseRTMDeopt().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java deleted file mode 100644 index 0b5267a3ef6ae..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that rtm locking is used for inflated locks. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestUseRTMForInflatedLocks - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.AbortType; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; - -import java.util.List; - -/** - * Test verifies that RTM-based lock elision could be used for inflated locks - * by calling compiled method that use RTM-based lock elision and using - * manually inflated lock. - * Compiled method invoked {@code AbortProvoker.DEFAULT_ITERATIONS} times, - * so total locks count should be the same. - * This test could also be affected by retriable aborts, so -XX:RTMRetryCount=0 - * is used. For more information abort that issue see - * {@link TestUseRTMAfterLockInflation}. - */ -public class TestUseRTMForInflatedLocks { - - protected void runTestCases() throws Throwable { - AbortProvoker provoker = AbortType.XABORT.provoker(); - RTMLockingStatistics lock; - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - provoker, - "-XX:-UseRTMForStackLocks", - "-XX:RTMTotalCountIncrRate=1", - "-XX:RTMRetryCount=0", - "-XX:+PrintPreciseRTMLockingStatistics", - AbortProvoker.class.getName(), - AbortType.XABORT.toString()); - - outputAnalyzer.shouldHaveExitValue(0); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - provoker.getMethodWithLockName(), outputAnalyzer.getOutput()); - - Asserts.assertEQ(statistics.size(), 1, - "VM output should contain exactly one rtm locking statistics " - + "entry for method " + provoker.getMethodWithLockName()); - - lock = statistics.get(0); - Asserts.assertEQ(lock.getTotalLocks(), AbortProvoker.DEFAULT_ITERATIONS, - "Total lock count should be greater or equal to " - + AbortProvoker.DEFAULT_ITERATIONS); - } - - public static void main(String args[]) throws Throwable { - new TestUseRTMForInflatedLocks().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java deleted file mode 100644 index 720fedb613b56..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that rtm locking is used for stack locks. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestUseRTMForStackLocks - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.AbortType; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; - -import java.util.List; - -/** - * Test verifies that RTM-based lock elision could be used for stack locks - * by calling compiled method that use RTM-based lock elision and using - * stack lock. - * Compiled method invoked {@code AbortProvoker.DEFAULT_ITERATIONS} times, - * so total locks count should be the same. - * This test could also be affected by retriable aborts, so -XX:RTMRetryCount=0 - * is used. For more information abort that issue see - * {@link TestUseRTMAfterLockInflation}. - */ -public class TestUseRTMForStackLocks { - private static final boolean INFLATE_MONITOR = false; - - protected void runTestCases() throws Throwable { - AbortProvoker provoker = AbortType.XABORT.provoker(); - RTMLockingStatistics lock; - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - provoker, - "-XX:+UseRTMForStackLocks", - "-XX:RTMTotalCountIncrRate=1", - "-XX:RTMRetryCount=0", - "-XX:+PrintPreciseRTMLockingStatistics", - AbortProvoker.class.getName(), - AbortType.XABORT.toString(), - Boolean.toString(TestUseRTMForStackLocks.INFLATE_MONITOR)); - - outputAnalyzer.shouldHaveExitValue(0); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - provoker.getMethodWithLockName(), outputAnalyzer.getOutput()); - - Asserts.assertEQ(statistics.size(), 1, - "VM output should contain exactly one rtm locking statistics " - + "entry for method " + provoker.getMethodWithLockName()); - - lock = statistics.get(0); - Asserts.assertEQ(lock.getTotalLocks(), AbortProvoker.DEFAULT_ITERATIONS, - "Total locks count should be greater or equal to " - + AbortProvoker.DEFAULT_ITERATIONS); - } - - public static void main(String args[]) throws Throwable { - new TestUseRTMForStackLocks().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMXendForLockBusy.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMXendForLockBusy.java deleted file mode 100644 index 2eb3735855ed2..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMXendForLockBusy.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that UseRTMXendForLockBusy option affects - * method behaviour if lock is busy. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.locking.TestUseRTMXendForLockBusy - */ - -package compiler.rtm.locking; - -import compiler.testlibrary.rtm.AbortType; -import compiler.testlibrary.rtm.BusyLock; -import compiler.testlibrary.rtm.CompilableTest; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.cli.CommandLineOptionTest; - -import java.util.List; - -/** - * Test verifies that with +UseRTMXendForLockBusy there will be no aborts - * forced by the test. - */ -public class TestUseRTMXendForLockBusy { - private final static int LOCKING_TIME = 5000; - - protected void runTestCases() throws Throwable { - // inflated lock, xabort on lock busy - verifyXendForLockBusy(true, false); - // inflated lock, xend on lock busy - verifyXendForLockBusy(true, true); - // stack lock, xabort on lock busy - verifyXendForLockBusy(false, false); - // stack lock, xend on lock busy - verifyXendForLockBusy(false, true); - } - - private void verifyXendForLockBusy(boolean inflateMonitor, - boolean useXend) throws Throwable { - CompilableTest test = new BusyLock(); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - test, - CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks", - !inflateMonitor), - CommandLineOptionTest.prepareBooleanFlag( - "UseRTMXendForLockBusy", - useXend), - "-XX:RTMRetryCount=0", - "-XX:RTMTotalCountIncrRate=1", - "-XX:+PrintPreciseRTMLockingStatistics", - BusyLock.class.getName(), - Boolean.toString(inflateMonitor), - Integer.toString(TestUseRTMXendForLockBusy.LOCKING_TIME) - ); - - outputAnalyzer.shouldHaveExitValue(0); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - test.getMethodWithLockName(), outputAnalyzer.getOutput()); - - Asserts.assertEQ(statistics.size(), 1, "VM output should contain " - + "exactly one rtm locking statistics entry for method " - + test.getMethodWithLockName()); - - long aborts = statistics.get(0).getAborts(AbortType.XABORT); - - if (useXend) { - Asserts.assertEQ(aborts, 0L, - "Expected to get no aborts on busy lock"); - } else { - Asserts.assertGT(aborts, 0L, - "Expected to get at least one abort on busy lock"); - } - } - - public static void main(String args[]) throws Throwable { - new TestUseRTMXendForLockBusy().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java b/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java deleted file mode 100644 index 07514e4fc37a3..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that NoRTMLockEliding option could be applied to - * specified method and that such method will not use rtm. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.method_options.TestNoRTMLockElidingOption - */ - -package compiler.rtm.method_options; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.AbortType; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.cli.CommandLineOptionTest; - -import java.util.List; - -/** - * Test verifies that method tagged with option <i>NoRTMLockElidingOption</i> - * will not use RTM-based lock elision. - * Test invokes compiled method and checks that no deoptimization with - * <i>rtm_state_change</i> reason had happened and that that VM output - * does not contain RTM locking statistics for compiled method. - */ -public class TestNoRTMLockElidingOption { - - public void runTestCases() throws Throwable { - verifyOption(false); - verifyOption(true); - } - - public void verifyOption(boolean useStackLock) throws Throwable { - AbortProvoker provoker = AbortType.XABORT.provoker(); - String logFileName = String.format("rtm_deopt_%s_stack_lock.xml", - (useStackLock ? "use" : "no")); - String methodOption = String.format("-XX:CompileCommand=option," + - "%s,NoRTMLockEliding", provoker.getMethodWithLockName()); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - logFileName, - provoker, - CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks", - useStackLock), - methodOption, - "-XX:RTMTotalCountIncrRate=1", - "-XX:+UseRTMDeopt", - "-XX:+PrintPreciseRTMLockingStatistics", - AbortProvoker.class.getName(), - AbortType.XABORT.toString(), - Boolean.toString(!useStackLock) - ); - - outputAnalyzer.shouldHaveExitValue(0); - - int firedTraps = RTMTestBase.firedRTMStateChangeTraps(logFileName); - - Asserts.assertEQ(firedTraps, 0, - "No deoptimizations with rtm_state_change reason are expected"); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - provoker.getMethodWithLockName(), outputAnalyzer.getOutput()); - - Asserts.assertEQ(statistics.size(), 0, - "VM output should not contain RTM locking statistics entries " - + "for method " + provoker.getMethodWithLockName()); - } - - public static void main(String args[]) throws Throwable { - new TestNoRTMLockElidingOption().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java b/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java deleted file mode 100644 index 4007121b4aaca..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that UseRTMLockEliding option could be applied to - * specified method and that such method will not be deoptimized - * on high abort ratio. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.method_options.TestUseRTMLockElidingOption - */ - -package compiler.rtm.method_options; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.AbortType; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.cli.CommandLineOptionTest; - -import java.util.List; - -/** - * Test verifies that method tagged with option <i>UseRTMLockElidingOption</i> - * will use RTM-based lock elision, but will be never deoptimized with - * <i>rtm_state_change reason</i>. - * Test invokes compiled method and checks that no deoptimization with - * <i>rtm_state_change</i> reason had happened and that that VM output - * contains RTM locking statistics for compiled method and that total locks - * count equals to method's invocations. - * Since last assert is pretty strict, test uses -XX:RTMRetryCount=0 in order - * to avoid issue with retriable aborts described in - * {@link TestUseRTMAfterLockInflation}. - */ -public class TestUseRTMLockElidingOption { - - public void runTestCases() throws Throwable { - verifyOption(false); - verifyOption(true); - } - - public void verifyOption(boolean useStackLock) throws Throwable { - AbortProvoker provoker = AbortType.XABORT.provoker(); - String logFileName = String.format("rtm_deopt_%s_stack_lock.xml", - (useStackLock ? "use" : "no")); - String methodOption = String.format("-XX:CompileCommand=option," + - "%s,UseRTMLockEliding", provoker.getMethodWithLockName()); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - logFileName, - provoker, - CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks", - useStackLock), - methodOption, - "-XX:RTMTotalCountIncrRate=1", - "-XX:RTMRetryCount=0", - "-XX:+UseRTMDeopt", - "-XX:+PrintPreciseRTMLockingStatistics", - provoker.getClass().getName(), - AbortType.XABORT.toString(), - Boolean.toString(!useStackLock) - ); - - outputAnalyzer.shouldHaveExitValue(0); - - int firedTraps = RTMTestBase.firedRTMStateChangeTraps(logFileName); - - Asserts.assertEQ(firedTraps, 0, - "Method deoptimization with rtm_state_change is unexpected"); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - provoker.getMethodWithLockName(), outputAnalyzer.getOutput()); - - Asserts.assertEQ(statistics.size(), 1, - "VM output should contain exactly one RTM locking " - + "statistics entry for method " - + provoker.getMethodWithLockName()); - - RTMLockingStatistics lock = statistics.get(0); - - Asserts.assertEQ(lock.getTotalLocks(), AbortProvoker.DEFAULT_ITERATIONS, - "Expected to get total locks count equal to total amount of " - + "lock attempts."); - } - - public static void main(String args[]) throws Throwable { - new TestUseRTMLockElidingOption().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java b/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java deleted file mode 100644 index 4223924b9bde3..0000000000000 --- a/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8031320 - * @summary Verify that rtm locking statistics contain proper information - * on overall aborts and locks count and count of aborts of - * different types. Test also verify that VM output does not - * contain rtm locking statistics when it should not. - * @library /test/lib / - * @modules java.base/jdk.internal.misc - * java.management - * @requires vm.rtm.cpu & vm.rtm.compiler - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI - * compiler.rtm.print.TestPrintPreciseRTMLockingStatistics - */ - - -package compiler.rtm.print; - -import compiler.testlibrary.rtm.AbortProvoker; -import compiler.testlibrary.rtm.AbortType; -import compiler.testlibrary.rtm.RTMLockingStatistics; -import compiler.testlibrary.rtm.RTMTestBase; -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -/** - * Test verifies that VM output does not contain RTM locking statistics when it - * should not (when PrintPreciseRTMLockingStatistics is off) and that with - * -XX:+PrintPreciseRTMLockingStatistics locking statistics contains sane - * total locks and aborts count as well as for specific abort types. - */ -public class TestPrintPreciseRTMLockingStatistics { - - public void runTestCases() throws Throwable { - verifyNoStatistics(); - verifyStatistics(); - } - - // verify that VM output does not contain - // rtm locking statistics - private void verifyNoStatistics() throws Throwable { - verifyNoStatistics(AbortType.XABORT); - - verifyNoStatistics(AbortType.XABORT, - "-XX:-PrintPreciseRTMLockingStatistics"); - - verifyNoStatistics(AbortType.XABORT, "-XX:-UseRTMLocking", - "-XX:+PrintPreciseRTMLockingStatistics"); - } - - // verify that rtm locking statistics contain information - // about each type of aborts - private void verifyStatistics() throws Throwable { - verifyAbortsCount(AbortType.XABORT); - verifyAbortsCount(AbortType.MEM_CONFLICT); - verifyAbortsCount(AbortType.BUF_OVERFLOW); - verifyAbortsCount(AbortType.NESTED_ABORT); - } - - private void verifyNoStatistics(AbortType abortProvokerType, - String... vmOpts) throws Throwable { - AbortProvoker provoker = abortProvokerType.provoker(); - List<String> finalVMOpts = new LinkedList<>(); - Collections.addAll(finalVMOpts, vmOpts); - Collections.addAll(finalVMOpts, AbortProvoker.class.getName(), - abortProvokerType.toString()); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(provoker, - finalVMOpts.toArray(new String[finalVMOpts.size()])); - - outputAnalyzer.shouldHaveExitValue(0); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - outputAnalyzer.getOutput()); - - Asserts.assertEQ(statistics.size(), 0, "VM output should not contain " - + "any RTM locking statistics"); - } - - private void verifyAbortsCount(AbortType abortType) throws Throwable { - AbortProvoker provoker = abortType.provoker(); - - OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( - provoker, - "-XX:+PrintPreciseRTMLockingStatistics", - AbortProvoker.class.getName(), - abortType.toString()); - - outputAnalyzer.shouldHaveExitValue(0); - - List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( - provoker.getMethodWithLockName(),outputAnalyzer.getOutput()); - - Asserts.assertGT(statistics.size(), 0, "VM output should contain one " - + "rtm locking statistics entry for method " - + provoker.getMethodWithLockName()); - - RTMLockingStatistics lock = statistics.get(0); - - Asserts.assertGT(lock.getTotalAborts(), 0L, - "RTM locking statistics should contain non zero total aborts " - + "count"); - - Asserts.assertGT(lock.getAborts(abortType), 0L, String.format( - "RTM locking statistics should contain non zero aborts count " - + "for abort reason %s", abortType)); - } - - public static void main(String args[]) throws Throwable { - new TestPrintPreciseRTMLockingStatistics().runTestCases(); - } -} diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortProvoker.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortProvoker.java deleted file mode 100644 index cf74942aadfd2..0000000000000 --- a/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortProvoker.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.testlibrary.rtm; - -import jdk.test.lib.Asserts; -import jdk.test.whitebox.WhiteBox; - -import java.util.Objects; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.CyclicBarrier; - -/** - * Base class for different transactional execution abortion - * provokers aimed to force abort due to specified reason. - */ -public abstract class AbortProvoker implements CompilableTest { - public static final long DEFAULT_ITERATIONS = 10000L; - private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); - @SuppressWarnings("unused") - private static int sharedState = 0; - /** - * Inflates monitor associated with object {@code monitor}. - * Inflation is forced by entering the same monitor from - * two different threads. - * - * @param monitor monitor to be inflated. - * @return inflated monitor. - * @throws Exception if something went wrong. - */ - public static Object inflateMonitor(Object monitor) throws Exception { - CyclicBarrier barrier = new CyclicBarrier(2); - - Runnable inflatingRunnable = () -> { - synchronized (monitor) { - try { - barrier.await(); - } catch (BrokenBarrierException | InterruptedException e) { - throw new RuntimeException( - "Synchronization issue occurred.", e); - } - try { - monitor.wait(); - } catch (InterruptedException e) { - throw new AssertionError("The thread waiting on an" - + " inflated monitor was interrupted, thus test" - + " results may be incorrect.", e); - } - } - }; - - Thread t = new Thread(inflatingRunnable); - t.setDaemon(true); - t.start(); - // Wait until thread t enters the monitor. - barrier.await(); - synchronized (monitor) { - // At this point thread t is already waiting on the monitor. - // Modifying static field just to avoid lock's elimination. - sharedState++; - } - verifyMonitorState(monitor, true /* inflated */); - return monitor; - } - - /** - * Verifies that {@code monitor} is a stack-lock or inflated lock depending - * on {@code shouldBeInflated} value. If {@code monitor} is inflated while - * it is expected that it should be a stack-lock, then this method attempts - * to deflate it by forcing a safepoint and then verifies the state once - * again. - * - * @param monitor monitor to be verified. - * @param shouldBeInflated flag indicating whether or not monitor is - * expected to be inflated. - * @throws RuntimeException if the {@code monitor} in a wrong state. - */ - public static void verifyMonitorState(Object monitor, - boolean shouldBeInflated) { - if (!shouldBeInflated && WHITE_BOX.isMonitorInflated(monitor)) { - boolean did_deflation = WHITE_BOX.deflateIdleMonitors(); - Asserts.assertEQ(did_deflation, true, - "deflateIdleMonitors() should have worked."); - } - Asserts.assertEQ(WHITE_BOX.isMonitorInflated(monitor), shouldBeInflated, - "Monitor in a wrong state."); - } - /** - * Verifies that monitor used by the {@code provoker} is a stack-lock or - * inflated lock depending on {@code shouldBeInflated} value. If such - * monitor is inflated while it is expected that it should be a stack-lock, - * then this method attempts to deflate it by forcing a safepoint and then - * verifies the state once again. - * - * @param provoker AbortProvoker whose monitor's state should be verified. - * @param shouldBeInflated flag indicating whether or not monitor is - * expected to be inflated. - * @throws RuntimeException if the {@code monitor} in a wrong state. - */ - public static void verifyMonitorState(AbortProvoker provoker, - boolean shouldBeInflated) { - verifyMonitorState(provoker.monitor, shouldBeInflated); - } - - /** - * Get instance of specified AbortProvoker, inflate associated monitor - * if needed and then invoke forceAbort method in a loop. - * - * Usage: - * AbortProvoker <AbortType name> [<inflate monitor> - * [<iterations> [ <delay>]]] - * - * Default parameters are: - * <ul> - * <li>inflate monitor = <b>true</b></li> - * <li>iterations = {@code AbortProvoker.DEFAULT_ITERATIONS}</li> - * <li>delay = <b>0</b></li> - * </ul> - */ - public static void main(String args[]) throws Throwable { - Asserts.assertGT(args.length, 0, "At least one argument is required."); - - AbortType abortType = AbortType.lookup(Integer.valueOf(args[0])); - boolean monitorShouldBeInflated = true; - long iterations = AbortProvoker.DEFAULT_ITERATIONS; - - if (args.length > 1) { - monitorShouldBeInflated = Boolean.valueOf(args[1]); - - if (args.length > 2) { - iterations = Long.valueOf(args[2]); - - if (args.length > 3) { - Thread.sleep(Integer.valueOf(args[3])); - } - } - } - - AbortProvoker provoker = abortType.provoker(); - - if (monitorShouldBeInflated) { - provoker.inflateMonitor(); - } - - for (long i = 0; i < iterations; i++) { - AbortProvoker.verifyMonitorState(provoker, monitorShouldBeInflated); - provoker.forceAbort(); - } - } - - protected final Object monitor; - - protected AbortProvoker() { - this(new Object()); - } - - protected AbortProvoker(Object monitor) { - this.monitor = Objects.requireNonNull(monitor); - } - - /** - * Inflates monitor used by this AbortProvoker instance. - * @throws Exception - */ - public void inflateMonitor() throws Exception { - AbortProvoker.inflateMonitor(monitor); - } - - /** - * Forces transactional execution abortion. - */ - public abstract void forceAbort(); - - /** - * Returns names of all methods that have to be compiled - * in order to successfully force transactional execution - * abortion. - * - * @return array with methods' names that have to be compiled. - */ - @Override - public String[] getMethodsToCompileNames() { - return new String[] { getMethodWithLockName() }; - } - - /** - * Returns name of the method that will contain monitor whose locking - * will be elided using transactional execution. - * - * @return name of the method that will contain elided lock. - */ - @Override - public String getMethodWithLockName() { - return this.getClass().getName() + "::forceAbort"; - } -} diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortType.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortType.java deleted file mode 100644 index dd439111afa4c..0000000000000 --- a/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortType.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.testlibrary.rtm; - -import jdk.test.lib.Asserts; - -import java.util.HashMap; -import java.util.Map; - -/** - * Type of transactional execution abort. - * For more details on different abort types please see - * shared/vm/runtime/rtmLocking.hpp - */ -public enum AbortType { - XABORT(0), - RETRIABLE(1), - MEM_CONFLICT(2), - BUF_OVERFLOW(3), - DEBUG_BREAKPOINT(4), - NESTED_ABORT(5); - - private final int type; - private static final Map<Integer, AbortType> LOOKUP_MAP = new HashMap<>(); - - static { - for (AbortType abortType : AbortType.values()) { - Asserts.assertFalse(LOOKUP_MAP.containsKey(abortType.type), - "Abort type values should be unique."); - LOOKUP_MAP.put(abortType.type, abortType); - } - } - - private AbortType(int type) { - this.type = type; - } - - /** - * Returns AbortProvoker for aborts represented by this abort type. - * - * @return an AbortProvoker instance - */ - public AbortProvoker provoker() { - return AbortType.createNewProvoker(this); - } - - public static AbortType lookup(int type) { - Asserts.assertLT(type, AbortType.values().length, - "Unknown abort type."); - return LOOKUP_MAP.get(type); - } - - /** - * Returns transaction execution abort provoker for specified abortion type. - * - * @param type a type of abort which will be forced by returned - * AbortProvoker instance. - * @return AbortProvoker instance that will force abort of specified type - * @throws RuntimeException if there is no provoker for specified type - */ - private static AbortProvoker createNewProvoker(AbortType type) { - switch (type) { - case XABORT: - return new XAbortProvoker(); - case MEM_CONFLICT: - return new MemoryConflictProvoker(); - case BUF_OVERFLOW: - return new BufferOverflowProvoker(); - case NESTED_ABORT: - return new NestedAbortProvoker(); - default: - throw new RuntimeException("No provoker exists for type " - + type.name()); - } - } - - @Override - public String toString() { - return Integer.toString(type); - } -} diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/BufferOverflowProvoker.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/BufferOverflowProvoker.java deleted file mode 100644 index 6a3ab4e35aa1b..0000000000000 --- a/test/hotspot/jtreg/compiler/testlibrary/rtm/BufferOverflowProvoker.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.testlibrary.rtm; - -/** - * In order to provoke transactional execution abort due to - * internal's buffer overflow BufferOverflowProvoker modifies - * 1MB of BYTES during single transaction. - */ -class BufferOverflowProvoker extends AbortProvoker { - /** - * To force buffer overflow abort we modify memory region with - * size more then L1d cache size. - */ - private static final int MORE_THAN_L1D_SIZE = 1024 * 1024; - private static final byte[] DATA = new byte[MORE_THAN_L1D_SIZE]; - - @Override - public void forceAbort() { - synchronized(monitor) { - for (int i = 0; i < BufferOverflowProvoker.DATA.length; i++) { - BufferOverflowProvoker.DATA[i]++; - } - } - } -} diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/BusyLock.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/BusyLock.java deleted file mode 100644 index 79120a64136f7..0000000000000 --- a/test/hotspot/jtreg/compiler/testlibrary/rtm/BusyLock.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.testlibrary.rtm; - -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.CyclicBarrier; - -/** - * Test case for busy lock scenario. - * One thread enters the monitor and sleep for a while. - * Another thread is blocked on the same monitor. - */ -public class BusyLock implements CompilableTest, Runnable { - private static final int DEFAULT_TIMEOUT = 1000; - private final CyclicBarrier barrier; - - // Following field have to be static in order to avoid escape analysis. - @SuppressWarnings("UnsuedDeclaration") - private static int field = 0; - protected final Object monitor; - protected final int timeout; - - public BusyLock() { - this(BusyLock.DEFAULT_TIMEOUT); - } - - public BusyLock(int timeout) { - this.timeout = timeout; - this.monitor = new Object(); - this.barrier = new CyclicBarrier(2); - } - - @Override - public void run() { - try { - synchronized (monitor) { - barrier.await(); - Thread.sleep(timeout); - } - } catch (InterruptedException | BrokenBarrierException e) { - throw new RuntimeException("Synchronization error happened.", e); - } - } - - public void syncAndTest() { - try { - // wait until monitor is locked by a ::run method - barrier.await(); - } catch (InterruptedException | BrokenBarrierException e) { - throw new RuntimeException("Synchronization error happened.", e); - } - test(); - } - - public void test() { - synchronized(monitor) { - BusyLock.field++; - } - } - - @Override - public String getMethodWithLockName() { - return this.getClass().getName() + "::test"; - } - - @Override - public String[] getMethodsToCompileNames() { - return new String[] { getMethodWithLockName() }; - } - - /** - * Usage: - * BusyLock [ <inflate monitor> [ <timeout> ] ] - * - * Default values are: - * <ul> - * <li>inflate monitor = {@code true}</li> - * <li>timeout = {@code BusyLock.DEFAULT_TIMEOUT}</li> - * </ul> - */ - public static void main(String args[]) throws Exception { - int timeoutValue = BusyLock.DEFAULT_TIMEOUT; - boolean inflateMonitor = true; - - if (args.length > 0 ) { - inflateMonitor = Boolean.valueOf(args[0]); - - if (args.length > 1) { - timeoutValue = Integer.valueOf(args[1]); - } - } - - BusyLock busyLock = new BusyLock(timeoutValue); - - if (inflateMonitor) { - AbortProvoker.inflateMonitor(busyLock.monitor); - } - - Thread t = new Thread(busyLock); - t.start(); - busyLock.syncAndTest(); - t.join(); - } -} diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/CompilableTest.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/CompilableTest.java deleted file mode 100644 index da701fa30a65d..0000000000000 --- a/test/hotspot/jtreg/compiler/testlibrary/rtm/CompilableTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.testlibrary.rtm; - -/** - * Interface for test scenarios that contain methods - * that should be compiled. - */ -public interface CompilableTest { - /** - * @return array with methods' names that should be compiled. - */ - String[] getMethodsToCompileNames(); - - /** - * @return name of method with RTM-elided lock. - */ - String getMethodWithLockName(); -} diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/MemoryConflictProvoker.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/MemoryConflictProvoker.java deleted file mode 100644 index 7926c9e23b45b..0000000000000 --- a/test/hotspot/jtreg/compiler/testlibrary/rtm/MemoryConflictProvoker.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.testlibrary.rtm; - -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.CyclicBarrier; - -/** - * To force transactional execution abort due to memory conflict - * one thread should access memory region from transactional region - * while another thread should modify the same memory region. - * Since this scenario is based on the race condition between threads - * you should not expect some particular amount of aborts. - */ -class MemoryConflictProvoker extends AbortProvoker { - // Following field have to be static in order to avoid escape analysis. - @SuppressWarnings("UnsuedDeclaration") - private static int field = 0; - private static final int INNER_ITERATIONS = 10000; - private final CyclicBarrier barrier; - /** - * This thread will access and modify memory region - * from outside of the transaction. - */ - private final Runnable conflictingThread; - - public MemoryConflictProvoker() { - this(new Object()); - } - - public MemoryConflictProvoker(Object monitor) { - super(monitor); - barrier = new CyclicBarrier(2); - conflictingThread = () -> { - try { - barrier.await(); - } catch (Exception e) { - throw new RuntimeException(e); - } - for (int i = 0; i < MemoryConflictProvoker.INNER_ITERATIONS; i++) { - MemoryConflictProvoker.field++; - } - }; - } - - /** - * Accesses and modifies memory region from within the transaction. - */ - public void transactionalRegion() { - for (int i = 0; i < MemoryConflictProvoker.INNER_ITERATIONS; i++) { - synchronized(monitor) { - MemoryConflictProvoker.field--; - } - } - } - - @Override - public void forceAbort() { - try { - Thread t = new Thread(conflictingThread); - t.start(); - try { - barrier.await(); - } catch (InterruptedException | BrokenBarrierException e) { - throw new RuntimeException(e); - } - transactionalRegion(); - t.join(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - @Override - public String getMethodWithLockName() { - return this.getClass().getName() + "::transactionalRegion"; - } -} diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/NestedAbortProvoker.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/NestedAbortProvoker.java deleted file mode 100644 index 7123f2d562f66..0000000000000 --- a/test/hotspot/jtreg/compiler/testlibrary/rtm/NestedAbortProvoker.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.testlibrary.rtm; - -import java.util.Arrays; - -/** - * In order to force nested transaction abort NestedAbortProvoker - * invoke BufferOverflowProvoker from transactional region. - */ -class NestedAbortProvoker extends AbortProvoker { - // Following field have to be static in order to avoid escape analysis. - @SuppressWarnings("UnsuedDeclaration") - private static int field = 0; - private final AbortProvoker nestedAbortProvoker; - - public NestedAbortProvoker() { - this.nestedAbortProvoker = new XAbortProvoker(monitor); - } - - @Override - public void forceAbort() { - synchronized(monitor) { - NestedAbortProvoker.field++; - nestedAbortProvoker.forceAbort(); - NestedAbortProvoker.field--; - } - } - - @Override - public String[] getMethodsToCompileNames() { - String nestedProvokerMethods[] - = nestedAbortProvoker.getMethodsToCompileNames(); - String methods[] = Arrays.copyOf(nestedProvokerMethods, - nestedProvokerMethods.length + 1); - methods[methods.length - 1] = getMethodWithLockName(); - return methods; - } -} diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMLockingStatistics.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMLockingStatistics.java deleted file mode 100644 index 351b1a96bd83a..0000000000000 --- a/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMLockingStatistics.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.testlibrary.rtm; - -import java.util.EnumMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Wrapper for +UsePreciseRTMLockingStatistics output. - * - * Example of locking statistics: - * - * java/lang/ClassLoader.loadClass@7 - * # rtm locks total (estimated): 6656 - * # rtm lock aborts (total): 10000 - * # rtm lock aborts 0 (abort instruction ): 9999 - * # rtm lock aborts 1 (may succeed on retry): 9999 - * # rtm lock aborts 2 (thread conflict ): 0 - * # rtm lock aborts 3 (buffer overflow ): 1 - * # rtm lock aborts 4 (debug or trap hit ): 0 - * # rtm lock aborts 5 (maximum nested depth): 0 - */ -public class RTMLockingStatistics { - /** - * Pattern for aborts per abort type entries. - */ - private static final Pattern ABORT_PATTERN; - - /** - * Pattern for whole statistics. - */ - private static final Pattern RTM_LOCKING_STATISTICS_PATTERN; - - static { - String abortRe - = "# rtm lock aborts\\s+(?<type>[0-9]+)\\s+\\([a-z\\s]+\\):\\s(?<count>[0-9]+)"; - - ABORT_PATTERN = Pattern.compile(abortRe); - RTM_LOCKING_STATISTICS_PATTERN = Pattern.compile( - "(?<className>[^.\n]+)\\." + - "(?<methodName>[^@\n]+)@(?<bci>[0-9]+)\n" + - "# rtm locks total \\(estimated\\):\\s*" + - "(?<totalLocks>[0-9]+)\n" + - "# rtm lock aborts\\s+\\(total\\):\\s*(?<totalAborts>[0-9]+)\n" + - "(?<abortStats>(" + abortRe + "\n)+)"); - } - - private final long totalLocks; - private final long totalAborts; - private final String className; - private final String methodName; - private final int bci; - private final Map<AbortType, Long> aborts = new EnumMap<>(AbortType.class); - - /** - * Constructs RTMLockingStatistics from matcher captured statistics entry. - * @param matcher Matcher captured statistics entry. - */ - private RTMLockingStatistics(Matcher matcher) { - className = matcher.group("className"); - methodName = matcher.group("methodName"); - bci = Integer.valueOf(matcher.group("bci")); - totalLocks = Long.valueOf(matcher.group("totalLocks")); - totalAborts = Long.valueOf(matcher.group("totalAborts")); - - Matcher abortMatcher = ABORT_PATTERN.matcher(matcher. - group("abortStats")); - - while (abortMatcher.find()) { - int type = Integer.valueOf(abortMatcher.group("type")); - long count = Long.valueOf(abortMatcher.group("count")); - setAborts(AbortType.lookup(type), count); - } - } - - - /** - * Parses string and return all founded RTM locking statistics entries. - * - * @param str the string to be parsed. - * @return list with all founded RTM locking statistics entries or - * empty list if nothing was found. - */ - public static List<RTMLockingStatistics> fromString(String str) { - List<RTMLockingStatistics> statistics = new LinkedList<>(); - Matcher matcher = RTM_LOCKING_STATISTICS_PATTERN.matcher(str); - - while (matcher.find()) { - RTMLockingStatistics lock = new RTMLockingStatistics(matcher); - statistics.add(lock); - } - - return statistics; - } - - /** - * Parses string and return all founded RTM locking statistics entries - * for locks in method {@code methodName}. - * - * @param methodName a name of the method for locks from which statistics - * should be gathered. - * @param str the string to be parsed. - * @return list with all founded RTM locking statistics entries or - * empty list if nothing was found. - */ - public static List<RTMLockingStatistics> fromString(String methodName, - String str) { - String formattedMethodName = formatMethodName(methodName); - - List<RTMLockingStatistics> statisticsForMethod = new LinkedList<>(); - for (RTMLockingStatistics statistics : fromString(str)) { - if (statistics.getLockName().startsWith(formattedMethodName)) { - statisticsForMethod.add(statistics); - } - } - return statisticsForMethod; - } - - /** - * Formats method's name so it will have the same format as - * in rtm locking statistics. - * - * <pre> - * Example: - * com/example/Klass::method => com/example/Klass.method - * com/example/Klass.method => com/example/Klass.method - * com.example.Klass::method => com/example/Klass.method - * com.example.Klass.method => com/example/Klass.method - * </pre> - * - * @param methodName method's name that should be formatted. - * @return formatted method's name. - */ - private static String formatMethodName(String methodName) { - String m[]; - if (methodName.contains("::")) { - m = methodName.split("::"); - } else { - int splitAt = methodName.lastIndexOf('.'); - m = new String[2]; - m[0] = methodName.substring(0, splitAt); - m[1] = methodName.substring(splitAt + 1); - } - return String.format("%s.%s", m[0].replaceAll("\\.", "/"), m[1]); - } - - /** - * Returns name of lock for which this statistics was collected. - * Lock name has following format: - * <class name>.<method name>@<bci> - * - * @return name of lock. - */ - public String getLockName() { - return String.format("%s.%s@%d", className, methodName, bci); - } - - /** - * Returns aborts count for specified abort type. - * - * @param type an abort type. - * @return count of aborts. - */ - public long getAborts(AbortType type) { - return aborts.getOrDefault(type, 0L); - } - - /** - * Sets aborts count for specified abort type. - * - * @param type an abort type. - * @param count count of aborts. - */ - public void setAborts(AbortType type, long count) { - aborts.put(type, count); - } - - public long getTotalLocks() { - return totalLocks; - } - - public long getTotalAborts() { - return totalAborts; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append(getLockName()).append('\n'); - builder.append(String.format("# rtm locks total (estimated): %d\n", - getTotalLocks())); - builder.append(String.format("# rtm lock aborts: %d\n", - getTotalLocks())); - - for (AbortType type : AbortType.values()) { - builder.append(String.format("# rtm lock aborts %s %d\n", - type.toString(), getAborts(type))); - } - return builder.toString(); - } -} diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMTestBase.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMTestBase.java deleted file mode 100644 index b6535e65428c3..0000000000000 --- a/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMTestBase.java +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.testlibrary.rtm; - -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.process.ProcessTools; -import jdk.test.lib.Utils; -import jdk.test.lib.cli.CommandLineOptionTest; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Auxiliary methods used for RTM testing. - */ -public class RTMTestBase { - private static final String RTM_STATE_CHANGE_REASON = "rtm_state_change"; - /** - * We don't parse compilation log as XML-document and use regular - * expressions instead, because in some cases it could be - * malformed. - */ - private static final String FIRED_UNCOMMON_TRAP_PATTERN_TEMPLATE - = "<uncommon_trap thread='[0-9]+' reason='%s'"; - private static final String INSTALLED_UNCOMMON_TRAP_PATTERN_TEMPLATE - = "<uncommon_trap bci='[0-9]+' reason='%s'"; - - /** - * Executes RTM test in a new JVM started with {@code options} cli options. - * - * @param test test case to execute. - * @param options additional options for VM - * @throws Exception when something went wrong. - */ - public static OutputAnalyzer executeRTMTest(CompilableTest test, - String... options) throws Exception { - ProcessBuilder processBuilder - = ProcessTools.createLimitedTestJavaProcessBuilder( - RTMTestBase.prepareTestOptions(test, options)); - OutputAnalyzer outputAnalyzer - = new OutputAnalyzer(processBuilder.start()); - System.out.println(outputAnalyzer.getOutput()); - return outputAnalyzer; - } - - /** - * Executes test case and save compilation log to {@code logFileName}. - * - * @param logFileName a name of compilation log file - * @param test a test case to execute case to execute - * @param options additional options to VM - * @return OutputAnalyzer for started test case - * @throws Exception when something went wrong - */ - public static OutputAnalyzer executeRTMTest(String logFileName, - CompilableTest test, String... options) throws Exception { - ProcessBuilder processBuilder - = ProcessTools.createLimitedTestJavaProcessBuilder( - RTMTestBase.prepareTestOptions(logFileName, test, options)); - OutputAnalyzer outputAnalyzer - = new OutputAnalyzer(processBuilder.start()); - - System.out.println(outputAnalyzer.getOutput()); - - return outputAnalyzer; - } - - /** - * Finds count of uncommon traps with reason {@code reason} installed - * during compilation. - * - * @param compilationLogFile a path to file with LogCompilation output. - * @param reason reason of installed uncommon traps. - * @return count of installed uncommon traps with reason {@code reason}. - * @throws IOException - */ - public static int installedUncommonTraps(String compilationLogFile, - String reason)throws IOException { - String pattern = String.format( - RTMTestBase.INSTALLED_UNCOMMON_TRAP_PATTERN_TEMPLATE, - reason); - return RTMTestBase.findTraps(compilationLogFile, pattern); - } - - /** - * Finds count of uncommon traps with reason <i>rtm_state_change</i> - * installed during compilation. - * - * @param compilationLogFile a path to file with LogCompilation output. - * @return count of installed uncommon traps with reason - * <i>rtm_state_change</i>. - * @throws IOException - */ - public static int installedRTMStateChangeTraps(String compilationLogFile) - throws IOException { - return RTMTestBase.installedUncommonTraps(compilationLogFile, - RTMTestBase.RTM_STATE_CHANGE_REASON); - } - - /** - * Finds count of fired uncommon traps with reason {@code reason}. - * - * @param compilationLogFile a path to file with LogCompilation output. - * @param reason a reason of fired uncommon traps. - * @return count of fired uncommon traps with reason {@code reason}. - * @throws IOException - */ - public static int firedUncommonTraps(String compilationLogFile, - String reason) throws IOException { - String pattern = String.format( - RTMTestBase.FIRED_UNCOMMON_TRAP_PATTERN_TEMPLATE, - reason); - return RTMTestBase.findTraps(compilationLogFile, pattern); - } - - /** - * Finds count of fired uncommon traps with reason <i>rtm_state_change</i>. - * - * @param compilationLogFile a path to file with LogCompilation output. - * @return count of fired uncommon traps with reason - * <i>rtm_state_change</i>. - * @throws IOException - */ - public static int firedRTMStateChangeTraps(String compilationLogFile) - throws IOException { - return RTMTestBase.firedUncommonTraps(compilationLogFile, - RTMTestBase.RTM_STATE_CHANGE_REASON); - } - - /** - * Finds count of uncommon traps that matches regular - * expression in {@code re}. - * - * @param compilationLogFile a path to file with LogCompilation output. - * @param re regular expression to match uncommon traps. - * @throws IOException - */ - private static int findTraps(String compilationLogFile, String re) - throws IOException { - String compilationLog = RTMTestBase.fileAsString(compilationLogFile); - Pattern pattern = Pattern.compile(re); - Matcher matcher = pattern.matcher(compilationLog); - int traps = 0; - while (matcher.find()) { - traps++; - } - return traps; - } - - /** - * Returns file's content as a string. - * - * @param path a path to file to operate on. - * @return string with content of file. - * @throws IOException - */ - private static String fileAsString(String path) throws IOException { - byte[] fileAsBytes = Files.readAllBytes(Paths.get(path)); - return new String(fileAsBytes); - } - - /** - * Prepares VM options for test execution. - * This method get test java options, filter out all RTM-related options, - * adds CompileCommand=compileonly,method_name options for each method - * from {@code methodToCompile} and finally appends all {@code vmOpts}. - * - * @param test test case whose methods that should be compiled. - * If {@code null} then no additional <i>compileonly</i> - * commands will be added to VM options. - * @param vmOpts additional options to pass to VM. - * @return Array with VM options. - */ - private static String[] prepareTestOptions(CompilableTest test, - String... vmOpts) { - return RTMTestBase.prepareFilteredTestOptions(test, null, vmOpts); - } - - /** - * Prepares VM options for test execution. - * This method get test java options, filter out all RTM-related options - * and all options that matches regexps in {@code additionalFilters}, - * adds CompileCommand=compileonly,method_name options for each method - * from {@code methodToCompile} and finally appends all {@code vmOpts}. - * - * @param test test case whose methods that should be compiled. - * If {@code null} then no additional <i>compileonly</i> - * commands will be added to VM options. - * @param additionalFilters array with regular expression that will be - * used to filter out test java options. - * If {@code null} then no additional filters - * will be used. - * @param vmOpts additional options to pass to VM. - * @return array with VM options. - */ - private static String[] prepareFilteredTestOptions(CompilableTest test, - String[] additionalFilters, String... vmOpts) { - List<String> finalVMOpts = new LinkedList<>(); - String[] filters; - - if (additionalFilters != null) { - filters = Arrays.copyOf(additionalFilters, - additionalFilters.length + 1); - } else { - filters = new String[1]; - } - - filters[filters.length - 1] = "RTM"; - String[] filteredVMOpts = Utils.getFilteredTestJavaOpts(filters); - Collections.addAll(finalVMOpts, filteredVMOpts); - Collections.addAll(finalVMOpts, "-Xcomp", "-server", - "-XX:-TieredCompilation", "-XX:+UseRTMLocking", - CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS, - CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, - "-Xbootclasspath/a:.", "-XX:+WhiteBoxAPI", - "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED"); - - if (test != null) { - for (String method : test.getMethodsToCompileNames()) { - finalVMOpts.add("-XX:CompileCommand=compileonly," + method); - } - } - Collections.addAll(finalVMOpts, vmOpts); - return finalVMOpts.toArray(new String[finalVMOpts.size()]); - } - - /** - * Adds additional options for VM required for successful execution of test. - * - * @param logFileName a name of compilation log file - * @param test a test case to execute - * @param options additional options to VM - * @return an array with VM options - */ - private static String[] prepareTestOptions(String logFileName, - CompilableTest test, String... options) { - String[] preparedOptions = RTMTestBase.prepareFilteredTestOptions( - test, - new String[] { - "LogCompilation", - "LogFile" - }); - List<String> updatedOptions = new LinkedList<>(); - Collections.addAll(updatedOptions, preparedOptions); - Collections.addAll(updatedOptions, - "-XX:+LogCompilation", - "-XX:LogFile=" + logFileName); - Collections.addAll(updatedOptions, options); - - return updatedOptions.toArray(new String[updatedOptions.size()]); - } -} diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/XAbortProvoker.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/XAbortProvoker.java deleted file mode 100644 index 23b7b7792881f..0000000000000 --- a/test/hotspot/jtreg/compiler/testlibrary/rtm/XAbortProvoker.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package compiler.testlibrary.rtm; - -/** - * Current RTM locking implementation force transaction abort - * before native method call by explicit xabort(0) call. - */ -public class XAbortProvoker extends AbortProvoker { - - static { - try { - System.loadLibrary("XAbortProvoker"); - } catch (UnsatisfiedLinkError e) { - System.out.println("Could not load native library: " + e); - } - } - - public native int doAbort(); - - // Following field have to be static in order to avoid escape analysis. - @SuppressWarnings("UnsuedDeclaration") - private static int field = 0; - - public XAbortProvoker() { - this(new Object()); - } - - public XAbortProvoker(Object monitor) { - super(monitor); - } - - @Override - public void forceAbort() { - synchronized(monitor) { - XAbortProvoker.field = doAbort(); - } - } - - @Override - public String[] getMethodsToCompileNames() { - return new String[] { - getMethodWithLockName(), - XAbortProvoker.class.getName() + "::doAbort" - }; - } -} diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/libXAbortProvoker.c b/test/hotspot/jtreg/compiler/testlibrary/rtm/libXAbortProvoker.c deleted file mode 100644 index b87882771d4a3..0000000000000 --- a/test/hotspot/jtreg/compiler/testlibrary/rtm/libXAbortProvoker.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include "jni.h" - -/** - * Simply calling a JNI method from the JVM will abort any active transaction, - * so doAbort() does nothing special and only returns after being called. - * The transaction abortion happens right before the JNI method is called. - */ -JNIEXPORT int JNICALL -Java_compiler_testlibrary_rtm_XAbortProvoker_doAbort(JNIEnv *env, jobject o) { - return 0; -} diff --git a/test/hotspot/jtreg/compiler/vectorapi/TestVectorAddMulReduction.java b/test/hotspot/jtreg/compiler/vectorapi/TestVectorAddMulReduction.java new file mode 100644 index 0000000000000..549d9aa5d4946 --- /dev/null +++ b/test/hotspot/jtreg/compiler/vectorapi/TestVectorAddMulReduction.java @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2024, Arm Limited. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.vectorapi; + +import compiler.lib.ir_framework.*; + +import jdk.incubator.vector.DoubleVector; +import jdk.incubator.vector.FloatVector; +import jdk.incubator.vector.VectorOperators; +import jdk.incubator.vector.VectorSpecies; + +import java.util.Random; + +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; + +/** + * @test + * @bug 8320725 + * @library /test/lib / + * @summary Verify non-strictly ordered AddReductionVF/VD and MulReductionVF/VD + * nodes are generated in VectorAPI + * @modules jdk.incubator.vector + * @run driver compiler.vectorapi.TestVectorAddMulReduction + */ + +public class TestVectorAddMulReduction { + + private static final int SIZE = 1024; + private static final Random RD = Utils.getRandomInstance(); + + private static float[] fa; + private static float fres; + private static double[] da; + private static double dres; + + static { + fa = new float[SIZE]; + da = new double[SIZE]; + fres = 1; + dres = 1; + for (int i = 0; i < SIZE; i++) { + fa[i] = RD.nextFloat(); + da[i] = RD.nextDouble(); + } + } + + // Test add reduction operation for floats + @ForceInline + public static void testFloatAddKernel(VectorSpecies SPECIES, float[] f) { + for (int i = 0; i < SPECIES.loopBound(f.length); i += SPECIES.length()) { + var av = FloatVector.fromArray(SPECIES, f, i); + fres += av.reduceLanes(VectorOperators.ADD); + } + } + + @Test + @IR(counts = {IRNode.ADD_REDUCTION_VF, ">=1", "no_strict_order", ">=1"}, + failOn = {"requires_strict_order"}, + applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"}, + applyIf = {"MaxVectorSize", ">=8"}, + phase = CompilePhase.PRINT_IDEAL) + public static void testFloatAdd_64() { + testFloatAddKernel(FloatVector.SPECIES_64, fa); + } + + @Test + @IR(counts = {IRNode.ADD_REDUCTION_VF, ">=1", "no_strict_order", ">=1"}, + failOn = {"requires_strict_order"}, + applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"}, + applyIf = {"MaxVectorSize", ">=16"}, + phase = CompilePhase.PRINT_IDEAL) + public static void testFloatAdd_128() { + testFloatAddKernel(FloatVector.SPECIES_128, fa); + } + + @Test + @IR(counts = {IRNode.ADD_REDUCTION_VF, ">=1", "no_strict_order", ">=1"}, + failOn = {"requires_strict_order"}, + applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"}, + applyIf = {"MaxVectorSize", ">=32"}, + phase = CompilePhase.PRINT_IDEAL) + public static void testFloatAdd_256() { + testFloatAddKernel(FloatVector.SPECIES_256, fa); + } + + @Test + @IR(counts = {IRNode.ADD_REDUCTION_VF, ">=1", "no_strict_order", ">=1"}, + failOn = {"requires_strict_order"}, + applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"}, + applyIf = {"MaxVectorSize", ">=64"}, + phase = CompilePhase.PRINT_IDEAL) + public static void testFloatAdd_512() { + testFloatAddKernel(FloatVector.SPECIES_512, fa); + } + + // Test add reduction operation for doubles + @ForceInline + public static void testDoubleAddKernel(VectorSpecies SPECIES, double[] d) { + for (int i = 0; i < SPECIES.loopBound(d.length); i += SPECIES.length()) { + var av = DoubleVector.fromArray(SPECIES, d, i); + dres += av.reduceLanes(VectorOperators.ADD); + } + } + + @Test + @IR(counts = {IRNode.ADD_REDUCTION_VD, ">=1", "no_strict_order", ">=1"}, + failOn = {"requires_strict_order"}, + applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"}, + applyIf = {"MaxVectorSize", ">=16"}, + phase = CompilePhase.PRINT_IDEAL) + public static void testDoubleAdd_128() { + testDoubleAddKernel(DoubleVector.SPECIES_128, da); + } + + @Test + @IR(counts = {IRNode.ADD_REDUCTION_VD, ">=1", "no_strict_order", ">=1"}, + failOn = {"requires_strict_order"}, + applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"}, + applyIf = {"MaxVectorSize", ">=32"}, + phase = CompilePhase.PRINT_IDEAL) + public static void testDoubleAdd_256() { + testDoubleAddKernel(DoubleVector.SPECIES_256, da); + } + + @Test + @IR(counts = {IRNode.ADD_REDUCTION_VD, ">=1", "no_strict_order", ">=1"}, + failOn = {"requires_strict_order"}, + applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"}, + applyIf = {"MaxVectorSize", ">=64"}, + phase = CompilePhase.PRINT_IDEAL) + public static void testDoubleAdd_512() { + testDoubleAddKernel(DoubleVector.SPECIES_512, da); + } + + // Test mul reduction operation for floats + // On aarch64, there are no direct vector mul reduction instructions for float/double mul reduction + // and scalar instructions are emitted for 64-bit/128-bit vectors. Thus MulReductionVF/VD nodes are generated + // only for vector length of 8B/16B on vectorAPI. + @ForceInline + public static void testFloatMulKernel(VectorSpecies SPECIES, float[] f) { + for (int i = 0; i < SPECIES.loopBound(f.length); i += SPECIES.length()) { + var av = FloatVector.fromArray(SPECIES, f, i); + fres += av.reduceLanes(VectorOperators.MUL); + } + } + + @Test + @IR(counts = {IRNode.MUL_REDUCTION_VF, ">=1", "no_strict_order", ">=1"}, + failOn = {"requires_strict_order"}, + applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"}, + applyIf = {"MaxVectorSize", ">=8"}, + phase = CompilePhase.PRINT_IDEAL) + public static void testFloatMul_64() { + testFloatMulKernel(FloatVector.SPECIES_64, fa); + } + + @Test + @IR(counts = {IRNode.MUL_REDUCTION_VF, ">=1", "no_strict_order", ">=1"}, + failOn = {"requires_strict_order"}, + applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"}, + applyIf = {"MaxVectorSize", ">=16"}, + phase = CompilePhase.PRINT_IDEAL) + public static void testFloatMul_128() { + testFloatMulKernel(FloatVector.SPECIES_128, fa); + } + + // Test mul reduction operation for doubles + @ForceInline + public static void testDoubleMulKernel(VectorSpecies SPECIES, double[] d) { + for (int i = 0; i < SPECIES.loopBound(d.length); i += SPECIES.length()) { + var av = DoubleVector.fromArray(SPECIES, d, i); + dres += av.reduceLanes(VectorOperators.MUL); + } + } + + @Test + @IR(counts = {IRNode.MUL_REDUCTION_VD, ">=1", "no_strict_order", ">=1"}, + failOn = {"requires_strict_order"}, + applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"}, + applyIf = {"MaxVectorSize", ">=16"}, + phase = CompilePhase.PRINT_IDEAL) + public static void testDoubleMul_128() { + testDoubleMulKernel(DoubleVector.SPECIES_128, da); + } + + public static void main(String[] args) { + TestFramework.runWithFlags("--add-modules=jdk.incubator.vector"); + } +} diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 74218cc55b340..da674d6a0471d 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -621,7 +621,7 @@ sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java 8039280 gene sun/security/provider/PolicyParser/PrincipalExpansionError.java 8039280 generic-all javax/net/ssl/SSLSession/CertMsgCheck.java 8326705 generic-all -sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java 8316183 linux-ppc64le +sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java 8316183,8333317 generic-all security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java#teliasonerarootcav1 8333640 generic-all diff --git a/test/jdk/java/awt/print/PrinterJob/PrintNullString.java b/test/jdk/java/awt/print/PrinterJob/PrintNullString.java index e4323b232a7d9..397dd2902d108 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintNullString.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintNullString.java @@ -148,7 +148,7 @@ private void paint(Graphics2D g2d) { // API 3: null & empty drawString(Iterator, int, int); try { g2d.drawString(nullIterator, 20, 120); - g2d.drawString("FAILURE: No NPE for null iterator, float", 20, 120); + g2d.drawString("FAILURE: No NPE for null iterator, int", 20, 120); } catch (NullPointerException e) { g2d.drawString("caught expected NPE for null iterator, int", 20, 120); } @@ -169,7 +169,7 @@ private void paint(Graphics2D g2d) { } try { - g2d.drawString(emptyIterator, 20, 180); + g2d.drawString(emptyIterator, 20.0f, 180.0f); g2d.drawString("FAILURE: No IAE for empty iterator, float", 20, 180); } catch (IllegalArgumentException e) { g2d.drawString("caught expected IAE for empty iterator, float", 20, 180); diff --git a/test/jdk/java/lang/instrument/NativeMethodPrefixApp.java b/test/jdk/java/lang/instrument/NativeMethodPrefixApp.java index 5060e67ca87b4..65cc54793cbed 100644 --- a/test/jdk/java/lang/instrument/NativeMethodPrefixApp.java +++ b/test/jdk/java/lang/instrument/NativeMethodPrefixApp.java @@ -25,6 +25,7 @@ import java.io.File; import java.nio.file.Path; import java.lang.management.*; +import java.util.zip.CRC32; import bootreporter.*; import jdk.test.lib.helpers.ClassFileInstaller; @@ -96,6 +97,10 @@ private static void launchApp(final Path agentJar) throws Exception { final OutputAnalyzer oa = ProcessTools.executeTestJava( "--enable-preview", // due to usage of ClassFile API PreviewFeature in the agent "-javaagent:" + agentJar.toString(), + // We disable CheckIntrinsic because the NativeMethodPrefixAgent modifies + // the native method names, which then causes a failure in the VM check + // for the presence of an intrinsic on a @IntrinsicCandidate native method. + "-XX:+UnlockDiagnosticVMOptions", "-XX:-CheckIntrinsics", NativeMethodPrefixApp.class.getName()); oa.shouldHaveExitValue(0); // make available stdout/stderr in the logs, even in case of successful completion @@ -109,6 +114,10 @@ private void run() throws Exception { java.lang.reflect.Array.getLength(new short[5]); RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean(); System.err.println(mxbean.getVmVendor()); + // Simply load a class containing an @IntrinsicCandidate on a native method + // to exercise the VM code which verifies the presence of the intrinsic + // implementation for that method. + System.err.println(new CRC32()); NativeMethodPrefixAgent.checkErrors();