Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
104cdff
8385815: CRaC: Fix aarch64 failing testcases
jankratochvil Jun 2, 2026
6c349cd
Unify glibc features numbering
jankratochvil Jun 8, 2026
dd9a56c
Compilation fixes
jankratochvil Jun 8, 2026
2d75c5d
aarch64 compilation fixes
jankratochvil Jun 8, 2026
3fee099
Fix x86 testcases
jankratochvil Jun 8, 2026
e485a96
Fix whitespace
jankratochvil Jun 8, 2026
bed0d6b
Merge branch 'crac' into 8385815
jankratochvil Jun 28, 2026
efb045e
Merge fixup.
jankratochvil Jun 28, 2026
f5375da
Fix unused bits
jankratochvil Jun 28, 2026
1b08c8a
Keep CPU_FEATURE_FLAGS compatible for 2 parameters
jankratochvil Jun 28, 2026
73a7adf
Revert "Keep CPU_FEATURE_FLAGS compatible for 2 parameters"
jankratochvil Jun 29, 2026
e4a3e56
Remove: // TODO: check if there are any mandatory features and set th…
jankratochvil Jun 29, 2026
ec4b509
CPUFeaturesCheck: timeout in 1 minute
jankratochvil Jun 29, 2026
7f1f37b
Fix test/jdk/jdk/crac/engine/CheckCPUFeaturesMessageTest.java for the…
jankratochvil Jun 29, 2026
2f9bfa4
Fix test/jdk/jdk/crac/CPUFeatures/SimpleCPUFeaturesTest.java for the …
jankratochvil Jun 29, 2026
1383d22
Fix _features_names
jankratochvil Jul 1, 2026
df72e36
Fix _features_names on aarch64
jankratochvil Jul 1, 2026
32ad1cd
Fix _features_names for OSX
jankratochvil Jul 3, 2026
19ea634
Fix SortIncludes
jankratochvil Jul 3, 2026
61583ec
Fix aarch64 testcases
jankratochvil Jul 3, 2026
b59fff8
Fix CPUFeaturesAWS.sh
jankratochvil Jul 4, 2026
bcd03d7
Update src/hotspot/share/runtime/vm_features.inline.hpp
jankratochvil Jul 6, 2026
b3b8664
test/jdk/jdk/crac/ignoreRestore/MissingMetadataTest.java: Add aarch64
jankratochvil Jul 6, 2026
2972e2e
Update src/hotspot/share/runtime/vm_features.inline.hpp
jankratochvil Jul 6, 2026
33af019
Fix assertion on test/jdk/jdk/crac/CPUFeatures/SimpleCPUFeaturesTest.…
jankratochvil Jul 8, 2026
6566d0a
Fix compatibility of CPUFeatures mask with older JDKs
jankratochvil Jul 8, 2026
6745562
Fix CPUFeatures gap sanity check; fix also aarch64
jankratochvil Jul 8, 2026
fcfca73
Fix SimpleCPUFeaturesTest.java
jankratochvil Jul 9, 2026
e8da63a
Merge branch 'crac' into 8385815
jankratochvil Jul 9, 2026
dc6d1cb
Update CPU_SHA value
jankratochvil Jul 10, 2026
e56848a
Fix excessive error message newline
jankratochvil Jul 12, 2026
4d78c6c
shift the bits for jdk17
jankratochvil Jul 12, 2026
9e37a40
Fix aarch64 build
jankratochvil Jul 12, 2026
5f99e03
Fix aarch64
jankratochvil Jul 12, 2026
e5c19cf
CPUFeaturesAWS.sh: Fix random shutdowns
jankratochvil Jul 12, 2026
b48c809
Sync CPU Feature with jdk26
jankratochvil Jul 15, 2026
9ecabed
move/unify VM_Version::print_using_features_cr
jankratochvil Jul 15, 2026
6bc10e4
Make the mask compatible with jdk26
jankratochvil Jul 15, 2026
d2d6b56
Fix mandatory mmx
jankratochvil Jul 15, 2026
9234bbf
Try to make the testcase more safe against unexpected shutdowns
jankratochvil Jul 15, 2026
bacb940
FIx CheckCPUFeaturesMessageTest.java
jankratochvil Jul 15, 2026
fb2b917
Return CPU_SSE to CPUFeatures_mandatory()
jankratochvil Jul 16, 2026
96e0bab
Remove unconditional setting of MMX_UNUSED and FLUSH_UNUSED as they a…
jankratochvil Jul 16, 2026
31f0298
Revert "Remove unconditional setting of MMX_UNUSED and FLUSH_UNUSED a…
jankratochvil Jul 16, 2026
7a7e742
Update CPUFeatures_mandatory comments
jankratochvil Jul 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/vmStructs_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant)

