On Thu, 8 Sep 2022 12:10:34 GMT, Martin Doerr <mdo...@openjdk.org> wrote:

>> Robbin Ehn has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Change header and constants handling
>
> We need to support older kernel versions on PPC64 as well. And let's just 
> make it usable on PPC64. Improves performance of trivial native calls by 
> about 20%.
> 
> diff --git a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp 
> b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
> index 5a55d8f4dc2..0902c0f35ed 100644
> --- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
> +++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
> @@ -2147,7 +2147,9 @@ nmethod 
> *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
>      Label no_block, sync;
>  
>      // Force this write out before the read below.
> -    __ fence();
> +    if (!UseSystemMemoryBarrier) {
> +      __ fence();
> +    }
>  
>      Register sync_state_addr = r_temp_4;
>      Register sync_state      = r_temp_5;
> diff --git a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp 
> b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp
> index bd4e1ce9932..260d99bef81 100644
> --- a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp
> +++ b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp
> @@ -1436,7 +1436,9 @@ address 
> TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
>    __ li(R0/*thread_state*/, _thread_in_native_trans);
>    __ release();
>    __ stw(R0/*thread_state*/, thread_(thread_state));
> -  __ fence();
> +  if (!UseSystemMemoryBarrier) {
> +    __ fence();
> +  }
>  
>    // Now before we return to java we must look for a current safepoint
>    // (a new safepoint can not start since we entered native_trans).
> diff --git a/src/hotspot/os/linux/systemMemoryBarrier_linux.cpp 
> b/src/hotspot/os/linux/systemMemoryBarrier_linux.cpp
> index 796b596c675..66f77818ebc 100644
> --- a/src/hotspot/os/linux/systemMemoryBarrier_linux.cpp
> +++ b/src/hotspot/os/linux/systemMemoryBarrier_linux.cpp
> @@ -35,6 +35,8 @@
>  #ifndef SYS_membarrier
>    #if defined(AMD64)
>    #define SYS_membarrier 324
> +  #elif defined(PPC64)
> +  #define SYS_membarrier 365
>    #else
>    #error define SYS_membarrier for the arch
>    #endif
> 
> Btw. are spaces in front of `#` ok? Some old preprocessors might have 
> problems with that.

@TheRealMDoerr thanks, applied.
Do you want to be a reviewer or contributor?

Regarding space:
On Linux we had it for long time I think, see 
https://github.com/openjdk/jdk/blob/30d4145e2edd2d3e4cbaa8b01f7639ab53bc0991/src/hotspot/os/linux/os_linux.cpp#L306

-------------

PR: https://git.openjdk.org/jdk/pull/10123

Reply via email to