Skip to content

Commit

Permalink
8337421: RISC-V: client VM build failure after JDK-8335191
Browse files Browse the repository at this point in the history
  • Loading branch information
zifeihan committed Jul 30, 2024
1 parent 657c0bd commit 6f8b688
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 100 deletions.
10 changes: 5 additions & 5 deletions src/hotspot/cpu/riscv/stubGenerator_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5970,7 +5970,6 @@ static const int64_t right_3_bits = right_n_bits(3);
StubRoutines::_bigIntegerLeftShiftWorker = generate_bigIntegerLeftShift();
StubRoutines::_bigIntegerRightShiftWorker = generate_bigIntegerRightShift();
}
#endif // COMPILER2

if (UseSHA256Intrinsics) {
Sha2Generator sha2(_masm, this);
Expand All @@ -5984,10 +5983,6 @@ static const int64_t right_3_bits = right_n_bits(3);
StubRoutines::_sha512_implCompressMB = sha2.generate_sha512_implCompress(true);
}

generate_compare_long_strings();

generate_string_indexof_stubs();

if (UseMD5Intrinsics) {
StubRoutines::_md5_implCompress = generate_md5_implCompress(false, "md5_implCompress");
StubRoutines::_md5_implCompressMB = generate_md5_implCompress(true, "md5_implCompressMB");
Expand All @@ -6005,6 +6000,11 @@ static const int64_t right_3_bits = right_n_bits(3);
if (UseAdler32Intrinsics) {
StubRoutines::_updateBytesAdler32 = generate_updateBytesAdler32();
}
#endif // COMPILER2

generate_compare_long_strings();

generate_string_indexof_stubs();

#endif // COMPILER2_OR_JVMCI
}
Expand Down
191 changes: 96 additions & 95 deletions src/hotspot/cpu/riscv/vm_version_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@ void VM_Version::initialize() {
FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false);
}

if (FLAG_IS_DEFAULT(UseMD5Intrinsics)) {
FLAG_SET_DEFAULT(UseMD5Intrinsics, true);
}

if (FLAG_IS_DEFAULT(UsePoly1305Intrinsics)) {
FLAG_SET_DEFAULT(UsePoly1305Intrinsics, true);
}
Expand Down Expand Up @@ -235,7 +231,102 @@ void VM_Version::initialize() {
c2_initialize();
#endif // COMPILER2

// NOTE: Make sure codes dependent on UseRVV are put after c2_initialize(),
}

#ifdef COMPILER2
void VM_Version::c2_initialize() {
if (UseCMoveUnconditionally) {
FLAG_SET_DEFAULT(UseCMoveUnconditionally, false);
}

if (ConditionalMoveLimit > 0) {
FLAG_SET_DEFAULT(ConditionalMoveLimit, 0);
}

if (!UseRVV) {
FLAG_SET_DEFAULT(MaxVectorSize, 0);
FLAG_SET_DEFAULT(UseRVVForBigIntegerShiftIntrinsics, false);
} else {
if (!FLAG_IS_DEFAULT(MaxVectorSize) && MaxVectorSize != _initial_vector_length) {
warning("Current system does not support RVV vector length for MaxVectorSize %d. Set MaxVectorSize to %d",
(int)MaxVectorSize, _initial_vector_length);
}
MaxVectorSize = _initial_vector_length;
if (MaxVectorSize < 16) {
warning("RVV does not support vector length less than 16 bytes. Disabling RVV.");
UseRVV = false;
FLAG_SET_DEFAULT(MaxVectorSize, 0);
}
}

if (FLAG_IS_DEFAULT(UseVectorizedHashCodeIntrinsic)) {
FLAG_SET_DEFAULT(UseVectorizedHashCodeIntrinsic, true);
}

if (!UseZicbop) {
if (!FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
warning("Zicbop is not available on this CPU");
}
FLAG_SET_DEFAULT(AllocatePrefetchStyle, 0);
} else {
// Limit AllocatePrefetchDistance so that it does not exceed the
// static constraint of 512 defined in runtime/globals.hpp.
if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
FLAG_SET_DEFAULT(AllocatePrefetchDistance, MIN2(512, 3 * (int)CacheLineSize));
}
if (FLAG_IS_DEFAULT(AllocatePrefetchStepSize)) {
FLAG_SET_DEFAULT(AllocatePrefetchStepSize, (int)CacheLineSize);
}
if (FLAG_IS_DEFAULT(PrefetchScanIntervalInBytes)) {
FLAG_SET_DEFAULT(PrefetchScanIntervalInBytes, 3 * (int)CacheLineSize);
}
if (FLAG_IS_DEFAULT(PrefetchCopyIntervalInBytes)) {
FLAG_SET_DEFAULT(PrefetchCopyIntervalInBytes, 3 * (int)CacheLineSize);
}

if (PrefetchCopyIntervalInBytes != -1 &&
((PrefetchCopyIntervalInBytes & 7) || (PrefetchCopyIntervalInBytes >= 32768))) {
warning("PrefetchCopyIntervalInBytes must be -1, or a multiple of 8 and < 32768");
PrefetchCopyIntervalInBytes &= ~7;
if (PrefetchCopyIntervalInBytes >= 32768) {
PrefetchCopyIntervalInBytes = 32760;
}
}
if (AllocatePrefetchDistance !=-1 && (AllocatePrefetchDistance & 7)) {
warning("AllocatePrefetchDistance must be multiple of 8");
AllocatePrefetchDistance &= ~7;
}
if (AllocatePrefetchStepSize & 7) {
warning("AllocatePrefetchStepSize must be multiple of 8");
AllocatePrefetchStepSize &= ~7;
}
}

