diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4 index 73b2e76511e..8b321480193 100644 --- common/autoconf/flags.m4 +++ common/autoconf/flags.m4 @@ -705,6 +705,10 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], # command line. CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)" LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)" + if test "$OPENJDK_TARGET_CPU_ARCH" = "xaarch64" + CFLAGS_JDK="${CFLAGS_JDK} -arch arm64" + LDFLAGS_JDK="${LDFLAGS_JDK} -arch arm64" + fi fi fi diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index b0b30333936..a2ae79c0402 100644 --- common/autoconf/generated-configure.sh +++ common/autoconf/generated-configure.sh @@ -13673,10 +13673,20 @@ test -n "$target_alias" && VAR_CPU_ENDIAN=little ;; arm*) - VAR_CPU=arm - VAR_CPU_ARCH=arm - VAR_CPU_BITS=32 - VAR_CPU_ENDIAN=little + case "$2" in + *darwin*) + VAR_CPU=aarch64 + VAR_CPU_ARCH=aarch64 + VAR_CPU_BITS=64 + VAR_CPU_ENDIAN=little + ;; + *) + VAR_CPU=arm + VAR_CPU_ARCH=arm + VAR_CPU_BITS=32 + VAR_CPU_ENDIAN=little + ;; + esac ;; aarch64) VAR_CPU=aarch64 @@ -13811,10 +13821,20 @@ $as_echo "$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" >&6; } VAR_CPU_ENDIAN=little ;; arm*) - VAR_CPU=arm - VAR_CPU_ARCH=arm - VAR_CPU_BITS=32 - VAR_CPU_ENDIAN=little + case "$2" in + *darwin*) + VAR_CPU=aarch64 + VAR_CPU_ARCH=aarch64 + VAR_CPU_BITS=64 + VAR_CPU_ENDIAN=little + ;; + *) + VAR_CPU=arm + VAR_CPU_ARCH=arm + VAR_CPU_BITS=32 + VAR_CPU_ENDIAN=little + ;; + esac ;; aarch64) VAR_CPU=aarch64 diff --git a/common/autoconf/platform.m4 b/common/autoconf/platform.m4 index 51df988f619..c51829f5f24 100644 --- common/autoconf/platform.m4 +++ common/autoconf/platform.m4 @@ -43,11 +43,20 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU], VAR_CPU_ENDIAN=little ;; arm*) - VAR_CPU=arm - VAR_CPU_ARCH=arm - VAR_CPU_BITS=32 - VAR_CPU_ENDIAN=little - ;; + case "$2" in + *darwin*) + VAR_CPU=aarch64 + VAR_CPU_ARCH=aarch64 + VAR_CPU_BITS=64 + VAR_CPU_ENDIAN=little + ;; + *) + VAR_CPU=arm + VAR_CPU_ARCH=arm + VAR_CPU_BITS=32 + VAR_CPU_ENDIAN=little + ;; + esac aarch64) VAR_CPU=aarch64 VAR_CPU_ARCH=aarch64 @@ -168,7 +177,7 @@ AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD], # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables. PLATFORM_EXTRACT_VARS_FROM_OS($build_os) - PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu) + PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu, $build_os) # ..and setup our own variables. (Do this explicitely to facilitate searching) OPENJDK_BUILD_OS="$VAR_OS" OPENJDK_BUILD_OS_API="$VAR_OS_API" @@ -190,7 +199,7 @@ AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD], # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables. PLATFORM_EXTRACT_VARS_FROM_OS($host_os) - PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu) + PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu, $host_os) # ... and setup our own variables. (Do this explicitely to facilitate searching) OPENJDK_TARGET_OS="$VAR_OS" OPENJDK_TARGET_OS_API="$VAR_OS_API" diff --git a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp index 13838d9d34e..d45973a9171 100644 --- hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp +++ hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp @@ -370,7 +370,7 @@ int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) { // Make the call intptr_t result[4 - LogBytesPerWord]; - ffi_call(handler->cif(), (void (*)()) function, result, arguments); + ffi_call(handler->cif(), CAST_TO_FN_PTR(void (*)(), function), result, arguments); // Change the thread state back to _thread_in_Java. // ThreadStateTransition::transition_from_native() cannot be used diff --git a/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp b/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp index 9bbabfbcf90..a0ae9201f8a 100644 --- hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp +++ hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp @@ -381,42 +381,42 @@ extern "C" { return 1; } - void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { + void _Copy_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) { if (from > to) { - jshort *end = from + count; + const jshort *end = from + count; while (from < end) *(to++) = *(from++); } else if (from < to) { - jshort *end = from; + const jshort *end = from + count; from += count - 1; to += count - 1; while (from >= end) *(to--) = *(from--); } } - void _Copy_conjoint_jints_atomic(jint* from, jint* to, size_t count) { + void _Copy_conjoint_jints_atomic(const jint* from, jint* to, size_t count) { if (from > to) { - jint *end = from + count; + const jint *end = from + count; while (from < end) *(to++) = *(from++); } else if (from < to) { - jint *end = from; + const jint *end = from; from += count - 1; to += count - 1; while (from >= end) *(to--) = *(from--); } } - void _Copy_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) { + void _Copy_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) { if (from > to) { - jlong *end = from + count; + const jlong *end = from + count; while (from < end) os::atomic_copy64(from++, to++); } else if (from < to) { - jlong *end = from; + const jlong *end = from; from += count - 1; to += count - 1; while (from >= end) @@ -424,22 +424,22 @@ extern "C" { } } - void _Copy_arrayof_conjoint_bytes(HeapWord* from, + void _Copy_arrayof_conjoint_bytes(const HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count); } - void _Copy_arrayof_conjoint_jshorts(HeapWord* from, + void _Copy_arrayof_conjoint_jshorts(const HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count * 2); } - void _Copy_arrayof_conjoint_jints(HeapWord* from, + void _Copy_arrayof_conjoint_jints(const HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count * 4); } - void _Copy_arrayof_conjoint_jlongs(HeapWord* from, + void _Copy_arrayof_conjoint_jlongs(const HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count * 8); diff --git a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp index 84d29b21131..a71f4b78556 100644 --- hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp +++ hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp @@ -412,42 +412,42 @@ extern "C" { } - void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { + void _Copy_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) { if (from > to) { - jshort *end = from + count; + const jshort *end = from + count; while (from < end) *(to++) = *(from++); } else if (from < to) { - jshort *end = from; + const jshort *end = from; from += count - 1; to += count - 1; while (from >= end) *(to--) = *(from--); } } - void _Copy_conjoint_jints_atomic(jint* from, jint* to, size_t count) { + void _Copy_conjoint_jints_atomic(const jint* from, jint* to, size_t count) { if (from > to) { - jint *end = from + count; + const jint *end = from + count; while (from < end) *(to++) = *(from++); } else if (from < to) { - jint *end = from; + const jint *end = from; from += count - 1; to += count - 1; while (from >= end) *(to--) = *(from--); } } - void _Copy_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) { + void _Copy_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) { if (from > to) { - jlong *end = from + count; + const jlong *end = from + count; while (from < end) os::atomic_copy64(from++, to++); } else if (from < to) { - jlong *end = from; + const jlong *end = from; from += count - 1; to += count - 1; while (from >= end) @@ -455,22 +455,22 @@ extern "C" { } } - void _Copy_arrayof_conjoint_bytes(HeapWord* from, + void _Copy_arrayof_conjoint_bytes(const HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count); } - void _Copy_arrayof_conjoint_jshorts(HeapWord* from, + void _Copy_arrayof_conjoint_jshorts(const HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count * 2); } - void _Copy_arrayof_conjoint_jints(HeapWord* from, + void _Copy_arrayof_conjoint_jshorts(const HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count * 4); } - void _Copy_arrayof_conjoint_jlongs(HeapWord* from, + void _Copy_arrayof_conjoint_jshorts(const HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count * 8); diff --git a/hotspot/src/share/vm/runtime/java.cpp b/hotspot/src/share/vm/runtime/java.cpp index 0a263b017cf..b36671fb2d7 100644 --- hotspot/src/share/vm/runtime/java.cpp +++ hotspot/src/share/vm/runtime/java.cpp @@ -60,6 +60,7 @@ #include "runtime/thread.inline.hpp" #include "runtime/timer.hpp" #include "runtime/vm_operations.hpp" +#include "runtime/vmThread.hpp" #include "services/memTracker.hpp" #include "utilities/dtrace.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp index 5f540247f9b..41e3dc92548 100644 --- hotspot/src/share/vm/runtime/sharedRuntime.cpp +++ hotspot/src/share/vm/runtime/sharedRuntime.cpp @@ -108,12 +108,14 @@ UncommonTrapBlob* SharedRuntime::_uncommon_trap_blob; //----------------------------generate_stubs----------------------------------- void SharedRuntime::generate_stubs() { +#ifndef ZERO _wrong_method_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method), "wrong_method_stub"); _wrong_method_abstract_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method_abstract), "wrong_method_abstract_stub"); _ic_miss_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method_ic_miss), "ic_miss_stub"); _resolve_opt_virtual_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_opt_virtual_call_C), "resolve_opt_virtual_call"); _resolve_virtual_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_virtual_call_C), "resolve_virtual_call"); _resolve_static_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_static_call_C), "resolve_static_call"); +#endif #ifdef COMPILER2 // Vectors are generated only by C2. @@ -2384,7 +2386,12 @@ void AdapterHandlerLibrary::initialize() { // throw AbstractMethodError just in case. // Pass wrong_method_abstract for the c2i transitions to return // AbstractMethodError for invalid invocations. - address wrong_method_abstract = SharedRuntime::get_handle_wrong_method_abstract_stub(); + address wrong_method_abstract = +#ifdef ZERO + NULL; +#else + SharedRuntime::get_handle_wrong_method_abstract_stub(); +#endif _abstract_method_handler = AdapterHandlerLibrary::new_entry(new AdapterFingerPrint(0, NULL), StubRoutines::throw_AbstractMethodError_entry(), wrong_method_abstract, wrong_method_abstract); diff --git a/hotspot/src/share/vm/runtime/stubRoutines.cpp b/hotspot/src/share/vm/runtime/stubRoutines.cpp index d943248da0f..5fc5f7618bf 100644 --- hotspot/src/share/vm/runtime/stubRoutines.cpp +++ hotspot/src/share/vm/runtime/stubRoutines.cpp @@ -201,18 +201,21 @@ static void test_arraycopy_func(address func, int alignment) { // Use middle of array to check that memory before it is not modified. address buffer = (address) round_to((intptr_t)&lbuffer[4], BytesPerLong); address buffer2 = (address) round_to((intptr_t)&lbuffer2[4], BytesPerLong); + + arraycopy_fn copyfunc = CAST_TO_FN_PTR(arraycopy_fn, func); + // do an aligned copy - ((arraycopy_fn)func)(buffer, buffer2, 0); + copyfunc(buffer, buffer2, 0); for (i = 0; i < sizeof(lbuffer); i++) { assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything"); } // adjust destination alignment - ((arraycopy_fn)func)(buffer, buffer2 + alignment, 0); + copyfunc(buffer, buffer2 + alignment, 0); for (i = 0; i < sizeof(lbuffer); i++) { assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything"); } // adjust source alignment - ((arraycopy_fn)func)(buffer + alignment, buffer2, 0); + copyfunc(buffer + alignment, buffer2, 0); for (i = 0; i < sizeof(lbuffer); i++) { assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything"); } diff --git a/hotspot/src/share/vm/runtime/virtualspace.cpp b/hotspot/src/share/vm/runtime/virtualspace.cpp index 66392b75f13..521afe6b1c8 100644 --- hotspot/src/share/vm/runtime/virtualspace.cpp +++ hotspot/src/share/vm/runtime/virtualspace.cpp @@ -356,7 +356,12 @@ ReservedHeapSpace::ReservedHeapSpace(size_t size, size_t alignment, ReservedCodeSpace::ReservedCodeSpace(size_t r_size, size_t rs_align, bool large) : +#ifdef __arm64__ + + ReservedSpace(r_size, rs_align, large, /*executable*/ false) { +#else ReservedSpace(r_size, rs_align, large, /*executable*/ true) { +#endif MemTracker::record_virtual_memory_type((address)base(), mtCode); } diff --git a/jdk/src/macosx/bin/java_md_macosx.c b/jdk/src/macosx/bin/java_md_macosx.c index 6aa0eb588ae..098c229bf36 100644 --- jdk/src/macosx/bin/java_md_macosx.c +++ jdk/src/macosx/bin/java_md_macosx.c @@ -228,6 +228,8 @@ static InvocationFunctions *GetExportedJNIFunctions() { preferredJVM = "client"; #elif defined(__x86_64__) preferredJVM = "server"; +#elif defined(__arm64__) + preferredJVM = "zero"; #else #error "Unknown architecture - needs definition" #endif diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m index 29dd6410eaf..cd43be6bc43 100644 --- jdk/src/macosx/native/sun/awt/AWTView.m +++ jdk/src/macosx/native/sun/awt/AWTView.m @@ -37,7 +37,6 @@ #import "JavaTextAccessibility.h" #import "JavaAccessibilityUtilities.h" #import "GeomUtilities.h" -#import "OSVersion.h" #import "CGLLayer.h" @interface AWTView() @@ -54,13 +53,6 @@ -(BOOL) isCodePointInUnicodeBlockNeedingIMEvent: (unichar) codePoint; //#define IM_DEBUG TRUE //#define EXTRA_DEBUG -static BOOL shouldUsePressAndHold() { - static int shouldUsePressAndHold = -1; - if (shouldUsePressAndHold != -1) return shouldUsePressAndHold; - shouldUsePressAndHold = !isSnowLeopardOrLower(); - return shouldUsePressAndHold; -} - @implementation AWTView @synthesize _dropTarget; @@ -83,7 +75,7 @@ - (id) initWithRect: (NSRect) rect fKeyEventsNeeded = NO; fProcessingKeystroke = NO; - fEnablePressAndHold = shouldUsePressAndHold(); + fEnablePressAndHold = YES; fInPressAndHold = NO; fPAHNeedsToSelect = NO;