JDK-8218151 : Simplify JavaThread::thread_state definition
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 13
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-01-31
  • Updated: 2019-05-16
  • Resolved: 2019-02-01
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 13
13 b07Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
Currently defined as:


src/hotspot/share/runtime/thread.inline.hpp:

#if defined(PPC64) || defined (AARCH64)
inline JavaThreadState JavaThread::thread_state() const    {
  return (JavaThreadState) OrderAccess::load_acquire((volatile jint*)&_thread_state);
}

inline void JavaThread::set_thread_state(JavaThreadState s) {
  OrderAccess::release_store((volatile jint*)&_thread_state, (jint)s);
}
#endif

...which means it is compiled differently on AArch64 and PPC64, which is the source of multiple build failures going unnoticed when building x86_64 only. It would be easier to simplify this declaration. 

For example, move the #if into the method body:
  http://cr.openjdk.java.net/~shade/8218151/webrev.01/ (this builds fine on x86_64, aarch64, ppc64)

Alternatively, move the definition to thread.hpp.
Comments
The fix unfortunately requires lots of header reshuffles (e.g. inlcuding thread.inline.hpp instead of thread.hpp in many places). This makes it awkward to backport. Since this is a cleanup, there is no pressing need to do it. Dropping 11 and 12 as affected versions.
06-05-2019