8315841: RISC-V: Check for hardware TSO support
Reviewed-by: vkempik, rehn, fyang
This commit is contained in:
parent
a04c6c1ac6
commit
35bccacb66
@ -109,6 +109,7 @@ define_pd_global(intx, InlineSmallCode, 1000);
|
||||
product(bool, UseZicbom, false, EXPERIMENTAL, "Use Zicbom instructions") \
|
||||
product(bool, UseZicbop, false, EXPERIMENTAL, "Use Zicbop instructions") \
|
||||
product(bool, UseZicboz, false, EXPERIMENTAL, "Use Zicboz instructions") \
|
||||
product(bool, UseZtso, false, EXPERIMENTAL, "Assume Ztso memory model") \
|
||||
product(bool, UseZihintpause, false, EXPERIMENTAL, \
|
||||
"Use Zihintpause instructions") \
|
||||
product(bool, UseRVVForBigIntegerShiftIntrinsics, true, \
|
||||
|
@ -376,8 +376,24 @@ class MacroAssembler: public Assembler {
|
||||
return ((predecessor & 0x3) << 2) | (successor & 0x3);
|
||||
}
|
||||
|
||||
void fence(uint32_t predecessor, uint32_t successor) {
|
||||
if (UseZtso) {
|
||||
if ((pred_succ_to_membar_mask(predecessor, successor) & StoreLoad) == StoreLoad) {
|
||||
// TSO allows for stores to be reordered after loads. When the compiler
|
||||
// generates a fence to disallow that, we are required to generate the
|
||||
// fence for correctness.
|
||||
Assembler::fence(predecessor, successor);
|
||||
} else {
|
||||
// TSO guarantees other fences already.
|
||||
}
|
||||
} else {
|
||||
// always generate fence for RVWMO
|
||||
Assembler::fence(predecessor, successor);
|
||||
}
|
||||
}
|
||||
|
||||
void pause() {
|
||||
fence(w, 0);
|
||||
Assembler::fence(w, 0);
|
||||
}
|
||||
|
||||
// prints msg, dumps registers and stops execution
|
||||
|
@ -210,6 +210,14 @@ void VM_Version::initialize() {
|
||||
unaligned_access.value() == MISALIGNED_FAST);
|
||||
}
|
||||
|
||||
#ifdef __riscv_ztso
|
||||
// Hotspot is compiled with TSO support, it will only run on hardware which
|
||||
// supports Ztso
|
||||
if (FLAG_IS_DEFAULT(UseZtso)) {
|
||||
FLAG_SET_DEFAULT(UseZtso, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (UseZbb) {
|
||||
if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
|
||||
FLAG_SET_DEFAULT(UsePopCountInstruction, true);
|
||||
|
@ -134,6 +134,7 @@ class VM_Version : public Abstract_VM_Version {
|
||||
decl(ext_Zicsr , "Zicsr" , RV_NO_FLAG_BIT, true , NO_UPDATE_DEFAULT) \
|
||||
decl(ext_Zifencei , "Zifencei" , RV_NO_FLAG_BIT, true , NO_UPDATE_DEFAULT) \
|
||||
decl(ext_Zic64b , "Zic64b" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZic64b)) \
|
||||
decl(ext_Ztso , "Ztso" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZtso)) \
|
||||
decl(ext_Zihintpause , "Zihintpause" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZihintpause)) \
|
||||
decl(mvendorid , "VendorId" , RV_NO_FLAG_BIT, false, NO_UPDATE_DEFAULT) \
|
||||
decl(marchid , "ArchId" , RV_NO_FLAG_BIT, false, NO_UPDATE_DEFAULT) \
|
||||
|
@ -236,6 +236,7 @@ void VM_Version::rivos_features() {
|
||||
ext_Zicsr.enable_feature();
|
||||
ext_Zifencei.enable_feature();
|
||||
ext_Zic64b.enable_feature();
|
||||
ext_Ztso.enable_feature();
|
||||
ext_Zihintpause.enable_feature();
|
||||
|
||||
unaligned_access.enable_feature(MISALIGNED_FAST);
|
||||
|
Loading…
Reference in New Issue
Block a user