< prev index next >

src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp

Print this page
rev 7854 : 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

*** 24,62 **** #include "precompiled.hpp" #include "runtime/os.hpp" #include "vm_version_sparc.hpp" ! static bool detect_niagara() { ! char cpu[128]; bool rv = false; FILE* fp = fopen("/proc/cpuinfo", "r"); if (fp == NULL) { return rv; } ! while (!feof(fp)) { ! if (fscanf(fp, "cpu\t\t: %100[^\n]", cpu) == 1) { ! if (strstr(cpu, "Niagara") != NULL) { rv = true; } break; } } fclose(fp); - return rv; } int VM_Version::platform_features(int features) { // Default to generic v9 features = generic_v9_m; if (detect_niagara()) { NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Detected Linux on Niagara");) features = niagara1_m | T_family_m; } return features; } --- 24,74 ---- #include "precompiled.hpp" #include "runtime/os.hpp" #include "vm_version_sparc.hpp" ! static bool cpuinfo_field_contains(const char* field, const char* value) { ! char line[1024]; bool rv = false; FILE* fp = fopen("/proc/cpuinfo", "r"); if (fp == NULL) { return rv; } ! while (fgets(line, sizeof(line), fp) != NULL) { ! assert(strlen(line) < sizeof(line) - 1, "buffer line[1024] is too small."); ! if (strncmp(line, field, strlen(field)) == 0) { ! if (strstr(line, value) != NULL) { rv = true; } break; } } fclose(fp); 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) { // Default to generic v9 features = generic_v9_m; if (detect_niagara()) { NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Detected Linux on Niagara");) features = niagara1_m | T_family_m; } + if (detect_blkinit()) { + features |= blk_init_instructions_m; + } + return features; }
< prev index next >