JDK-8186461 : Zero's atomic_copy64() should use SPE instructions on linux-powerpcspe
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 8u172,10
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: ppc
  • Submitted: 2017-08-18
  • Updated: 2019-05-22
  • Resolved: 2017-11-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 8
10 b36Fixed 8u192Fixed
Description
There are 32-Bit PowerPC machines (e.g. PowerPC e500) running Linux which do not have an FPU and therefore do not support any FPU instructions.

Zero contains an implementation of atomic_copy64() which unconditionally emits FPU instructions for the atomic copy on PPC32 systems. This means, zero will fail to build on the aforementioned systems as the assembler does not understand any PPC32 FPU instructions.

On any PowerPC machine which falls under this category, gcc will define the symbol __NO_FPRS__ which can be used to detect such a system:

root@atlantis:~> echo | gcc -E -dM - |grep -i FPR
#define __NO_FPRS__ 1
root@atlantis:~>

The attached patch makes use of that by disabling the FPU instructions on the affected systems.
Comments
Updated webrev: http://cr.openjdk.java.net/~glaubitz/8186461/webrev.01/
26-11-2017

After some research, it turns out that there is actually a possibility on PowerPC e500 to implement the 64-bit atomic load and store which is the use of the SPE instructions "evldd" and "evstdd" [1]. The atomicity of these instructions is discussed in [2]. [1] https://www.nxp.com/docs/en/reference-manual/E500CORERM.pdf (p. 184) [2] https://shipilev.net/blog/2014/all-accesses-are-atomic/
24-11-2017