提交 bdc9068a 编写于 作者: S sjohanss

8062672: JVM crashes during GC on various asserts which checks that HeapWord ptr is an oop

Summary: Crashes were caused by not disabling UseMemSetInBOT as should be done on sparc. Added support for picking up blkinit as a platform feature if available on Linux sparc. This is needed to avoid enabling UseMemSetInBOT when running on this platform.
Reviewed-by: jmasa, brutisso
上级 96f778a3
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#include "runtime/os.hpp" #include "runtime/os.hpp"
#include "vm_version_sparc.hpp" #include "vm_version_sparc.hpp"
static bool detect_niagara() { static bool cpuinfo_field_contains(const char* field, const char* value) {
char cpu[128]; char line[1024];
bool rv = false; bool rv = false;
FILE* fp = fopen("/proc/cpuinfo", "r"); FILE* fp = fopen("/proc/cpuinfo", "r");
...@@ -35,9 +35,10 @@ static bool detect_niagara() { ...@@ -35,9 +35,10 @@ static bool detect_niagara() {
return rv; return rv;
} }
while (!feof(fp)) { while (fgets(line, sizeof(line), fp) != NULL) {
if (fscanf(fp, "cpu\t\t: %100[^\n]", &cpu) == 1) { assert(strlen(line) < sizeof(line) - 1, "buffer line[1024] is too small.");
if (strstr(cpu, "Niagara") != NULL) { if (strncmp(line, field, strlen(field)) == 0) {
if (strstr(line, value) != NULL) {
rv = true; rv = true;
} }
break; break;
...@@ -45,10 +46,17 @@ static bool detect_niagara() { ...@@ -45,10 +46,17 @@ static bool detect_niagara() {
} }
fclose(fp); fclose(fp);
return rv; return rv;
} }
static bool detect_niagara() {
return cpuinfo_field_contains("cpu", "Niagara");
}
static bool detect_blkinit() {
return cpuinfo_field_contains("cpucaps", "blkinit");
}
int VM_Version::platform_features(int features) { int VM_Version::platform_features(int features) {
// Default to generic v9 // Default to generic v9
features = generic_v9_m; features = generic_v9_m;
...@@ -58,5 +66,9 @@ int VM_Version::platform_features(int features) { ...@@ -58,5 +66,9 @@ int VM_Version::platform_features(int features) {
features = niagara1_m | T_family_m; features = niagara1_m | T_family_m;
} }
if (detect_blkinit()) {
features |= blk_init_instructions_m;
}
return features; return features;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册