[packages/openjdk8] 'zero assembly' VM for x32
jajcus
jajcus at pld-linux.org
Tue Sep 22 08:30:32 CEST 2015
commit bd96d31d1badc559f493ab4d8fc78487be9db7c1
Author: Jacek Konieczny <jajcus at jajcus.net>
Date: Tue Sep 22 08:27:38 2015 +0200
'zero assembly' VM for x32
current_stack_pointer.patch | 14 ++++++
openjdk8.spec | 11 ++++-
x32.patch | 118 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 141 insertions(+), 2 deletions(-)
---
diff --git a/openjdk8.spec b/openjdk8.spec
index 88b01f2..5fdfbe2 100644
--- a/openjdk8.spec
+++ b/openjdk8.spec
@@ -1,9 +1,8 @@
#
# TODO:
# - use other system libs (libsctp?)
-# - build alternative VM for x32
# - include icedtea-sound?
-# - port PLD-specific changes from icedtea7?
+# - consider zeroshark (LLVM-based JIT) for x32
%bcond_with bootstrap # build a bootstrap version, using icedtea6
%bcond_without cacerts # don't include the default CA certificates
@@ -53,6 +52,8 @@ Patch4: system-libjpeg.patch
Patch5: system-libpng.patch
Patch6: system-lcms.patch
Patch7: system-pcsclite.patch
+Patch8: x32.patch
+Patch9: current_stack_pointer.patch
URL: http://openjdk.java.net/
BuildRequires: /usr/bin/jar
BuildRequires: alsa-lib-devel
@@ -418,6 +419,8 @@ done
%patch5 -p1
%patch6 -p1
%patch7 -p1
+%patch8 -p1
+%patch9 -p1
%build
# Make sure we have /proc mounted - otherwise idlc will fail later.
@@ -427,6 +430,7 @@ if [ ! -f /proc/self/stat ]; then
fi
cd common/autoconf
+rm generated-configure.sh
%{__autoconf} -o generated-configure.sh
cd ../..
@@ -445,6 +449,9 @@ chmod a+x configure
# disable-debug-symbols so openjdk debuginfo handling won't conflict with ours
%configure \
+%ifarch x32
+ --with-jvm-variants=zero \
+%endif
--with-extra-cflags="%{rpmcflags}" \
--with-extra-cxxflags="%{rpmcxxflags}" \
--with-extra-ldflags="%{rpmldflags}" \
diff --git a/current_stack_pointer.patch b/current_stack_pointer.patch
new file mode 100644
index 0000000..e3254f2
--- /dev/null
+++ b/current_stack_pointer.patch
@@ -0,0 +1,14 @@
+diff -dur jdk8u-jdk8u66-b02.orig/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp jdk8u-jdk8u66-b02/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp
+--- jdk8u-jdk8u66-b02.orig/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp 2015-07-22 19:12:56.000000000 +0200
++++ jdk8u-jdk8u66-b02/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp 2015-09-21 20:19:55.821171221 +0200
+@@ -55,8 +55,8 @@
+ #include "utilities/vmError.hpp"
+
+ address os::current_stack_pointer() {
+- address dummy = (address) &dummy;
+- return dummy;
++ // return the address of the current function
++ return (address)__builtin_frame_address(0);
+ }
+
+ frame os::get_sender_for_C_frame(frame* fr) {
diff --git a/x32.patch b/x32.patch
new file mode 100644
index 0000000..266061f
--- /dev/null
+++ b/x32.patch
@@ -0,0 +1,118 @@
+diff -durN jdk8u-jdk8u66-b02.orig/common/autoconf/platform.m4 jdk8u-jdk8u66-b02/common/autoconf/platform.m4
+--- jdk8u-jdk8u66-b02.orig/common/autoconf/platform.m4 2015-07-17 09:35:23.000000000 +0200
++++ jdk8u-jdk8u66-b02/common/autoconf/platform.m4 2015-09-21 13:18:18.439165925 +0200
+@@ -31,10 +31,20 @@
+ # First argument is the cpu name from the trip/quad
+ case "$1" in
+ x86_64)
+- VAR_CPU=x86_64
+- VAR_CPU_ARCH=x86
+- VAR_CPU_BITS=64
+- VAR_CPU_ENDIAN=little
++ case "$target_os" in
++ *x32)
++ VAR_CPU=x32
++ VAR_CPU_ARCH=x86
++ VAR_CPU_BITS=32
++ VAR_CPU_ENDIAN=little
++ ;;
++ *)
++ VAR_CPU=x86_64
++ VAR_CPU_ARCH=x86
++ VAR_CPU_BITS=64
++ VAR_CPU_ENDIAN=little
++ ;;
++ esac
+ ;;
+ i?86)
+ VAR_CPU=x86
+@@ -375,7 +385,16 @@
+ ppc64) ZERO_ARCHDEF=PPC64 ;;
+ s390*) ZERO_ARCHDEF=S390 ;;
+ sparc*) ZERO_ARCHDEF=SPARC ;;
+- x86_64*) ZERO_ARCHDEF=AMD64 ;;
++ x86_64*)
++ case "$target_os" in
++ *x32)
++ ZERO_ARCHDEF=X32
++ ;;
++ *)
++ ZERO_ARCHDEF=AMD64
++ ;;
++ esac
++ ;;
+ x86) ZERO_ARCHDEF=IA32 ;;
+ *) ZERO_ARCHDEF=$(echo "${OPENJDK_TARGET_CPU_LEGACY_LIB}" | tr a-z A-Z)
+ esac
+diff -durN jdk8u-jdk8u66-b02.orig/hotspot/src/os/linux/vm/os_linux.cpp jdk8u-jdk8u66-b02/hotspot/src/os/linux/vm/os_linux.cpp
+--- jdk8u-jdk8u66-b02.orig/hotspot/src/os/linux/vm/os_linux.cpp 2015-09-21 13:05:51.883678088 +0200
++++ jdk8u-jdk8u66-b02/hotspot/src/os/linux/vm/os_linux.cpp 2015-09-21 13:12:58.665870862 +0200
+@@ -1902,7 +1902,7 @@
+
+ #if (defined IA32)
+ static Elf32_Half running_arch_code=EM_386;
+- #elif (defined AMD64)
++ #elif (defined AMD64) || (defined X32)
+ static Elf32_Half running_arch_code=EM_X86_64;
+ #elif (defined IA64)
+ static Elf32_Half running_arch_code=EM_IA_64;
+diff -durN jdk8u-jdk8u66-b02.orig/jdk/make/gensrc/GensrcX11Wrappers.gmk jdk8u-jdk8u66-b02/jdk/make/gensrc/GensrcX11Wrappers.gmk
+--- jdk8u-jdk8u66-b02.orig/jdk/make/gensrc/GensrcX11Wrappers.gmk 2015-07-23 16:17:35.000000000 +0200
++++ jdk8u-jdk8u66-b02/jdk/make/gensrc/GensrcX11Wrappers.gmk 2015-09-21 13:13:00.339291213 +0200
+@@ -87,9 +87,11 @@
+ $(TOOL_WRAPPERGENERATOR) $(@D) $(GENSRC_SIZER_DIR)/xlibtypes.txt "sizer" $*
+
+ # use -m32/-m64 only if the compiler supports it
++ ifneq ($(OPENJDK_TARGET_CPU),x32)
+ ifeq ($(COMPILER_SUPPORTS_TARGET_BITS_FLAG), true)
+ MEMORY_MODEL_FLAG="$(COMPILER_TARGET_BITS_FLAG)$*"
+ endif
++ endif
+
+ # Compile the C code into an executable.
+ $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
+diff -durN jdk8u-jdk8u66-b02.orig/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c jdk8u-jdk8u66-b02/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
+--- jdk8u-jdk8u66-b02.orig/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c 2015-07-23 16:17:35.000000000 +0200
++++ jdk8u-jdk8u66-b02/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c 2015-09-21 13:13:00.335957707 +0200
+@@ -35,7 +35,6 @@
+ #endif
+ #ifdef __linux__
+ #include <unistd.h>
+-#include <sys/sysctl.h>
+ #include <sys/utsname.h>
+ #include <netinet/ip.h>
+
+diff -durN jdk8u-jdk8u66-b02.orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c jdk8u-jdk8u66-b02/jdk/src/solaris/native/java/net/PlainSocketImpl.c
+--- jdk8u-jdk8u66-b02.orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2015-07-23 16:17:35.000000000 +0200
++++ jdk8u-jdk8u66-b02/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2015-09-21 13:13:00.335957707 +0200
+@@ -43,7 +43,6 @@
+ #endif
+ #ifdef __linux__
+ #include <unistd.h>
+-#include <sys/sysctl.h>
+ #endif
+
+ #include "jvm.h"
+
+--- jdk8u-jdk8u66-b02.orig/common/autoconf/toolchain.m4 2015-07-17 09:35:23.000000000 +0200
++++ jdk8u-jdk8u66-b02/common/autoconf/toolchain.m4 2015-09-21 16:00:30.328673989 +0200
+@@ -361,6 +361,7 @@
+ # Option used to tell the compiler whether to create 32- or 64-bit executables
+ # Notice that CC contains the full compiler path at this point.
+ case $CC in
++ *x32-*) COMPILER_TARGET_BITS_FLAG="-mx";;
+ *xlc_r) COMPILER_TARGET_BITS_FLAG="-q";;
+ *) COMPILER_TARGET_BITS_FLAG="-m";;
+ esac
+
+--- jdk8u-jdk8u66-b02.orig/hotspot/src/cpu/zero/vm/frame_zero.cpp 2015-07-22 19:12:56.000000000 +0200
++++ jdk8u-jdk8u66-b02/hotspot/src/cpu/zero/vm/frame_zero.cpp 2015-09-21 15:28:59.680331993 +0200
+@@ -216,7 +216,7 @@
+ valuebuf[buflen - 1] = '\0';
+
+ // Print the result
+- st->print_cr(" " PTR_FORMAT ": %-21s = %s", addr, fieldbuf, valuebuf);
++ st->print_cr(" " PTR_FORMAT ": %-21s = %s", (uintptr_t)addr, fieldbuf, valuebuf);
+ }
+ }
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/openjdk8.git/commitdiff/bd96d31d1badc559f493ab4d8fc78487be9db7c1
More information about the pld-cvs-commit
mailing list