RFR: 8253795: Implementation of JEP 391: macOS/AArch64 Port [v3]

Chris Plummer cjplummer at openjdk.java.net
Mon Jan 25 23:01:47 UTC 2021

On Mon, 25 Jan 2021 19:38:16 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> Please review the implementation of JEP 391: macOS/AArch64 Port.
>> It's heavily based on existing ports to linux/aarch64, macos/x86_64, and windows/aarch64. 
>> Major changes are in:
>> * src/hotspot/cpu/aarch64: support of the new calling convention (subtasks JDK-8253817, JDK-8253818)
>> * src/hotspot/os_cpu/bsd_aarch64: copy of os_cpu/linux_aarch64 with necessary adjustments (JDK-8253819)
>> * src/hotspot/share, test/hotspot/gtest: support of write-xor-execute (W^X), required on macOS/AArch64 platform. It's implemented with pthread_jit_write_protect_np provided by Apple. The W^X mode is local to a thread, so W^X mode change relates to the java thread state change (for java threads). In most cases, JVM executes in write-only mode, except when calling a generated stub like SafeFetch, which requires a temporary switch to execute-only mode. The same execute-only mode is enabled when a java thread executes in java or native states. This approach of managing W^X mode turned out to be simple and efficient enough.
>> * src/jdk.hotspot.agent: serviceability agent implementation (JDK-8254941)
> Anton Kozlov has updated the pull request incrementally with two additional commits since the last revision:
>  - Refactor CDS disabling
>  - Redo builsys support for aarch64-darwin

I looked through the SA changes. Overall looks good except for a couple of minor issues noted. For the most part it seems to have been boilerplate copy-n-paste from existing ports. If there is anything you want me to take a closer look at, let me know.

src/jdk.hotspot.agent/macosx/native/libsaproc/MacosxDebuggerLocal.m line 702:

> 700:   primitiveArray = (*env)->GetLongArrayElements(env, registerArray, NULL);
> 701: 
> 702: #undef REG_INDEX

I'm not so sure why the #undef and subsequent #define of REG_INDEX is needed since it seems to just get #define'd back to the same value.

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java line 2:

> 1: /*
> 2:  * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.

Update copyright.


Marked as reviewed by cjplummer (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/2200

More information about the core-libs-dev mailing list