Skip to content
Permalink
Browse files
8263407: SPARC64 detection fails on Athena (SPARC64-X)
Reviewed-by: mdoerr
  • Loading branch information
Larry-N authored and RealCLanger committed Jul 9, 2021
1 parent 509170c commit 591d7690230a7e3e6d4e3877595c713243467343
@@ -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" : ""),
@@ -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(); }

@@ -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;

1 comment on commit 591d769

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 591d769 Jul 9, 2021

Please sign in to comment.