RFR: 8307959: Remove explicit type casts from SerializeClosure::do_xxx() calls [v2]

Ioi Lam iklam at openjdk.org
Mon May 15 15:04:49 UTC 2023


> 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'

Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:

 - Merge branch 'master' into 8307959-remove-casts-in-SerializeClosure-do-xxx
 - 8307959: Remove explicit type casts from SerializeClosure::do_xxx() calls

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/13941/files
  - new: https://git.openjdk.org/jdk/pull/13941/files/bee5c3c3..875887f3

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=13941&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13941&range=00-01

  Stats: 5606 lines in 210 files changed: 3859 ins; 486 del; 1261 mod
  Patch: https://git.openjdk.org/jdk/pull/13941.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13941/head:pull/13941

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


More information about the hotspot-dev mailing list