RFR: 8270794: Avoid loading Klass* twice in TypeArrayKlass::oop_size()

Roman Kennke rkennke at openjdk.java.net
Thu Jul 15 20:03:34 UTC 2021


TypeArrayKlass::oop_size() calls into TypoArrayOopDesc::object_size() which loads the Klass* from the object, but this is not necessary because we're coming from TypeArrayKlass.

Note: This came up in Lilliput, where we need to be careful how to load the Klass, and must figure out the object size using oopDesc::size_given_klass() without blindly re-loading the Klass*. Outside of Lilliput I consider this a cosmetic change (i.e. no substantial performance improvement expected because most cases should be covered by layout-helper).

Testing:
 - [ ] tier1
 - [ ] tier2

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

Commit messages:
 - 8270794: Avoid loading Klass* twice in TypeArrayKlass::oop_size()

Changes: https://git.openjdk.java.net/jdk/pull/4799/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4799&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8270794
  Stats: 5 lines in 4 files changed: 0 ins; 1 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4799.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4799/head:pull/4799

PR: https://git.openjdk.java.net/jdk/pull/4799


More information about the hotspot-dev mailing list