RFR(M): 8016697: PPC64 (part 5): Use stubs to implement safefetch

Vladimir Kozlov vladimir.kozlov at oracle.com
Mon Jun 17 12:16:01 PDT 2013


I am fine with using stubs but it should be done in platform specific 
files stubRoutines_ppc_64.hpp (and .cpp) as we normally do on other 
platforms. That way you don't need #ifdef and separate flags.

Vladimir

On 6/17/13 6:55 AM, Lindenmaier, Goetz wrote:
> 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.
>


More information about the ppc-aix-port-dev mailing list