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

Ioi Lam iklam at openjdk.org
Thu May 11 20:08:48 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'

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

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

Changes: https://git.openjdk.org/jdk/pull/13941/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13941&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8307959
  Stats: 49 lines in 15 files changed: 21 ins; 2 del; 26 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