The nmethod.hpp and compiledMethod.hpp files have implicit address to int conversions for returning offsets and sizes.Since hopefully an nmethod size should never exceed 32 bits, this seems safe to simply add explicit casts.
The question is which is better:
+ int oops_size () const { return int((address) oops_end () - (address) oops_begin ()); }
Or
+ int oops_size () const { return (int)((address) oops_end () - (address) oops_begin ()); }
It doesn't seem like we should slow down compilation or add noise to make these
+ int oops_size () const { return checked_cast<int>((address) oops_end () - (address) oops_begin ()); }
Compiling with -Wconversion and not -Werror gives these counts for warnings:
5523 /scratch/cphillim/hg/21more-conversion/src/hotspot/share/code/nmethod.hpp
5523 /scratch/cphillim/hg/21more-conversion/src/hotspot/share/code/compiledMethod.hpp
4150 /scratch/cphillim/hg/21more-conversion/src/hotspot/share/code/relocInfo.hpp