openjdk8: add arm64 support

This commit is contained in:
usersxx
2023-05-05 11:50:56 -05:00
committed by GitHub
parent 7c98704512
commit 674c6c47f1
3 changed files with 390 additions and 39 deletions
+44 -27
View File
@@ -5,8 +5,8 @@ PortSystem 1.0
name openjdk8-bootstrap
# use format based on macports:
# https://guide.macports.org/chunked/reference.portgroup.html#reference.portgroup.java
version 1.8.0_201
revision 1
version 8
revision 0
categories java devel
platforms darwin
supported_archs x86_64
@@ -14,40 +14,57 @@ license Restrictive/Distributable
maintainers {outlook.com:usersword123 @usersxx} openmaintainer
description Java 8 Boot JDK
long_description Java 8 Boot JDK to bootstrap Openjdk8 port
homepage https://javadl.sun.com/
distfiles AutoDL
master_sites ${homepage}webapps/download/${distfiles}?BundleId=236866_42970487e3af4f5aa5bca3f542482c60&dummy=
homepage https://openjdk.org/
checksums rmd160 b237dd06774127454df314a28fa6b297b50a0dbf \
sha256 5b52df4b3efd51480c40ad5abfa18a075365afbb2040bbc5e9f2db568435a6e2 \
size 257863467
if {${configure.build_arch} eq "x86_64"} {
set ver 1.8.0_201
master_sites ${homepage}webapps/download/${distfiles}?BundleId=236866_42970487e3af4f5aa5bca3f542482c60&dummy=
distfiles AutoDL
checksums rmd160 b237dd06774127454df314a28fa6b297b50a0dbf \
sha256 5b52df4b3efd51480c40ad5abfa18a075365afbb2040bbc5e9f2db568435a6e2 \
size 257863467
depends_extract port:xar
depends_extract port:xar
extract {
system -W ${workpath} "mkdir -p ${worksrcpath}/packages"
file copy ${distpath}/${distfiles} ${worksrcpath}/packages
system -W ${workpath} "mkdir -p ${worksrcpath}/dmg"
system -W ${workpath} "mkdir -p ${worksrcpath}/pkg"
system -W ${workpath} "mkdir -p ${worksrcpath}/files"
system -W ${worksrcpath}/packages "hdiutil attach ${worksrcpath}/packages/${distfiles} -mountroot ${worksrcpath}/dmg"
system -W ${worksrcpath}/dmg "cp ${worksrcpath}/dmg/*/*.pkg ${worksrcpath}/pkg"
system -W ${worksrcpath}/dmg "hdiutil detach ${worksrcpath}/dmg/*"
system -W ${worksrcpath}/pkg "mv ${worksrcpath}/pkg/*.pkg ${worksrcpath}/pkg/jdk${version}.pkg"
system -W ${worksrcpath}/pkg "${prefix}/bin/xar -xf ${worksrcpath}/pkg/jdk${version}.pkg -C ${worksrcpath}/files"
system -W ${worksrcpath} "cpio -i < ${worksrcpath}/files/jdk180201.pkg/Payload"
extract {
system -W ${workpath} "mkdir -p ${worksrcpath}/packages"
file copy ${distpath}/${distfiles} ${worksrcpath}/packages
system -W ${workpath} "mkdir -p ${worksrcpath}/dmg"
system -W ${workpath} "mkdir -p ${worksrcpath}/pkg"
system -W ${workpath} "mkdir -p ${worksrcpath}/files"
system -W ${worksrcpath}/packages "hdiutil attach ${worksrcpath}/packages/${distfiles} -mountroot ${worksrcpath}/dmg"
system -W ${worksrcpath}/dmg "cp ${worksrcpath}/dmg/*/*.pkg ${worksrcpath}/pkg"
system -W ${worksrcpath}/dmg "hdiutil detach ${worksrcpath}/dmg/*"
system -W ${worksrcpath}/pkg "mv ${worksrcpath}/pkg/*.pkg ${worksrcpath}/pkg/jdk${ver}.pkg"
system -W ${worksrcpath}/pkg "${prefix}/bin/xar -xf ${worksrcpath}/pkg/jdk${ver}.pkg -C ${worksrcpath}/files"
system -W ${worksrcpath} "cpio -i < ${worksrcpath}/files/jdk180201.pkg/Payload"
}
worksrcdir jdk${ver}
} elseif {${configure.build_arch} eq "arm64"} {
set ver 8.54.0.21
set openjdk_ver
master_sites https://cdn.azul.com/zulu/bin/
distname zulu${ver}-ca-jdk${openjdk_ver}-macosx_aarch64
checksums rmd160 cafab852e7263d3b1077b7b37f8d9019f4d3797a \
sha256 2cf0af3118dd4b6244724308b190587804a76ad7919b6da5c377392a1d4f8817 \
size 105926746
configure.cxx_stdlib libstdc++
worksrcdir ${distname}/zulu-8.jdk
}
use_configure no
build {}
worksrcdir jdk${version}
pre-destroot {
# MacPorts report `Contents/Home/jre/lib/libdeploy.dylib` as broken file during `port rev update`
# see https://trac.macports.org/ticket/65049
delete ${worksrcpath}/Contents/Home/jre/lib/libdeploy.dylib
if {${configure.build_arch} eq "x86_64"} {
pre-destroot {
# MacPorts report `Contents/Home/jre/lib/libdeploy.dylib` as broken file during `port rev update`
# see https://trac.macports.org/ticket/65049
delete ${worksrcpath}/Contents/Home/jre/lib/libdeploy.dylib
}
}
set path /Library/Java/JavaVirtualMachines/${name}
+28 -12
View File
@@ -15,14 +15,14 @@ version ${major}u${update}
revision 0
categories java devel
platforms darwin
supported_archs ppc x86_64
supported_archs ppc x86_64 arm64
license GPL-2+
maintainers {outlook.com:usersword123 @usersxx} openmaintainer
description OpenJDK 8
long_description JDK 8 and JRE 8 builds of OpenJDK, the Open-Source implementation \
of the Java Platform, Standard Edition, and related projects.
homepage https://openjdk.java.net/
master_sites https://git.openjdk.java.net/jdk8u/archive/refs/tags/
homepage https://openjdk.org/
master_sites https://git.openjdk.org/jdk8u/archive/refs/tags/
distname jdk${major}u${update}-ga
worksrcdir jdk8u-${distname}
@@ -37,7 +37,8 @@ patchfiles 0001-8181503-Can-t-compile-hotspot-with-c-11.patch \
0005-os_perf_bsd-allow-to-compile-with-ZERO-CPU.patch \
0006-Disable-C-11-warnings.patch \
0007-Added-macosx-bin-zero-jvm.cfg.patch \
0008-ExtendedOptionsImpl.c-define-TCP_KEEPINTVL-and-TCP_K.patch
0008-ExtendedOptionsImpl.c-define-TCP_KEEPINTVL-and-TCP_K.patch \
Support-arm64-and-fix-zero-assembler.diff
# NSFullSizeContentViewWindowMask is available since 10.10
if {${os.platform} eq "darwin" && ${os.major} < 14} {
@@ -58,7 +59,10 @@ if {${configure.build_arch} eq "ppc"} {
set datamodel 32
} elseif {${configure.build_arch} eq "x86_64"} {
set datamodel 64
} elseif {${configure.build_arch} eq "arm64"} {
set datamodel 64
}
configure.cmd ${prefix}/bin/bash ./configure
configure.pre_args --prefix=${tpath}
set bug_url "https://trac.macports.org/newticket?port=${name}"
@@ -72,8 +76,8 @@ configure.args --with-boot-jdk \
--with-extra-cxxflags="${configure.cxxflags}" \
--with-extra-ldflags="${configure.ldflags}" \
--with-milestone=fcs \
--with-vendor-name="OpenJDK Porters Group" \
--with-vendor-url="${homepage}" \
--with-vendor-name="MacPorts" \
--with-vendor-url="https://www.macports.org" \
--with-vendor-bug-url="${bug_url}" \
--with-vendor-vm-bug-url="${bug_url}" \
--with-update-version=${update} \
@@ -163,8 +167,12 @@ variant zero \
set archuc [string toupper ${configure.build_arch}]
depends_lib-append port:libffi
configure.args-append --with-jvm-variants=zero \
--with-extra-cflags="${configure.cflags} -I${prefix}/include -arch ${configure.build_arch}"
configure.args-delete --with-extra-cflags="${configure.cflags}"
--with-extra-cflags="${configure.cflags} -I${prefix}/include -arch ${configure.build_arch}" \
--with-extra-cxxflags="${configure.cxxflags} -arch ${configure.build_arch}" \
--with-extra-ldflags="${configure.ldflags} -I${prefix}/lib -arch ${configure.build_arch}"
configure.args-delete --with-extra-cflags="${configure.cflags}" \
--with-extra-cxxflags="${configure.cxxflags}" \
--with-extra-ldflags="${configure.ldflags}"
}
variant zeroshark \
@@ -172,9 +180,13 @@ variant zeroshark \
description {JVM with no assembler, zero interpreter and shark/llvm compiler backend} {
set archuc [string toupper ${configure.build_arch}]
depends_lib-append port:libffi
configure.args-append --with-jvm-variants=zero \
--with-extra-cflags="${configure.cflags} -I${prefix}/include -arch ${configure.build_arch}"
configure.args-delete --with-extra-cflags="${configure.cflags}"
configure.args-append --with-jvm-variants=zeroshark \
--with-extra-cflags="${configure.cflags} -I${prefix}/include -arch ${configure.build_arch}" \
--with-extra-cxxflags="${configure.cxxflags} -arch ${configure.build_arch}" \
--with-extra-ldflags="${configure.ldflags} -I${prefix}/lib -arch ${configure.build_arch}"
configure.args-delete --with-extra-cflags="${configure.cflags}" \
--with-extra-cxxflags="${configure.cxxflags}" \
--with-extra-ldflags="${configure.ldflags}"
}
if {![variant_isset debug] && ![variant_isset release]} {
@@ -185,7 +197,11 @@ if {![variant_isset core] && ![variant_isset zeroshark] && ![variant_isset zero]
if {${os.major} < 14} {
default_variants-append +zero
} else {
default_variants-append +server
if {${configure.build_arch} eq "x86_64"} {
default_variants-append +server
} elseif {${configure.build_arch} eq "arm64"} {
default_variants-append +zero
}
}
}
@@ -0,0 +1,318 @@
diff --git hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp
index 13838d9d34..d45973a917 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 hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp
index 9bbabfbcf9..a0ae9201f8 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 hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp
index 84d29b2113..a71f4b7855 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 hotspot/src/share/vm/runtime/java.cpp hotspot/src/share/vm/runtime/java.cpp
index 0a263b017c..b36671fb2d 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 hotspot/src/share/vm/runtime/sharedRuntime.cpp hotspot/src/share/vm/runtime/sharedRuntime.cpp
index 5f540247f9..41e3dc9254 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 hotspot/src/share/vm/runtime/stubRoutines.cpp hotspot/src/share/vm/runtime/stubRoutines.cpp
index d943248da0..5fc5f7618b 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 hotspot/src/share/vm/runtime/virtualspace.cpp hotspot/src/share/vm/runtime/virtualspace.cpp
index 66392b75f1..521afe6b1c 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 jdk/src/macosx/bin/java_md_macosx.c jdk/src/macosx/bin/java_md_macosx.c
index 6aa0eb588a..098c229bf3 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 jdk/src/macosx/native/sun/awt/AWTView.m jdk/src/macosx/native/sun/awt/AWTView.m
index 29dd6410ea..cd43be6bc4 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;