#define DECLARE_INT_CPU_FEATURE_CONSTANT(id, name) GENERATE_VM_INT_CONSTANT_ENTRY(VM_Version::CPU_##id)
#define DECLARE_INT_CPU_FEATURE_CONSTANT(id, name, bit) GENERATE_VM_INT_CONSTANT_ENTRY(VM_Version::CPU_##id)
#define VM_INT_CPU_FEATURE_CONSTANTS CPU_FEATURE_FLAGS(DECLARE_INT_CPU_FEATURE_CONSTANT)

#endif // CPU_AARCH64_VMSTRUCTS_AARCH64_HPP
30 changes: 5 additions & 25 deletions src/hotspot/cpu/aarch64/vm_version_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
GLIBC_UNSUPPORTED(PACA ); \
GLIBC_UNSUPPORTED(SVEBITPERM); \
GLIBC_UNSUPPORTED(SVE2 ); \
GLIBC_UNSUPPORTED(STXR_PREFETCH_UNUSED); \
GLIBC_UNSUPPORTED(A53MAC ); \
GLIBC_UNSUPPORTED(ECV ); \
GLIBC_UNSUPPORTED(WFXT ); \
Expand Down Expand Up @@ -90,9 +91,7 @@ bool VM_Version::_ic_ivau_trapped;
VM_Version::VM_Features VM_Version::_features;
VM_Version::VM_Features VM_Version::_cpu_features;

#define DECLARE_CPU_FEATURE_NAME(id, name) XSTR(name),
const char* VM_Version::_features_names[] = { CPU_FEATURE_FLAGS(DECLARE_CPU_FEATURE_NAME)};
#undef DECLARE_CPU_FEATURE_NAME
const VM_Features::FeaturesNames VM_Version::_features_names = VM_Features::make_features_names();

