RFR(M): 8016697: PPC64 (part 5): Use stubs to implement safefetch
Lindenmaier, Goetz
goetz.lindenmaier at sap.com
Mon Jun 17 06:55:39 PDT 2013
Hi,
the PPC64 port uses stub routines to implement safefetch. We had and
have problems with inline assembly, especially with non-gcc
compilers. Stub routines allow to implement safefetch without
depending on OS or compiler, as it's the case with the current
implementation. This also allows to use a single implementation if an
architecture is supported on several os platforms.
http://cr.openjdk.java.net/~goetz/webrevs/8016697-safefetch/
Currently, we guard the code with
#ifdef SAFEFETCH_STUBS
which is set in ppc64.make.
I could also imagine an implementation that uses a pd_debug flag
or a const flag set in os_<os_cpu>.hpp that allows the C-compiler to
optimize, and writing the code like this:
extern "C" int pd_SafeFetch32 (int * adr, int errValue) ;
extern "C" intptr_t pd_SafeFetchN (intptr_t * adr, intptr_t errValue) ;
inline int SafeFetch32(int* adr, int errValue) {
if (UseSafefetchStub) {
assert(StubRoutines::SafeFetch32_stub(), "stub not yet generated");
return StubRoutines::SafeFetch32_stub()(adr, errValue);
} else {
pd_SafeFetch32(adr, errValue);
}
}
Unfortunately this requires
1) setting the flag on all platforms
2) renaming the safefetch function on all platfoms.
Actually I would prefer this second solution as it avoids the preprocessor,
and am happy to edit the sources accordingly if this finds acceptance.
For the implementation of a safefetch_stub see
http://hg.openjdk.java.net/ppc-aix-port/jdk8/hotspot/file/fce884e5ba0b/src/cpu/ppc/vm/stubGenerator_ppc.cpp
Could I get a review on this change, please?
Thanks,
Goetz.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/ppc-aix-port-dev/attachments/20130617/7cb1de35/attachment.html
More information about the ppc-aix-port-dev
mailing list