Skip to content

Commit 4d8e986

Browse files
author
Gerard Ziemski
committed
8261966: macOS M1: report in hs_err log if we are running x86 code in emulation mode (Rosetta)
Reviewed-by: dcubed, mikael, dholmes
1 parent bc91596 commit 4d8e986

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/hotspot/os/bsd/os_bsd.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1401,7 +1401,13 @@ void os::get_summary_cpu_info(char* buf, size_t buflen) {
14011401
strncpy(machine, "", sizeof(machine));
14021402
}
14031403

1404-
snprintf(buf, buflen, "%s %s %d MHz", model, machine, mhz);
1404+
const char* emulated = "";
1405+
#ifdef __APPLE__
1406+
if (VM_Version::is_cpu_emulated()) {
1407+
emulated = " (EMULATED)";
1408+
}
1409+
#endif
1410+
snprintf(buf, buflen, "\"%s\" %s%s %d MHz", model, machine, emulated, mhz);
14051411
}
14061412

14071413
void os::print_memory_info(outputStream* st) {

src/hotspot/share/runtime/os.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,11 @@ void os::print_environment_variables(outputStream* st, const char** env_list) {
10331033
void os::print_cpu_info(outputStream* st, char* buf, size_t buflen) {
10341034
// cpu
10351035
st->print("CPU:");
1036+
#ifdef __APPLE__
1037+
if (VM_Version::is_cpu_emulated()) {
1038+
st->print(" (EMULATED)");
1039+
}
1040+
#endif
10361041
st->print(" total %d", os::processor_count());
10371042
// It's not safe to query number of active processors after crash
10381043
// st->print("(active %d)", os::active_processor_count()); but we can

0 commit comments

Comments
 (0)