Skip to content

Commit

Permalink
8261966: macOS M1: report in hs_err log if we are running x86 code in…
Browse files Browse the repository at this point in the history
… emulation mode (Rosetta)

Reviewed-by: dcubed, mikael, dholmes
  • Loading branch information
Gerard Ziemski committed Mar 24, 2021
1 parent bc91596 commit 4d8e986
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/hotspot/os/bsd/os_bsd.cpp
Expand Up @@ -1401,7 +1401,13 @@ void os::get_summary_cpu_info(char* buf, size_t buflen) {
strncpy(machine, "", sizeof(machine));
}

snprintf(buf, buflen, "%s %s %d MHz", model, machine, mhz);
const char* emulated = "";
#ifdef __APPLE__
if (VM_Version::is_cpu_emulated()) {
emulated = " (EMULATED)";
}
#endif
snprintf(buf, buflen, "\"%s\" %s%s %d MHz", model, machine, emulated, mhz);
}

void os::print_memory_info(outputStream* st) {
Expand Down
5 changes: 5 additions & 0 deletions src/hotspot/share/runtime/os.cpp
Expand Up @@ -1033,6 +1033,11 @@ void os::print_environment_variables(outputStream* st, const char** env_list) {
void os::print_cpu_info(outputStream* st, char* buf, size_t buflen) {
// cpu
st->print("CPU:");
#ifdef __APPLE__
if (VM_Version::is_cpu_emulated()) {
st->print(" (EMULATED)");
}
#endif
st->print(" total %d", os::processor_count());
// It's not safe to query number of active processors after crash
// st->print("(active %d)", os::active_processor_count()); but we can
Expand Down

1 comment on commit 4d8e986

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.