提交 87c03b2f 编写于 作者: A anoll

8043913: remove legacy code in SPARC's VM_Version::platform_features

Summary: Kept only getisax(2) to determine platform features
Reviewed-by: kvn, roland
Contributed-by: NZoltan Majo <zoltan.majo@oracle.com>
上级 417a55c1
...@@ -293,9 +293,7 @@ static void do_sysinfo(int si, const char* string, int* features, int mask) { ...@@ -293,9 +293,7 @@ static void do_sysinfo(int si, const char* string, int* features, int mask) {
} }
int VM_Version::platform_features(int features) { int VM_Version::platform_features(int features) {
// getisax(2), SI_ARCHITECTURE_32, and SI_ARCHITECTURE_64 are assert(os::Solaris::supports_getisax(), "getisax() must be available");
// supported on Solaris 10 and later.
if (os::Solaris::supports_getisax()) {
// Check 32-bit architecture. // Check 32-bit architecture.
do_sysinfo(SI_ARCHITECTURE_32, "sparc", &features, v8_instructions_m); do_sysinfo(SI_ARCHITECTURE_32, "sparc", &features, v8_instructions_m);
...@@ -334,8 +332,9 @@ int VM_Version::platform_features(int features) { ...@@ -334,8 +332,9 @@ int VM_Version::platform_features(int features) {
if (av2 & AV2_SPARC_SPARC5) features |= sparc5_instructions_m; if (av2 & AV2_SPARC_SPARC5) features |= sparc5_instructions_m;
} }
// Next values are not defined before Solaris 10 // We only build on Solaris 10 and up, but some of the values below
// but Solaris 8 is used for jdk6 update builds. // are not defined on all versions of Solaris 10, so we define them,
// if necessary.
#ifndef AV_SPARC_ASI_BLK_INIT #ifndef AV_SPARC_ASI_BLK_INIT
#define AV_SPARC_ASI_BLK_INIT 0x0080 /* ASI_BLK_INIT_xxx ASI */ #define AV_SPARC_ASI_BLK_INIT 0x0080 /* ASI_BLK_INIT_xxx ASI */
#endif #endif
...@@ -381,42 +380,6 @@ int VM_Version::platform_features(int features) { ...@@ -381,42 +380,6 @@ int VM_Version::platform_features(int features) {
#endif #endif
if (av & AV_SPARC_SHA512) features |= sha512_instruction_m; if (av & AV_SPARC_SHA512) features |= sha512_instruction_m;
} else {
// getisax(2) failed, use the old legacy code.
#ifndef PRODUCT
if (PrintMiscellaneous && Verbose)
tty->print_cr("getisax(2) is not supported.");
#endif
char tmp;
size_t bufsize = sysinfo(SI_ISALIST, &tmp, 1);
char* buf = (char*) malloc(bufsize);
if (buf != NULL) {
if (sysinfo(SI_ISALIST, buf, bufsize) == bufsize) {
// Figure out what kind of sparc we have
char *sparc_string = strstr(buf, "sparc");
if (sparc_string != NULL) { features |= v8_instructions_m;
if (sparc_string[5] == 'v') {
if (sparc_string[6] == '8') {
if (sparc_string[7] == '-') { features |= hardware_mul32_m;
features |= hardware_div32_m;
} else if (sparc_string[7] == 'p') features |= generic_v9_m;
else features |= generic_v8_m;
} else if (sparc_string[6] == '9') features |= generic_v9_m;
}
}
// Check for visualization instructions
char *vis = strstr(buf, "vis");
if (vis != NULL) { features |= vis1_instructions_m;
if (vis[3] == '2') features |= vis2_instructions_m;
}
}
free(buf);
}
}
// Determine the machine type. // Determine the machine type.
do_sysinfo(SI_MACHINE, "sun4v", &features, sun4v_m); do_sysinfo(SI_MACHINE, "sun4v", &features, sun4v_m);
...@@ -430,27 +393,7 @@ int VM_Version::platform_features(int features) { ...@@ -430,27 +393,7 @@ int VM_Version::platform_features(int features) {
kstat_named_t* knm = (kstat_named_t *)ksp->ks_data; kstat_named_t* knm = (kstat_named_t *)ksp->ks_data;
for (int i = 0; i < ksp->ks_ndata; i++) { for (int i = 0; i < ksp->ks_ndata; i++) {
if (strcmp((const char*)&(knm[i].name),"implementation") == 0) { if (strcmp((const char*)&(knm[i].name),"implementation") == 0) {
#ifndef KSTAT_DATA_STRING
#define KSTAT_DATA_STRING 9
#endif
if (knm[i].data_type == KSTAT_DATA_CHAR) {
// VM is running on Solaris 8 which does not have value.str.
implementation = &(knm[i].value.c[0]);
} else if (knm[i].data_type == KSTAT_DATA_STRING) {
// VM is running on Solaris 10.
#ifndef KSTAT_NAMED_STR_PTR
// Solaris 8 was used to build VM, define the structure it misses.
struct str_t {
union {
char *ptr; /* NULL-term string */
char __pad[8]; /* 64-bit padding */
} addr;
uint32_t len; /* # bytes for strlen + '\0' */
};
#define KSTAT_NAMED_STR_PTR(knptr) (( (str_t*)&((knptr)->value) )->addr.ptr)
#endif
implementation = KSTAT_NAMED_STR_PTR(&knm[i]); implementation = KSTAT_NAMED_STR_PTR(&knm[i]);
}
#ifndef PRODUCT #ifndef PRODUCT
if (PrintMiscellaneous && Verbose) { if (PrintMiscellaneous && Verbose) {
tty->print_cr("cpu_info.implementation: %s", implementation); tty->print_cr("cpu_info.implementation: %s", implementation);
...@@ -461,6 +404,7 @@ int VM_Version::platform_features(int features) { ...@@ -461,6 +404,7 @@ int VM_Version::platform_features(int features) {
for (int i = 0; impl[i] != 0; i++) for (int i = 0; impl[i] != 0; i++)
impl[i] = (char)toupper((uint)impl[i]); impl[i] = (char)toupper((uint)impl[i]);
if (strstr(impl, "SPARC64") != NULL) { if (strstr(impl, "SPARC64") != NULL) {
features |= sparc64_family_m; features |= sparc64_family_m;
} else if (strstr(impl, "SPARC-M") != NULL) { } else if (strstr(impl, "SPARC-M") != NULL) {
...@@ -475,8 +419,10 @@ int VM_Version::platform_features(int features) { ...@@ -475,8 +419,10 @@ int VM_Version::platform_features(int features) {
if (strstr(impl, "SPARC") == NULL) { if (strstr(impl, "SPARC") == NULL) {
#ifndef PRODUCT #ifndef PRODUCT
// kstat on Solaris 8 virtual machines (branded zones) // kstat on Solaris 8 virtual machines (branded zones)
// returns "(unsupported)" implementation. // returns "(unsupported)" implementation. Solaris 8 is not
warning("kstat cpu_info implementation = '%s', should contain SPARC", impl); // supported anymore, but include this check to be on the
// safe side.
warning("kstat cpu_info implementation = '%s', assume generic SPARC", impl);
#endif #endif
implementation = "SPARC"; implementation = "SPARC";
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册