Integrated: 8307959: Remove explicit type casts from SerializeClosure::do_xxx() calls

Ioi Lam iklam at openjdk.org
Mon May 15 16:37:01 UTC 2023


On Thu, 11 May 2023 20:01:17 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> Remove ugly type casts like:
> 
> 
> soc->do_ptr((void**)&_index);
> soc->do_u4((u4*)(&_shared_strings_array_root_index));
> 
> 
> =>
> 
> 
> soc->do_ptr((void**)&_index);
> soc->do_int(&_shared_strings_array_root_index);
> 
> 
> This is cleaner and also can catch invalid usage:
> 
> 
> long long x;
> soc->do_ptr((void**)&_x);  // old style: no error from c++ compiler
> soc->do_ptr(&_x);          // new style: "mismatched types 'T*' and 'long long int'

This pull request has now been integrated.

Changeset: 57e7a3fb
Author:    Ioi Lam <iklam at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/57e7a3fbeae56f39f9434b4a97dd915fa14af93d
Stats:     49 lines in 15 files changed: 21 ins; 2 del; 26 mod

8307959: Remove explicit type casts from SerializeClosure::do_xxx() calls

Reviewed-by: matsaave, ccheung

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

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


More information about the hotspot-dev mailing list