Integrated: 8298241: Replace C-style casts with JavaThread::cast

David Holmes dholmes at openjdk.org
Thu Dec 15 21:20:32 UTC 2022


On Wed, 14 Dec 2022 22:22:48 GMT, David Holmes <dholmes at openjdk.org> wrote:

> This is a simple cleanup RFE to get rid of old-style C casts in relation to JavaThread.
> 
> In many cases involving NULL/nullptr the cast could just be dropped. Sometimes a static cast is needed to disambiguate overloads.
> 
> A couple of reinterpret_cast are needed when doing int/ptr conversion.
> 
> static_cast is used for void* conversion.
> 
> The other changes should be self explanatory.
> 
> The changes in
> 
> src/hotspot/os_cpu/bsd_aarch64/javaThread_bsd_aarch64.cpp
> src/hotspot/os_cpu/windows_aarch64/javaThread_windows_aarch64.cpp
> 
> are a bit more extensive. That code was using an alias for `this` which is completely unnecessary (and the alias creation was using the cast). This could be factored out if thought necessary.
> 
> I grep'd as best I could for the old C-style casts but can't be certain I got them all.
> 
> Testing: 
>  - all builds in our tiers1-5
>  - local linux x64 product, slowdebug and fastdebug
>  - GHA
>  - Sanity testing tiers 1-3
> Thanks.

This pull request has now been integrated.

Changeset: 3cdbd878
Author:    David Holmes <dholmes at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/3cdbd878e68dc1131093137a7357710ad303ae8c
Stats:     44 lines in 19 files changed: 0 ins; 11 del; 33 mod

8298241: Replace C-style casts with JavaThread::cast

Reviewed-by: coleenp, stefank, sspitsyn

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

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


More information about the serviceability-dev mailing list