8157141: Fix for JDK-8031290 is unnecessarily fragile
8166454: meminfo(2) has been available since Solaris 9
Reviewed-by: dholmes, kbarrett
--- a/hotspot/src/cpu/sparc/vm/vmStructs_sparc.hpp Mon Oct 17 19:12:28 2016 -0400
+++ b/hotspot/src/cpu/sparc/vm/vmStructs_sparc.hpp Mon Oct 17 19:18:08 2016 -0400
@@ -84,7 +84,6 @@
declare_constant(VM_Version::sun4v_m) \
declare_constant(VM_Version::blk_init_instructions_m) \
declare_constant(VM_Version::fmaf_instructions_m) \
- declare_constant(VM_Version::fmau_instructions_m) \
declare_constant(VM_Version::sparc64_family_m) \
declare_constant(VM_Version::M_family_m) \
declare_constant(VM_Version::T_family_m) \
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.hpp Mon Oct 17 19:12:28 2016 -0400
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.hpp Mon Oct 17 19:18:08 2016 -0400
@@ -34,30 +34,29 @@
protected:
enum Feature_Flag {
- v8_instructions = 0,
- hardware_mul32 = 1,
- hardware_div32 = 2,
- hardware_fsmuld = 3,
- hardware_popc = 4,
- v9_instructions = 5,
- vis1_instructions = 6,
- vis2_instructions = 7,
- sun4v_instructions = 8,
+ v8_instructions = 0,
+ hardware_mul32 = 1,
+ hardware_div32 = 2,
+ hardware_fsmuld = 3,
+ hardware_popc = 4,
+ v9_instructions = 5,
+ vis1_instructions = 6,
+ vis2_instructions = 7,
+ sun4v_instructions = 8,
blk_init_instructions = 9,
- fmaf_instructions = 10,
- fmau_instructions = 11,
- vis3_instructions = 12,
- cbcond_instructions = 13,
- sparc64_family = 14,
- M_family = 15,
- T_family = 16,
- T1_model = 17,
- sparc5_instructions = 18,
- aes_instructions = 19,
- sha1_instruction = 20,
- sha256_instruction = 21,
- sha512_instruction = 22,
- crc32c_instruction = 23
+ fmaf_instructions = 10,
+ vis3_instructions = 11,
+ cbcond_instructions = 12,
+ sparc64_family = 13,
+ M_family = 14,
+ T_family = 15,
+ T1_model = 16,
+ sparc5_instructions = 17,
+ aes_instructions = 18,
+ sha1_instruction = 19,
+ sha256_instruction = 20,
+ sha512_instruction = 21,
+ crc32c_instruction = 22
};
enum Feature_Flag_Set {
@@ -75,7 +74,6 @@
sun4v_m = 1 << sun4v_instructions,
blk_init_instructions_m = 1 << blk_init_instructions,
fmaf_instructions_m = 1 << fmaf_instructions,
- fmau_instructions_m = 1 << fmau_instructions,
vis3_instructions_m = 1 << vis3_instructions,
cbcond_instructions_m = 1 << cbcond_instructions,
sparc64_family_m = 1 << sparc64_family,
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java Mon Oct 17 19:12:28 2016 -0400
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java Mon Oct 17 19:18:08 2016 -0400
@@ -96,9 +96,6 @@
if ((config.vmVersionFeatures & config.sparcFmafInstructions) != 0) {
features.add(CPUFeature.FMAF);
}
- if ((config.vmVersionFeatures & config.sparcFmauInstructions) != 0) {
- features.add(CPUFeature.FMAU);
- }
if ((config.vmVersionFeatures & config.sparcSparc64Family) != 0) {
features.add(CPUFeature.SPARC64_FAMILY);
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotVMConfig.java Mon Oct 17 19:12:28 2016 -0400
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotVMConfig.java Mon Oct 17 19:18:08 2016 -0400
@@ -55,7 +55,6 @@
final int sparcSun4v = getConstant("VM_Version::sun4v_m", Integer.class);
final int sparcBlkInitInstructions = getConstant("VM_Version::blk_init_instructions_m", Integer.class);
final int sparcFmafInstructions = getConstant("VM_Version::fmaf_instructions_m", Integer.class);
- final int sparcFmauInstructions = getConstant("VM_Version::fmau_instructions_m", Integer.class);
final int sparcSparc64Family = getConstant("VM_Version::sparc64_family_m", Integer.class);
final int sparcMFamily = getConstant("VM_Version::M_family_m", Integer.class);
final int sparcTFamily = getConstant("VM_Version::T_family_m", Integer.class);
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARC.java Mon Oct 17 19:12:28 2016 -0400
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARC.java Mon Oct 17 19:18:08 2016 -0400
@@ -349,7 +349,6 @@
SUN4V,
BLK_INIT_INSTRUCTIONS,
FMAF,
- FMAU,
SPARC64_FAMILY,
M_FAMILY,
T_FAMILY,
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Mon Oct 17 19:12:28 2016 -0400
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Mon Oct 17 19:18:08 2016 -0400
@@ -2563,7 +2563,7 @@
uint64_t outdata[2];
uint_t validity = 0;
- if (os::Solaris::meminfo(&addr, 1, info_types, 2, outdata, &validity) < 0) {
+ if (meminfo(&addr, 1, info_types, 2, outdata, &validity) < 0) {
return false;
}
@@ -2601,7 +2601,7 @@
addrs_count++;
}
- if (os::Solaris::meminfo(addrs, addrs_count, info_types, types, outdata, validity) < 0) {
+ if (meminfo(addrs, addrs_count, info_types, types, outdata, validity) < 0) {
return NULL;
}
@@ -4160,9 +4160,6 @@
void report_error(const char* file_name, int line_no, const char* title,
const char* format, ...);
-// (Static) wrapper for getisax(2) call.
-os::Solaris::getisax_func_t os::Solaris::_getisax = 0;
-
// (Static) wrappers for the liblgrp API
os::Solaris::lgrp_home_func_t os::Solaris::_lgrp_home;
os::Solaris::lgrp_init_func_t os::Solaris::_lgrp_init;
@@ -4174,9 +4171,6 @@
os::Solaris::lgrp_cookie_stale_func_t os::Solaris::_lgrp_cookie_stale;
os::Solaris::lgrp_cookie_t os::Solaris::_lgrp_cookie = 0;
-// (Static) wrapper for meminfo() call.
-os::Solaris::meminfo_func_t os::Solaris::_meminfo = 0;
-
static address resolve_symbol_lazy(const char* name) {
address addr = (address) dlsym(RTLD_DEFAULT, name);
if (addr == NULL) {
@@ -4300,27 +4294,6 @@
return false;
}
-void os::Solaris::misc_sym_init() {
- address func;
-
- // getisax
- func = resolve_symbol_lazy("getisax");
- if (func != NULL) {
- os::Solaris::_getisax = CAST_TO_FN_PTR(getisax_func_t, func);
- }
-
- // meminfo
- func = resolve_symbol_lazy("meminfo");
- if (func != NULL) {
- os::Solaris::set_meminfo(CAST_TO_FN_PTR(meminfo_func_t, func));
- }
-}
-
-uint_t os::Solaris::getisax(uint32_t* array, uint_t n) {
- assert(_getisax != NULL, "_getisax not set");
- return _getisax(array, n);
-}
-
// int pset_getloadavg(psetid_t pset, double loadavg[], int nelem);
typedef long (*pset_getloadavg_type)(psetid_t pset, double loadavg[], int nelem);
static pset_getloadavg_type pset_getloadavg_ptr = NULL;
@@ -4351,10 +4324,6 @@
Solaris::initialize_system_info();
- // Initialize misc. symbols as soon as possible, so we can use them
- // if we need them.
- Solaris::misc_sym_init();
-
int fd = ::open("/dev/zero", O_RDWR);
if (fd < 0) {
fatal("os::init: cannot open /dev/zero (%s)", os::strerror(errno));
--- a/hotspot/src/os/solaris/vm/os_solaris.hpp Mon Oct 17 19:12:28 2016 -0400
+++ b/hotspot/src/os/solaris/vm/os_solaris.hpp Mon Oct 17 19:18:08 2016 -0400
@@ -73,8 +73,6 @@
LGRP_VIEW_OS // what's available to operating system
} lgrp_view_t;
- typedef uint_t (*getisax_func_t)(uint32_t* array, uint_t n);
-
typedef lgrp_id_t (*lgrp_home_func_t)(idtype_t idtype, id_t id);
typedef lgrp_cookie_t (*lgrp_init_func_t)(lgrp_view_t view);
typedef int (*lgrp_fini_func_t)(lgrp_cookie_t cookie);
@@ -86,11 +84,6 @@
lgrp_rsrc_t type);
typedef int (*lgrp_nlgrps_func_t)(lgrp_cookie_t cookie);
typedef int (*lgrp_cookie_stale_func_t)(lgrp_cookie_t cookie);
- typedef int (*meminfo_func_t)(const uint64_t inaddr[], int addr_count,
- const uint_t info_req[], int info_count,
- uint64_t outdata[], uint_t validity[]);
-
- static getisax_func_t _getisax;
static lgrp_home_func_t _lgrp_home;
static lgrp_init_func_t _lgrp_init;
@@ -102,8 +95,6 @@
static lgrp_cookie_stale_func_t _lgrp_cookie_stale;
static lgrp_cookie_t _lgrp_cookie;
- static meminfo_func_t _meminfo;
-
// Large Page Support
static bool is_valid_page_size(size_t bytes);
static size_t page_size_for_alignment(size_t alignment);
@@ -191,8 +182,6 @@
static void libthread_init();
static void synchronization_init();
static bool liblgrp_init();
- // Load miscellaneous symbols.
- static void misc_sym_init();
// This boolean allows users to forward their own non-matching signals
// to JVM_handle_solaris_signal, harmlessly.
static bool signal_handlers_are_installed;
@@ -272,17 +261,6 @@
}
static lgrp_cookie_t lgrp_cookie() { return _lgrp_cookie; }
- static bool supports_getisax() { return _getisax != NULL; }
- static uint_t getisax(uint32_t* array, uint_t n);
-
- static void set_meminfo(meminfo_func_t func) { _meminfo = func; }
- static int meminfo (const uint64_t inaddr[], int addr_count,
- const uint_t info_req[], int info_count,
- uint64_t outdata[], uint_t validity[]) {
- return _meminfo != NULL ? _meminfo(inaddr, addr_count, info_req, info_count,
- outdata, validity) : -1;
- }
-
static sigset_t* unblocked_signals();
static sigset_t* vm_signals();
static sigset_t* allowdebug_blocked_signals();
--- a/hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp Mon Oct 17 19:12:28 2016 -0400
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp Mon Oct 17 19:18:08 2016 -0400
@@ -343,8 +343,15 @@
#define _SC_L2CACHE_LINESZ 527 /* Size of L2 cache line */
#endif
+// Hardware capability bits that appeared after Solaris 11.1
+#ifndef AV_SPARC_FMAF
+#define AV_SPARC_FMAF 0x00000100 /* Fused Multiply-Add */
+#endif
+#ifndef AV2_SPARC_SPARC5
+#define AV2_SPARC_SPARC5 0x00000008 /* The 29 new fp and sub instructions */
+#endif
+
int VM_Version::platform_features(int features) {
- assert(os::Solaris::supports_getisax(), "getisax() must be available");
// Check 32-bit architecture.
if (Sysinfo(SI_ARCHITECTURE_32).match("sparc")) {
@@ -357,83 +364,36 @@
}
// Extract valid instruction set extensions.
- uint_t avs[2];
- uint_t avn = os::Solaris::getisax(avs, 2);
- assert(avn <= 2, "should return two or less av's");
- uint_t av = avs[0];
-
- log_info(os, cpu)("getisax(2) returned: " PTR32_FORMAT, av);
- if (avn > 1) {
- log_info(os, cpu)(" " PTR32_FORMAT, avs[1]);
- }
+ uint_t avs[AV_HW2_IDX + 1];
+ uint_t avn = getisax(avs, ARRAY_SIZE(avs));
- if (av & AV_SPARC_MUL32) features |= hardware_mul32_m;
- if (av & AV_SPARC_DIV32) features |= hardware_div32_m;
- if (av & AV_SPARC_FSMULD) features |= hardware_fsmuld_m;
- if (av & AV_SPARC_V8PLUS) features |= v9_instructions_m;
- if (av & AV_SPARC_POPC) features |= hardware_popc_m;
- if (av & AV_SPARC_VIS) features |= vis1_instructions_m;
- if (av & AV_SPARC_VIS2) features |= vis2_instructions_m;
- if (avn > 1) {
- uint_t av2 = avs[1];
-#ifndef AV2_SPARC_SPARC5
-#define AV2_SPARC_SPARC5 0x00000008 /* The 29 new fp and sub instructions */
-#endif
- if (av2 & AV2_SPARC_SPARC5) features |= sparc5_instructions_m;
+ log_info(os, cpu)("getisax(2) returned %d words:", avn);
+ for (int i = 0; i < avn; i++) {
+ log_info(os, cpu)(" word %d: " PTR32_FORMAT, i, avs[i]);
}
- // We only build on Solaris 10 and up, but some of the values below
- // are not defined on all versions of Solaris 10, so we define them,
- // if necessary.
-#ifndef AV_SPARC_ASI_BLK_INIT
-#define AV_SPARC_ASI_BLK_INIT 0x0080 /* ASI_BLK_INIT_xxx ASI */
-#endif
- if (av & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m;
-
-#ifndef AV_SPARC_FMAF
-#define AV_SPARC_FMAF 0x0100 /* Fused Multiply-Add */
-#endif
- if (av & AV_SPARC_FMAF) features |= fmaf_instructions_m;
-
-#ifndef AV_SPARC_FMAU
-#define AV_SPARC_FMAU 0x0200 /* Unfused Multiply-Add */
-#endif
- if (av & AV_SPARC_FMAU) features |= fmau_instructions_m;
-
-#ifndef AV_SPARC_VIS3
-#define AV_SPARC_VIS3 0x0400 /* VIS3 instruction set extensions */
-#endif
- if (av & AV_SPARC_VIS3) features |= vis3_instructions_m;
+ uint_t av1 = avs[AV_HW1_IDX];
+ if (av1 & AV_SPARC_MUL32) features |= hardware_mul32_m;
+ if (av1 & AV_SPARC_DIV32) features |= hardware_div32_m;
+ if (av1 & AV_SPARC_FSMULD) features |= hardware_fsmuld_m;
+ if (av1 & AV_SPARC_V8PLUS) features |= v9_instructions_m;
+ if (av1 & AV_SPARC_POPC) features |= hardware_popc_m;
+ if (av1 & AV_SPARC_VIS) features |= vis1_instructions_m;
+ if (av1 & AV_SPARC_VIS2) features |= vis2_instructions_m;
+ if (av1 & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m;
+ if (av1 & AV_SPARC_FMAF) features |= fmaf_instructions_m;
+ if (av1 & AV_SPARC_VIS3) features |= vis3_instructions_m;
+ if (av1 & AV_SPARC_CBCOND) features |= cbcond_instructions_m;
+ if (av1 & AV_SPARC_CRC32C) features |= crc32c_instruction_m;
+ if (av1 & AV_SPARC_AES) features |= aes_instructions_m;
+ if (av1 & AV_SPARC_SHA1) features |= sha1_instruction_m;
+ if (av1 & AV_SPARC_SHA256) features |= sha256_instruction_m;
+ if (av1 & AV_SPARC_SHA512) features |= sha512_instruction_m;
-#ifndef AV_SPARC_CBCOND
-#define AV_SPARC_CBCOND 0x10000000 /* compare and branch instrs supported */
-#endif
- if (av & AV_SPARC_CBCOND) features |= cbcond_instructions_m;
-
-#ifndef AV_SPARC_CRC32C
-#define AV_SPARC_CRC32C 0x20000000 /* crc32c instruction supported */
-#endif
- if (av & AV_SPARC_CRC32C) features |= crc32c_instruction_m;
-
-#ifndef AV_SPARC_AES
-#define AV_SPARC_AES 0x00020000 /* aes instrs supported */
-#endif
- if (av & AV_SPARC_AES) features |= aes_instructions_m;
-
-#ifndef AV_SPARC_SHA1
-#define AV_SPARC_SHA1 0x00400000 /* sha1 instruction supported */
-#endif
- if (av & AV_SPARC_SHA1) features |= sha1_instruction_m;
-
-#ifndef AV_SPARC_SHA256
-#define AV_SPARC_SHA256 0x00800000 /* sha256 instruction supported */
-#endif
- if (av & AV_SPARC_SHA256) features |= sha256_instruction_m;
-
-#ifndef AV_SPARC_SHA512
-#define AV_SPARC_SHA512 0x01000000 /* sha512 instruction supported */
-#endif
- if (av & AV_SPARC_SHA512) features |= sha512_instruction_m;
+ if (avn > AV_HW2_IDX) {
+ uint_t av2 = avs[AV_HW2_IDX];
+ if (av2 & AV2_SPARC_SPARC5) features |= sparc5_instructions_m;
+ }
// Determine the machine type.
if (Sysinfo(SI_MACHINE).match("sun4v")) {
--- a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp Mon Oct 17 19:12:28 2016 -0400
+++ b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp Mon Oct 17 19:18:08 2016 -0400
@@ -712,7 +712,6 @@
declare_constant(VM_Version::sun4v_m) \
declare_constant(VM_Version::blk_init_instructions_m) \
declare_constant(VM_Version::fmaf_instructions_m) \
- declare_constant(VM_Version::fmau_instructions_m) \
declare_constant(VM_Version::sparc64_family_m) \
declare_constant(VM_Version::M_family_m) \
declare_constant(VM_Version::T_family_m) \