RFR: 8260306: Do not include osThread.hpp in thread.hpp

David Holmes david.holmes at oracle.com
Sun Jan 24 21:59:40 UTC 2021


Hi Ioi,

On 23/01/2021 4:14 am, Ioi Lam wrote:
> thread.hpp is a popular header file (included by 856 out of 1000 HotSpot.o file), so we should try to minimize what files are included by thread.hpp.
> 
> We can replace the inclusion of osThread.hpp with a forward declaration of the OSThread class.
> 
> This reduces the number of .o files that include osThread.hpp to 42.

Seems to me we should provide Thread::native_id() (or something like 
that) so that calls to thread->osthread()->thread_id() do not leak out 
everywhere. The osThread really should be an internal detail of thread 
and the OS-specific code.

Cheers,
David

> Tested with mach5: tier1, builds-tier2, builds-tier3, builds-tier4 and builds-tier5. Also locally: aarch64, arm, ppc64, s390, x86, and zero.
> 
> -------------
> 
> Commit messages:
>   - 8260306: Do not include osThread.hpp in thread.hpp
> 
> Changes: https://git.openjdk.java.net/jdk/pull/2198/files
>   Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2198&range=00
>    Issue: https://bugs.openjdk.java.net/browse/JDK-8260306
>    Stats: 31 lines in 19 files changed: 19 ins; 1 del; 11 mod
>    Patch: https://git.openjdk.java.net/jdk/pull/2198.diff
>    Fetch: git fetch https://git.openjdk.java.net/jdk pull/2198/head:pull/2198
> 
> PR: https://git.openjdk.java.net/jdk/pull/2198





More information about the hotspot-dev mailing list