Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8263407: SPARC64 detection fails on Athena (SPARC64-X) #106

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions src/hotspot/cpu/sparc/vm_version_sparc.cpp
Original file line number Diff line number Diff line change
@@ -160,7 +160,8 @@ void VM_Version::initialize() {

// Use compare and branch instructions if available.
if (has_cbcond()) {
if (FLAG_IS_DEFAULT(UseCBCond)) {
// cbcond suspected to cause issues on Athena CPUs
if (FLAG_IS_DEFAULT(UseCBCond) && !is_athena()) {
FLAG_SET_DEFAULT(UseCBCond, true);
}
} else if (UseCBCond) {
@@ -218,7 +219,7 @@ void VM_Version::initialize() {

char buf[512];
jio_snprintf(buf, sizeof(buf),
"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
"%s%s%s%s%s%s%s%s%s" "%s%s%s%s%s%s%s%s%s"
"%s%s%s%s%s%s%s",
(has_v9() ? "v9" : ""),
@@ -228,6 +229,7 @@ void VM_Version::initialize() {
(has_blk_init() ? ", blk_init" : ""),
(has_fmaf() ? ", fmaf" : ""),
(has_hpc() ? ", hpc" : ""),
(has_athena() ? ", athena" : ""),
(has_ima() ? ", ima" : ""),
(has_aes() ? ", aes" : ""),
(has_des() ? ", des" : ""),
7 changes: 7 additions & 0 deletions src/hotspot/cpu/sparc/vm_version_sparc.hpp
Original file line number Diff line number Diff line change
@@ -42,6 +42,7 @@ class VM_Version: public Abstract_VM_Version {
ISA_FMAF,
ISA_VIS3,
ISA_HPC,
ISA_FJATHHPC,
ISA_IMA,
ISA_AES,
ISA_DES,
@@ -104,6 +105,7 @@ class VM_Version: public Abstract_VM_Version {
ISA_fmaf_msk = UINT64_C(1) << ISA_FMAF,
ISA_vis3_msk = UINT64_C(1) << ISA_VIS3,
ISA_hpc_msk = UINT64_C(1) << ISA_HPC,
ISA_fjathhpc_msk = UINT64_C(1) << ISA_FJATHHPC,
ISA_ima_msk = UINT64_C(1) << ISA_IMA,
ISA_aes_msk = UINT64_C(1) << ISA_AES,
ISA_des_msk = UINT64_C(1) << ISA_DES,
@@ -253,6 +255,7 @@ class VM_Version: public Abstract_VM_Version {
static bool has_fmaf() { return (_features & ISA_fmaf_msk) != 0; }
static bool has_vis3() { return (_features & ISA_vis3_msk) != 0; }
static bool has_hpc() { return (_features & ISA_hpc_msk) != 0; }
static bool has_athena() { return (_features & ISA_fjathhpc_msk) != 0; }
static bool has_ima() { return (_features & ISA_ima_msk) != 0; }
static bool has_aes() { return (_features & ISA_aes_msk) != 0; }
static bool has_des() { return (_features & ISA_des_msk) != 0; }
@@ -306,6 +309,10 @@ class VM_Version: public Abstract_VM_Version {
return (_features & niagara2_msk) == niagara2_msk;
}

static bool is_athena() {
return has_athena() || has_athena_plus() || has_athena_plus2();
}

// Default prefetch block size on SPARC.
static uint prefetch_data_size() { return L2_data_cache_line_size(); }

14 changes: 9 additions & 5 deletions src/hotspot/os_cpu/solaris_sparc/vm_version_solaris_sparc.cpp
Original file line number Diff line number Diff line change
@@ -355,12 +355,17 @@ void VM_Version::platform_features() {

#ifndef AV_SPARC_FMAF
#define AV_SPARC_FMAF 0x00000100 // Fused Multiply-Add
#endif

#ifndef AV_SPARC_FJATHHPC
#define AV_SPARC_FJATHHPC 0x00001000 // Fujitsu HPC (Athena) instrs
#endif

if (av & AV_SPARC_ASI_BLK_INIT) features |= ISA_blk_init_msk;
if (av & AV_SPARC_FMAF) features |= ISA_fmaf_msk;
if (av & AV_SPARC_VIS3) features |= ISA_vis3_msk;
if (av & AV_SPARC_HPC) features |= ISA_hpc_msk;
if (av & AV_SPARC_FJATHHPC) features |= ISA_fjathhpc_msk;
if (av & AV_SPARC_IMA) features |= ISA_ima_msk;
if (av & AV_SPARC_AES) features |= ISA_aes_msk;
if (av & AV_SPARC_DES) features |= ISA_des_msk;
@@ -460,14 +465,13 @@ void VM_Version::platform_features() {

Sysinfo machine(SI_MACHINE);

bool is_sun4v = machine.match("sun4v"); // All Oracle SPARC + Fujitsu Athena+/++
bool is_sun4v = machine.match("sun4v"); // All Oracle SPARC + Fujitsu Athena(+/++)
bool is_sun4u = machine.match("sun4u"); // All other Fujitsu

// Handle Athena+/++ conservatively (simply because we are lacking info.).
// Handle Athena(+/++) conservatively (simply because we are lacking info.).

bool an_athena = has_athena_plus() || has_athena_plus2();
bool do_sun4v = is_sun4v && !an_athena;
bool do_sun4u = is_sun4u || an_athena;
bool do_sun4v = is_sun4v && !is_athena();
bool do_sun4u = is_sun4u || is_athena();

uint64_t synthetic = 0;