static SpinWait get_spin_wait_desc() {
SpinWait spin_wait(OnSpinWaitInst, OnSpinWaitInstCount, OnSpinWaitDelay);
Expand Down Expand Up @@ -897,32 +896,13 @@ bool VM_Version::cpu_features_binary(VM_Version::VM_Features *data) {
}

VM_Features VM_Version::CPUFeatures_mandatory() {
// TODO: check if there are any mandatory features and set them here
return VM_Features();
}

VM_Features VM_Version::CPUFeatures_generic() {
VM_Features retval = CPUFeatures_mandatory();
retval.set_feature(CPU_FP);
retval.set_feature(CPU_ASIMD);
// PACA cannot be made compatible between CPUs that do and do not support it.
if (_cpu_features.supports_feature(CPU_PACA)) {
retval.set_feature(CPU_PACA);
}
if (_cpu_features.supports_feature(CPU_NOTPACA)) {
retval.set_feature(CPU_NOTPACA);
}
return retval;
}

void VM_Version::print_using_features_cr() {
if (_ignore_glibc_not_using) {
tty->print_raw_cr("CPU features are being kept intact as requested by -XX:CPUFeatures=ignore");
} else {
tty->print_raw("CPU features being used are: -XX:CPUFeatures=");
_features.print_numbers(*tty);
tty->cr();
}
// CPU_PACA and non-PACA processors cannot share the same image. Also we cannot disable glibc using features like CPU_LSE.
vm_exit_during_initialization("-XX:CPUFeatures=generic is not available on aarch64");
ShouldNotReachHere();
}

const char *VM_Version::restore_failed_check(const VM_Features *image_features, const VM_Features *current_features) {
Expand Down
64 changes: 32 additions & 32 deletions src/hotspot/cpu/aarch64/vm_version_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,46 +34,46 @@

class VM_Feature_Flag {
public:
#define CPU_FEATURE_FLAGS(decl) \
decl(FP, fp ) \
decl(ASIMD, asimd ) \
decl(EVTSTRM, evtstrm ) \
decl(AES, aes ) \
decl(PMULL, pmull ) \
decl(SHA1, sha1 ) \
decl(SHA2, sha256 ) \
decl(CRC32, crc32 ) \
decl(LSE, lse ) \
decl(FPHP, fphp ) \
decl(ASIMDHP, asimdhp ) \
decl(DCPOP, dcpop ) \
decl(SHA3, sha3 ) \
decl(SHA512, sha512 ) \
decl(SVE, sve ) \
decl(SB, sb ) \
decl(PACA, paca ) \
decl(SVEBITPERM, svebitperm) \
decl(SVE2, sve2 ) \
decl(A53MAC, a53mac ) \
decl(ECV, ecv ) \
decl(WFXT, wfxt ) \
decl(NOTPACA, notpaca ) \
#define CPU_FEATURE_FLAGS(decl) \
decl(FP, fp, 0) \
decl(ASIMD, asimd, 1) \
decl(EVTSTRM, evtstrm, 2) \
decl(AES, aes, 3) \
decl(PMULL, pmull, 4) \
decl(SHA1, sha1, 5) \
decl(SHA2, sha256, 6) \
decl(CRC32, crc32, 7) \
decl(LSE, lse, 8) \
decl(FPHP, fphp, 9) \
decl(ASIMDHP, asimdhp, 10) \
decl(DCPOP, dcpop, 11) \
decl(SHA3, sha3, 12) \
decl(SHA512, sha512, 13) \
decl(SVE, sve, 14) \
decl(SB, sb, 15) \
decl(PACA, paca, 16) \
decl(SVEBITPERM, svebitperm, 17) \
decl(SVE2, sve2, 18) \
decl(STXR_PREFETCH_UNUSED, stxr_prefetch, 19) \
decl(A53MAC, a53mac, 20) \
decl(ECV, ecv, 21) \
decl(WFXT, wfxt, 22) \
/* These features are added for CRaC. */ \
decl(NOTPACA, notpaca, 63) \
/**/

enum Feature_Flag {
#define DECLARE_CPU_FEATURE_FLAG(id, name) CPU_##id,
#define DECLARE_CPU_FEATURE_FLAG(id, name, bit) CPU_##id = (bit),
CPU_FEATURE_FLAGS(DECLARE_CPU_FEATURE_FLAG)
#undef DECLARE_CPU_FEATURE_FLAG
MAX_CPU_FEATURES
MAX_CPU_FEATURES,
LAST_CPU_FEATURE = CPU_WFXT,
FIRST_GLIBC_FEATURE = CPU_NOTPACA
};
};

#include "runtime/vm_features.inline.hpp"

class stringStream;

#define BIT_MASK(flag) (1ULL<<(flag))

class VM_Version : public Abstract_VM_Version, public VM_Feature_Flag {
friend class VMStructs;

Expand Down Expand Up @@ -214,10 +214,10 @@ class VM_Version : public Abstract_VM_Version, public VM_Feature_Flag {

static void cpu_features_init();

static const char* _features_names[];
static const VM_Features::FeaturesNames _features_names;

// Feature identification
#define CPU_FEATURE_DETECTION(id, name) \
#define CPU_FEATURE_DETECTION(id, name, bit) \
static bool supports_##name() { return supports_feature(CPU_##id); }
CPU_FEATURE_FLAGS(CPU_FEATURE_DETECTION)
#undef CPU_FEATURE_DETECTION
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/vmStructs_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant)

#define DECLARE_LONG_CPU_FEATURE_CONSTANT(id, name) GENERATE_VM_LONG_CONSTANT_ENTRY(VM_Version::CPU_##id)
#define DECLARE_LONG_CPU_FEATURE_CONSTANT(id, name, bit) GENERATE_VM_LONG_CONSTANT_ENTRY(VM_Version::CPU_##id)
#define VM_LONG_CPU_FEATURE_CONSTANTS CPU_FEATURE_FLAGS(DECLARE_LONG_CPU_FEATURE_CONSTANT)

#endif // CPU_X86_VMSTRUCTS_X86_HPP
34 changes: 20 additions & 14 deletions src/hotspot/cpu/x86/vm_version_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
/* These are handled as an exception in VM_Version::glibc_patch(). */ \
GLIBC_UNSUPPORTED(CMPXCHG16 ); \
GLIBC_UNSUPPORTED(LAHFSAHF ); \
/* Unused fields, see the enum definition. */ \
GLIBC_UNSUPPORTED(MMX_UNUSED ); \
GLIBC_UNSUPPORTED(FLUSH_UNUSED ); \
/**/

#if INCLUDE_CPU_FEATURE_ACTIVE
Expand All @@ -143,9 +146,7 @@ int VM_Version::_stepping;
bool VM_Version::_has_intel_jcc_erratum;
VM_Version::CpuidInfo VM_Version::_cpuid_info = { 0, };

#define DECLARE_CPU_FEATURE_NAME(id, name) XSTR(name),
const char* VM_Version::_features_names[] = { CPU_FEATURE_FLAGS(DECLARE_CPU_FEATURE_NAME)};
#undef DECLARE_CPU_FEATURE_NAME
const VM_Features::FeaturesNames VM_Version::_features_names = VM_Features::make_features_names();

// Address of instruction which causes SEGV
address VM_Version::_cpuinfo_segv_addr = nullptr;
Expand Down Expand Up @@ -2166,16 +2167,6 @@ bool VM_Version::cpu_features_binary(VM_Version::VM_Features *data) {
return true;
}

void VM_Version::print_using_features_cr() {
if (_ignore_glibc_not_using) {
tty->print_raw_cr("CPU features are being kept intact as requested by -XX:CPUFeatures=ignore");
} else {
tty->print_raw("CPU features being used are: -XX:CPUFeatures=");
_features.aot_code_cache_features().print_numbers(*tty);
tty->cr();
}
}

#ifdef COMPILER2
// Determine if it's running on Cascade Lake using default options.
bool VM_Version::is_default_intel_cascade_lake() {
Expand Down Expand Up @@ -3200,6 +3191,14 @@ VM_Version::VM_Features VM_Version::CpuidInfo::feature_flags() const {
if (std_cpuid1_ecx.bits.osxsave != 0) {
vm_features.set_feature(CPU_OSXSAVE);
}
if (sef_cpuid7_edx.bits.cet_ibt != 0) {
// GLIBC name for CPU_CET_IBT, we could share its bit in VM_Features.
vm_features.set_feature(CPU_IBT);
}
if (sef_cpuid7_ecx.bits.cet_ss != 0) {
// GLIBC name for CPU_CET_SS, we could share its bit in VM_Features.
vm_features.set_feature(CPU_SHSTK);
}
if (std_cpuid1_ecx.bits.xsave != 0) {
vm_features.set_feature(CPU_XSAVE);
}
Expand Down Expand Up @@ -3230,6 +3229,9 @@ VM_Version::VM_Features VM_Version::CpuidInfo::feature_flags() const {
}
}
}
// Unused fields, see the enum definition.
vm_features.set_feature(CPU_MMX_UNUSED);
vm_features.set_feature(CPU_FLUSH_UNUSED);

// Composite features.
if (supports_tscinv_bit() &&
Expand Down Expand Up @@ -3421,8 +3423,12 @@ bool VM_Version::is_intrinsic_supported(vmIntrinsicID id) {

VM_Features VM_Version::CPUFeatures_mandatory() {
VM_Features vm_features;
// JDK-8383881 in jdk28+ removed supports_sse(), supports_sse2(), supports_mmx() and supports_clflush().
// JDK-8383881 has kept the CPU_SSE and CPU_SSE2 bits for an unknown reason.
vm_features.set_feature(CPU_SSE);
Comment thread
jankratochvil marked this conversation as resolved.
vm_features.set_feature(CPU_SSE2);
vm_features.set_feature(CPU_MMX_UNUSED);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In JDK 26 we don't have MMX in mandatory, so why is it here?

vm_features.set_feature(CPU_FLUSH_UNUSED);
return vm_features;
}

Expand All @@ -3432,7 +3438,7 @@ VM_Features VM_Version::CPUFeatures_generic() {
#else
VM_Features retval = CPUFeatures_mandatory();
#ifdef AMD64
// The following options are all in /proc/cpuinfo of one of the first 64-bit CPUs - Atom D2700 (and Opteron 1352): https://superuser.com/q/1572306/1015048
// The following options are all in /proc/cpuinfo of one of the first 64-bit CPUs - Atom D2700 (and Opteron 1352): https://superuser.com/q/1572306/1015048
retval.set_feature(CPU_FXSR); // enabled in 'gcc -Q --help=target', not used by OpenJDK
retval.set_feature(CPU_TSC); // not used by gcc, used by OpenJDK
retval.set_feature(CPU_CX8); // gcc detects it to set cpu "pentium" (=32-bit only), used by OpenJDK
Expand Down
Loading