* [Buildroot] [PATCH, RE-SEND] openjdk: Add ARC HS3x/4x support via "Zero Assembly Project"
@ 2021-10-21 11:59 Alexey Brodkin via buildroot
2021-12-30 20:14 ` Thomas Petazzoni
0 siblings, 1 reply; 4+ messages in thread
From: Alexey Brodkin via buildroot @ 2021-10-21 11:59 UTC (permalink / raw)
To: buildroot; +Cc: Alexey Brodkin, Fabrice Fontaine, Adam Duskett, Yann E . MORIN
This allows building and running a full-scale JVM in purely
interpretive mode on ARCv2 processors.
Once JIT'ed version is available for ARC we'll obviously switch
to it to gain a faster execution.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Adam Duskett <aduskett@gmail.com>
---
Erroneously sent to buildroot@lists.buildroot.org initially,
now sending to buildroot@busybox.net.
Sorry for the noise!
---
...-Add-ARCv2-ISA-processors-support-to-Zero.patch | 109 +++++++++++++++++++++
package/openjdk/Config.in | 2 +
2 files changed, 111 insertions(+)
create mode 100644 package/openjdk/0001-Add-ARCv2-ISA-processors-support-to-Zero.patch
diff --git a/package/openjdk/0001-Add-ARCv2-ISA-processors-support-to-Zero.patch b/package/openjdk/0001-Add-ARCv2-ISA-processors-support-to-Zero.patch
new file mode 100644
index 0000000000..1ef523a419
--- /dev/null
+++ b/package/openjdk/0001-Add-ARCv2-ISA-processors-support-to-Zero.patch
@@ -0,0 +1,109 @@
+From 9a3c2a0714420186ae8d5159d5416c6fa2009ad9 Mon Sep 17 00:00:00 2001
+From: Alexey Brodkin <abrodkin@synopsys.com>
+Date: Mon, 18 Oct 2021 05:20:05 -0700
+Subject: [PATCH] Add ARCv2 ISA processors support to Zero
+
+This adds ARCv2 processors support in OpenJDK via
+"Zero Assembly Project" (see https://openjdk.java.net/projects/zero).
+
+That' a purely interpretive mode, so likely not that fast
+as JIT'ed version, but for starters it's much better than nothing.
+
+Once all the logistical problems are solved hopefully this
+change will be accepted upstream.
+
+Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
+---
+ make/autoconf/libraries.m4 | 8 ++++++++
+ make/autoconf/platform.m4 | 8 ++++++++
+ src/hotspot/os/linux/os_linux.cpp | 8 +++++++-
+ 3 files changed, 23 insertions(+), 1 deletion(-)
+
+diff --git a/make/autoconf/libraries.m4 b/make/autoconf/libraries.m4
+index 5120918aed2..f7a99955874 100644
+--- a/make/autoconf/libraries.m4
++++ b/make/autoconf/libraries.m4
+@@ -122,6 +122,14 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
+ BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lpthread"
+ fi
+
++ # Libatomic library
++ # 32-bit ARC needs fallback library for 8-byte atomic ops
++ # Inspired by a fix for MIPS, see https://github.com/openjdk/jdk/commit/1b3aa3af
++ if test "x$OPENJDK_TARGET_OS" = xlinux &&
++ (test "x$OPENJDK_TARGET_CPU" = xarc); then
++ BASIC_JVM_LIBS="$BASIC_JVM_LIBS -latomic"
++ fi
++
+ # perfstat lib
+ if test "x$OPENJDK_TARGET_OS" = xaix; then
+ BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lperfstat"
+diff --git a/make/autoconf/platform.m4 b/make/autoconf/platform.m4
+index c0f2446dbd7..dc416ece885 100644
+--- a/make/autoconf/platform.m4
++++ b/make/autoconf/platform.m4
+@@ -54,6 +54,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
+ VAR_CPU_BITS=64
+ VAR_CPU_ENDIAN=little
+ ;;
++ arc)
++ VAR_CPU=arc
++ VAR_CPU_ARCH=arc
++ VAR_CPU_BITS=32
++ VAR_CPU_ENDIAN=little
++ ;;
+ arm*)
+ VAR_CPU=arm
+ VAR_CPU_ARCH=arm
+@@ -478,6 +484,8 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
+ HOTSPOT_$1_CPU_DEFINE=PPC64
+
+ # The cpu defines below are for zero, we don't support them directly.
++ elif test "x$OPENJDK_$1_CPU" = xarc; then
++ HOTSPOT_$1_CPU_DEFINE=ARC
+ elif test "x$OPENJDK_$1_CPU" = xsparc; then
+ HOTSPOT_$1_CPU_DEFINE=SPARC
+ elif test "x$OPENJDK_$1_CPU" = xppc; then
+diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
+index b08caf4d5d3..2bf084895ba 100644
+--- a/src/hotspot/os/linux/os_linux.cpp
++++ b/src/hotspot/os/linux/os_linux.cpp
+@@ -1858,6 +1858,9 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
+ #ifndef EM_AARCH64
+ #define EM_AARCH64 183 /* ARM AARCH64 */
+ #endif
++#ifndef EM_ARC_COMPACT2
++ #define EM_ARC_COMPACT2 195 /* ARC ARCv2 ISA */
++#endif
+ #ifndef EM_RISCV
+ #define EM_RISCV 243 /* RISC-V */
+ #endif
+@@ -1879,6 +1882,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
+ {EM_SH, EM_SH, ELFCLASS32, ELFDATA2MSB, (char*)"SuperH BE"},
+ #endif
+ {EM_ARM, EM_ARM, ELFCLASS32, ELFDATA2LSB, (char*)"ARM"},
++ {EM_ARC_COMPACT2, EM_ARC_COMPACT2, ELFCLASS32, ELFDATA2LSB, (char*)"ARC"},
+ // we only support 64 bit z architecture
+ {EM_S390, EM_S390, ELFCLASS64, ELFDATA2MSB, (char*)"IBM System/390"},
+ {EM_ALPHA, EM_ALPHA, ELFCLASS64, ELFDATA2LSB, (char*)"Alpha"},
+@@ -1906,6 +1910,8 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
+ static Elf32_Half running_arch_code=EM_PPC;
+ #elif (defined AARCH64)
+ static Elf32_Half running_arch_code=EM_AARCH64;
++#elif (defined ARC)
++ static Elf32_Half running_arch_code=EM_ARC_COMPACT2;
+ #elif (defined ARM)
+ static Elf32_Half running_arch_code=EM_ARM;
+ #elif (defined S390)
+@@ -1926,7 +1932,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
+ static Elf32_Half running_arch_code=EM_RISCV;
+ #else
+ #error Method os::dll_load requires that one of following is defined:\
+- AARCH64, ALPHA, ARM, AMD64, IA32, IA64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
++ AARCH64, ALPHA, ARC, ARM, AMD64, IA32, IA64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
+ #endif
+
+ // Identify compatibility class for VM's architecture and library's architecture
+--
+2.16.2
+
diff --git a/package/openjdk/Config.in b/package/openjdk/Config.in
index f2b7f5ffd7..c09d1c0162 100644
--- a/package/openjdk/Config.in
+++ b/package/openjdk/Config.in
@@ -6,6 +6,7 @@ config BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS
config BR2_PACKAGE_OPENJDK_ARCH_SUPPORTS
bool
default y if BR2_aarch64
+ default y if BR2_arc && !(BR2_arc750d || BR2_arc770d)
default y if BR2_arm
default y if BR2_i386 || BR2_x86_64
default y if BR2_m68k
@@ -121,6 +122,7 @@ choice
prompt "openjdk variant"
default BR2_PACKAGE_OPENJDK_JVM_VARIANT_SERVER if !BR2_powerpc
default BR2_PACKAGE_OPENJDK_JVM_VARIANT_ZERO if BR2_powerpc
+ default BR2_PACKAGE_OPENJDK_JVM_VARIANT_ZERO if BR2_arc
config BR2_PACKAGE_OPENJDK_JVM_VARIANT_CLIENT
bool "client"
--
2.16.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH, RE-SEND] openjdk: Add ARC HS3x/4x support via "Zero Assembly Project"
2021-10-21 11:59 [Buildroot] [PATCH, RE-SEND] openjdk: Add ARC HS3x/4x support via "Zero Assembly Project" Alexey Brodkin via buildroot
@ 2021-12-30 20:14 ` Thomas Petazzoni
2021-12-30 21:04 ` Alexey Brodkin via buildroot
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2021-12-30 20:14 UTC (permalink / raw)
To: Alexey Brodkin; +Cc: Yann E . MORIN, Fabrice Fontaine, Adam Duskett, buildroot
Hello Alexey,
On Thu, 21 Oct 2021 04:59:15 -0700
Alexey Brodkin via buildroot <buildroot@buildroot.org> wrote:
> This allows building and running a full-scale JVM in purely
> interpretive mode on ARCv2 processors.
>
> Once JIT'ed version is available for ARC we'll obviously switch
> to it to gain a faster execution.
>
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> Cc: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Adam Duskett <aduskett@gmail.com>
I have applied your patch (finally you could say!) but there was a
mistake in it: you've added your patch in package/openjdk/, but we
support two versions of OpenJDK (11 and 17), and your patch only
applies to version 17. So I moved it to a sub-folder + ensured that
version 11 couldn't be selected for ARC. This also raised the issue
that version 17 has an additional requirement on host gcc >= 4.9, so if
a package ever did "select BR2_PACKAGE_OPENJDK", they would have to be
careful that specifically on ARC, it's only available if host gcc >=
4.9. To avoid this, I've moved the host gcc >= 4.9 dependency to
BR2_PACKAGE_OPENJDK itself, even if not strictly required for OpenJDK
11.
However, there is one thing I didn't address as I wasn't sure: do you
support only the "zero" variant on ARC? If so, doesn't this:
config BR2_PACKAGE_OPENJDK_JVM_VARIANT_CLIENT
bool "client"
depends on !BR2_powerpc
help
Quick loading, but slower run-time performance.
config BR2_PACKAGE_OPENJDK_JVM_VARIANT_SERVER
bool "server"
depends on !BR2_powerpc
help
Slower loading, but faster run-time performance.
config BR2_PACKAGE_OPENJDK_JVM_VARIANT_ZERO
bool "zero"
select BR2_PACKAGE_LIBFFI
help
A non-assembler variant with wide arch support, however
performance is less then client/server.
http://openjdk.java.net/projects/zero
also needs some depends on !BR2_arc for the client and server variants?
Thanks a lot,
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH, RE-SEND] openjdk: Add ARC HS3x/4x support via "Zero Assembly Project"
2021-12-30 20:14 ` Thomas Petazzoni
@ 2021-12-30 21:04 ` Alexey Brodkin via buildroot
2021-12-30 21:32 ` Thomas Petazzoni
0 siblings, 1 reply; 4+ messages in thread
From: Alexey Brodkin via buildroot @ 2021-12-30 21:04 UTC (permalink / raw)
To: Thomas Petazzoni
Cc: Yann E . MORIN, Fabrice Fontaine, Adam Duskett, buildroot
Hi Thomas,
> I have applied your patch (finally you could say!) but there was a
> mistake in it: you've added your patch in package/openjdk/, but we
> support two versions of OpenJDK (11 and 17), and your patch only
> applies to version 17.
Sure, thanks for taking care of this one - much appreciated especially
assuming all the extra troubles you've been through here ;)
As for version 11 I'm not really sure if it makes sense to kinda retrofit
ARC support in the older version so yeah I think only v17 should be OK.
And indeed it was not immediately clear that there're 2 versions which co-exist
at the same tim - so that's my bad for sure.
> So I moved it to a sub-folder + ensured that
> version 11 couldn't be selected for ARC. This also raised the issue
> that version 17 has an additional requirement on host gcc >= 4.9, so if
> a package ever did "select BR2_PACKAGE_OPENJDK", they would have to be
> careful that specifically on ARC, it's only available if host gcc >=
> 4.9. To avoid this, I've moved the host gcc >= 4.9 dependency to
> BR2_PACKAGE_OPENJDK itself, even if not strictly required for OpenJDK
> 11.
I hope it won't hurt indeed. But we'll see...
> However, there is one thing I didn't address as I wasn't sure: do you
> support only the "zero" variant on ARC? If so, doesn't this:
>
> config BR2_PACKAGE_OPENJDK_JVM_VARIANT_CLIENT
> bool "client"
> depends on !BR2_powerpc
> help
> Quick loading, but slower run-time performance.
>
> config BR2_PACKAGE_OPENJDK_JVM_VARIANT_SERVER
> bool "server"
> depends on !BR2_powerpc
> help
> Slower loading, but faster run-time performance.
>
> config BR2_PACKAGE_OPENJDK_JVM_VARIANT_ZERO
> bool "zero"
> select BR2_PACKAGE_LIBFFI
> help
> A non-assembler variant with wide arch support, however
> performance is less then client/server.
>
> http://openjdk.java.net/projects/zero/
>
> also needs some depends on !BR2_arc for the client and server variants?
Hm, indeed we need to add "!BR2_arc" here as ARC at this point supports only
interpretive mode (that's what "zero" mode stands for), while both "client" and
"server" modes are 2 flavors or tunes of a true HotSpot, which is by definition
is JIT'ed. I must have been in a real hurry to make all these stupid mistakes.
Do you want me to send a separate patch which adds these "!BR2_arc" dependencies
for both BR2_PACKAGE_OPENJDK_JVM_VARIANT_CLIENT &
BR2_PACKAGE_OPENJDK_JVM_VARIANT_SERVER or you prefer to do a fast fix-up yourself?
Thanks,
Alexey
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH, RE-SEND] openjdk: Add ARC HS3x/4x support via "Zero Assembly Project"
2021-12-30 21:04 ` Alexey Brodkin via buildroot
@ 2021-12-30 21:32 ` Thomas Petazzoni
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2021-12-30 21:32 UTC (permalink / raw)
To: Alexey Brodkin; +Cc: Yann E . MORIN, Fabrice Fontaine, Adam Duskett, buildroot
On Thu, 30 Dec 2021 21:04:21 +0000
Alexey Brodkin <Alexey.Brodkin@synopsys.com> wrote:
> Do you want me to send a separate patch which adds these "!BR2_arc" dependencies
> for both BR2_PACKAGE_OPENJDK_JVM_VARIANT_CLIENT &
> BR2_PACKAGE_OPENJDK_JVM_VARIANT_SERVER or you prefer to do a fast fix-up yourself?
Please send a patch :-)
Thanks a lot!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-30 21:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21 11:59 [Buildroot] [PATCH, RE-SEND] openjdk: Add ARC HS3x/4x support via "Zero Assembly Project" Alexey Brodkin via buildroot
2021-12-30 20:14 ` Thomas Petazzoni
2021-12-30 21:04 ` Alexey Brodkin via buildroot
2021-12-30 21:32 ` Thomas Petazzoni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.