OpenJDK7 port to the little endian PowerPC64
Volker Simonis
volker.simonis at gmail.com
Fri Mar 7 09:01:41 PST 2014
Hi Sasha,
sorry for the delay. I finally looked at your change and have a few
comments:
*Makefiles:*
I don't quite like the fact that we really have to define a new
BUILDARCH/LIBARCH for little endian which also requires new makefiles like
'ppc64le.make' and 'platform_ppc64le'.
The latter is equal to 'platform_ppc64', so there's no problem if we have
just 'ppc64' as BUILDARCH.
For 'ppc64le.make' I think we could easily handle the differences right in
'ppc64.make'.
So I suggest you define "PPC64_ENDIANNESS" as "little" or "big" in
make/defs.make, depending on the actual "ARCH" value. Later on, you can use
"PPC64_ENDIANNESS" in 'ppc64.make' for the settings which are different for
little and big endian builds. You may have noticed that in the jdk9 forest,
'ppc64.make' is considerably smaller. So with your changes included it may
look as simple as:
# make c code know it is on a 64 bit platform.
CFLAGS += -D_LP64=1
ifeq ($(PPC64_ENDIANNESS), little)
CFLAGS += -DVM_LITTLE_ENDIAN
#PPC64 LE uses ELFv2 ABI
CFLAGS += -DABI_ELFv2
else
CFLAGS += -DVM_BIG_ENDIAN
endif
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4
\) \& \( $(CC_VER_MINOR) \>= 7 \) \))" "0"
# fixes `relocation truncated to fit' error for older versions of gcc
(i.e. 4.1.2)
CFLAGS += -mminimal-toc
endif
# use ppc64 instructions, but schedule for power5
CFLAGS += -mcpu=powerpc64 -mtune=power5 -minsert-sched-nops=regroup_exact
-mno-multiple -mno-string
Regarding '-mminimal-toc' - this option is needed for older versions of
GCC, otherwise you'll get "relocation truncated to fit" errors during
linking. I've checked that the option is not required any more with GCC
4.7. It may be that it already works with GCC before 4.7 but I didn't test,
so to be on the safe side, I'll suggest to enable the option for all GCC
versions smaller than 4.7.
I also checked that the two LFLAGS_VM settings aren't needed any more, so
you can remove the lines:
-
-# let linker find external 64 bit libs.
-LFLAGS_VM += -L/lib64
-
-# specify lib format.
-LFLAGS_VM += -Wl,-melf64ppc
from ppc64.make.
Regarding "-mtune=power7" I'm not sure. Are you absolutely sure that all
ppc64le distros will only ever run on Power7 and above? If yes, you could
put the "-mtune=power7" flag into the PPC64_ENDIANNESS=little section and
move the "-mtune=power5" flag into the else branch.
If done this way, you will also not need the changes in
"make/linux/makefiles/gcc.make" and "make/linux/makefiles/defs.make".
*bytes_ppc.hpp/bytes_linux_ppc.inline.hpp*
I don't think we need a special new file (bytes_linux_ppc.inline.hpp) here.
I think better include "byteswap.h" at the top of "bytes_ppc.hpp" and just
call the bswap_XX functions directly instead of using the 'swap_XX'
wrappers:
150 static inline u2 get_Java_u2(address p) { return
bswap_16(get_native_u2(p)); }
151 static inline u4 get_Java_u4(address p) { return
bswap_32(get_native_u4(p)); }
152 static inline u8 get_Java_u8(address p) { return
bswap_64(get_native_u8(p)); }
153
154 static inline void put_Java_u2(address p, u2 x) {
put_native_u2(p, bswap_16(x)); }
155 static inline void put_Java_u4(address p, u4 x) {
put_native_u4(p, bswap_32(x)); }
156 static inline void put_Java_u8(address p, u8 x) {
put_native_u8(p, bswap_64(x)); }
Once you send the new webrev, I'll test that it still works with our big
endian build and we can than push it to jdk9. Once it is in there, we can
easily integrate the changes intou our own
ppc-aix-port/jdk7u<http://hg.openjdk.java.net/ppc-aix-port/jdk7u>repository.
Thank you and best regards,
Volker
On Fri, Mar 7, 2014 at 4:24 AM, Alexander Smundak <asmundak at google.com>wrote:
> On Thu, Mar 6, 2014 at 5:20 AM, Lindenmaier, Goetz
> <goetz.lindenmaier at sap.com> wrote:
> > +#ifndef OS_CPU_LINUX_PPC_VM_BYTES_LINUX_PPC_INLINE_HPP
> > +#define OS_CPU_LINUX_PPCLE_VM_BYTES_LINUX_PPC_INLINE_HPP
> > defines the wrong macro.
> Done.
> > Also you need to add a copyright header.
> Done.
> > You need to protect #include "bytes_linux_ppc.inline.hpp"
> > in bytes_ppc.hpp by #ifdef TARGET_OS_ARCH_linux_ppc, else it breaks the
> > aix build.
> Done
> > The comment above get_Java_u2 is misleading, I guess ;)
> Done.
> > os_linux.cpp does not build on non-ppc platforms because
> PPC64_ELFDATA2XSB
> > is not defined.
> Done.
>
> I have discovered that a one-line change to the libproc.h is needed,
> and the compiler settings for the little-endian PPC64 in ppc64le.make
> can be adjusted:
> it can be tuned for Power7, and there is no need for -mminimal-toc.
>
> > Can you please send a RFR to the hotspot-dev list as you did for the
> other
> > change?
> Will send it the moment my colleague with account at cr.openjdk posts
> the webrev.
> Thank you for the comments.
>
> I have two additional patches ready for review, one for the jdk/ subrepo
> and another for the top-level. What's the procedure there? Can I
> reuse the same bug 8036767 for this? Where should I post RFRs?
>
> Sasha
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/ppc-aix-port-dev/attachments/20140307/c8b06f3a/attachment-0001.html
More information about the ppc-aix-port-dev
mailing list