if (FLAG_IS_DEFAULT(UseMulAddIntrinsic)) {
FLAG_SET_DEFAULT(UseMulAddIntrinsic, true);
}

if (FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) {
FLAG_SET_DEFAULT(UseMultiplyToLenIntrinsic, true);
}

if (FLAG_IS_DEFAULT(UseSquareToLenIntrinsic)) {
FLAG_SET_DEFAULT(UseSquareToLenIntrinsic, true);
}

if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) {
FLAG_SET_DEFAULT(UseMontgomeryMultiplyIntrinsic, true);
}

if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) {
FLAG_SET_DEFAULT(UseMontgomerySquareIntrinsic, true);
}

if (FLAG_IS_DEFAULT(UseMD5Intrinsics)) {
FLAG_SET_DEFAULT(UseMD5Intrinsics, true);
}

// NOTE: Make sure codes dependent on UseRVV are put after MaxVectorSize initialize,
// as there are extra checks inside it which could disable UseRVV
// in some situations.

Expand Down Expand Up @@ -332,96 +423,6 @@ void VM_Version::initialize() {
FLAG_SET_DEFAULT(UseSHA, false);
}
}

#ifdef COMPILER2
void VM_Version::c2_initialize() {
if (UseCMoveUnconditionally) {
FLAG_SET_DEFAULT(UseCMoveUnconditionally, false);
}

if (ConditionalMoveLimit > 0) {
FLAG_SET_DEFAULT(ConditionalMoveLimit, 0);
}

if (!UseRVV) {
FLAG_SET_DEFAULT(MaxVectorSize, 0);
FLAG_SET_DEFAULT(UseRVVForBigIntegerShiftIntrinsics, false);
} else {
if (!FLAG_IS_DEFAULT(MaxVectorSize) && MaxVectorSize != _initial_vector_length) {
warning("Current system does not support RVV vector length for MaxVectorSize %d. Set MaxVectorSize to %d",
(int)MaxVectorSize, _initial_vector_length);
}
MaxVectorSize = _initial_vector_length;
if (MaxVectorSize < 16) {
warning("RVV does not support vector length less than 16 bytes. Disabling RVV.");
UseRVV = false;
FLAG_SET_DEFAULT(MaxVectorSize, 0);
}
}

if (FLAG_IS_DEFAULT(UseVectorizedHashCodeIntrinsic)) {
FLAG_SET_DEFAULT(UseVectorizedHashCodeIntrinsic, true);
}

if (!UseZicbop) {
if (!FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
warning("Zicbop is not available on this CPU");
}
FLAG_SET_DEFAULT(AllocatePrefetchStyle, 0);
} else {
// Limit AllocatePrefetchDistance so that it does not exceed the
// static constraint of 512 defined in runtime/globals.hpp.
if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
FLAG_SET_DEFAULT(AllocatePrefetchDistance, MIN2(512, 3 * (int)CacheLineSize));
}
if (FLAG_IS_DEFAULT(AllocatePrefetchStepSize)) {
FLAG_SET_DEFAULT(AllocatePrefetchStepSize, (int)CacheLineSize);
}
if (FLAG_IS_DEFAULT(PrefetchScanIntervalInBytes)) {
FLAG_SET_DEFAULT(PrefetchScanIntervalInBytes, 3 * (int)CacheLineSize);
}
if (FLAG_IS_DEFAULT(PrefetchCopyIntervalInBytes)) {
FLAG_SET_DEFAULT(PrefetchCopyIntervalInBytes, 3 * (int)CacheLineSize);
}

if (PrefetchCopyIntervalInBytes != -1 &&
((PrefetchCopyIntervalInBytes & 7) || (PrefetchCopyIntervalInBytes >= 32768))) {
warning("PrefetchCopyIntervalInBytes must be -1, or a multiple of 8 and < 32768");
PrefetchCopyIntervalInBytes &= ~7;
if (PrefetchCopyIntervalInBytes >= 32768) {
PrefetchCopyIntervalInBytes = 32760;
}
}
if (AllocatePrefetchDistance !=-1 && (AllocatePrefetchDistance & 7)) {
warning("AllocatePrefetchDistance must be multiple of 8");
AllocatePrefetchDistance &= ~7;
}
if (AllocatePrefetchStepSize & 7) {
warning("AllocatePrefetchStepSize must be multiple of 8");
AllocatePrefetchStepSize &= ~7;
}
}

if (FLAG_IS_DEFAULT(UseMulAddIntrinsic)) {
FLAG_SET_DEFAULT(UseMulAddIntrinsic, true);
}

if (FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) {
FLAG_SET_DEFAULT(UseMultiplyToLenIntrinsic, true);
}

if (FLAG_IS_DEFAULT(UseSquareToLenIntrinsic)) {
FLAG_SET_DEFAULT(UseSquareToLenIntrinsic, true);
}

if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) {
FLAG_SET_DEFAULT(UseMontgomeryMultiplyIntrinsic, true);
}

if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) {
FLAG_SET_DEFAULT(UseMontgomerySquareIntrinsic, true);
}
}
#endif // COMPILER2

void VM_Version::initialize_cpu_information(void) {
Expand Down

0 comments on commit 6f8b688

Please sign in to comment.