8253795: Implementation of JEP 391: macOS/AArch64 Port

8253816: Support macOS W^X
8253817: Support macOS Aarch64 ABI in Interpreter
8253818: Support macOS Aarch64 ABI for compiled wrappers
8253819: Implement os/cpu for macOS/AArch64
8253839: Update tests and JDK code for macOS/Aarch64
8254941: Implement Serviceability Agent for macOS/AArch64
8255776: Change build system for macOS/AArch64
8262903: [macos_aarch64] Thread::current() called on detached thread

Co-authored-by: Vladimir Kempik <vkempik@openjdk.org>
Co-authored-by: Bernhard Urban-Forster <burban@openjdk.org>
Co-authored-by: Ludovic Henry <luhenry@openjdk.org>
Co-authored-by: Monica Beckwith <mbeckwit@openjdk.org>
Reviewed-by: erikj, ihse, prr, cjplummer, stefank, gziemski, aph, mbeckwit, luhenry
This commit is contained in:
Anton Kozlov 2021-03-25 18:10:18 +00:00 committed by Vladimir Kempik
parent b006f22f1f
commit dbc9e4b50c
75 changed files with 2933 additions and 109 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, Azul Systems, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -106,6 +107,7 @@
#include "runtime/threadCritical.hpp"
#include "runtime/threadSMR.inline.hpp"
#include "runtime/threadStatisticalInfo.hpp"
#include "runtime/threadWXSetters.inline.hpp"
#include "runtime/timer.hpp"
#include "runtime/timerTrace.hpp"
#include "runtime/vframe.inline.hpp"
@ -323,6 +325,8 @@ Thread::Thread() {
// If the main thread creates other threads before the barrier set that is an error.
assert(Thread::current_or_null() == NULL, "creating thread before barrier set");
}
MACOS_AARCH64_ONLY(DEBUG_ONLY(_wx_init = false));
}
void Thread::initialize_tlab() {
@ -386,6 +390,8 @@ void Thread::call_run() {
register_thread_stack_with_NMT();
MACOS_AARCH64_ONLY(this->init_wx());
JFR_ONLY(Jfr::on_thread_start(this);)
log_debug(os, thread)("Thread " UINTX_FORMAT " stack dimensions: "
@ -2157,6 +2163,9 @@ void JavaThread::check_safepoint_and_suspend_for_native_trans(JavaThread *thread
// Note only the native==>VM/Java barriers can call this function and when
// thread state is _thread_in_native_trans.
void JavaThread::check_special_condition_for_native_trans(JavaThread *thread) {
// Enable WXWrite: called directly from interpreter native wrapper.
MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
check_safepoint_and_suspend_for_native_trans(thread);
// After returning from native, it could be that the stack frames are not
@ -3039,6 +3048,8 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
// Initialize the os module
os::init();
MACOS_AARCH64_ONLY(os::current_thread_enable_wx(WXWrite));
// Record VM creation timing statistics
TraceVmCreationTime create_vm_timer;
create_vm_timer.start();
@ -3142,6 +3153,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
main_thread->record_stack_base_and_size();
main_thread->register_thread_stack_with_NMT();
main_thread->set_active_handles(JNIHandleBlock::allocate_block());
MACOS_AARCH64_ONLY(main_thread->init_wx());
if (!main_thread->set_as_starting_thread()) {
vm_shutdown_during_initialization(