On Fri, 24 Jun 2022 21:42:58 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
>> These come from ObjectHeap. I do agree it would be better to change these >> upstream (all the type sizes there are currently `long`), but that would be >> a much more invasive change. I'm happy to try that, but it looked like a can >> of worms. > > Unfortunately that eventually leads to Type.getSize(), which returns a long. > I don't think you can change it to return an int, because some types > (nonscalar) could need a long to fit their size, so you do need an int cast > some point later. Probably the cast should be in the following code since we > know all of these fit an in int: > > > public ObjectHeap(TypeDataBase db) throws WrongTypeException { > // Get commonly used sizes of basic types > oopSize = VM.getVM().getOopSize(); > byteSize = db.getJByteType().getSize(); > charSize = db.getJCharType().getSize(); > booleanSize = db.getJBooleanType().getSize(); > intSize = db.getJIntType().getSize(); > shortSize = db.getJShortType().getSize(); > longSize = db.getJLongType().getSize(); > floatSize = db.getJFloatType().getSize(); > doubleSize = db.getJDoubleType().getSize(); > } I pushed 8115af5 to do as you suggested. That cleaned up most of the casts in HeapHprofBinWriter. ------------- PR: https://git.openjdk.org/jdk/pull/9280