RFR: 8348853: Fold layout helper check for objects implementing non-array interfaces [v3]

Marc Chevalier mchevalier at openjdk.org
Wed Apr 9 07:20:00 UTC 2025


> If `TypeInstKlassPtr` represents an array type, it has to be `java.lang.Object`. From contraposition, if it is not `java.lang.Object`, we can conclude it is not an array, and we can skip some array checks, for instance.
> 
> In this PR, we improve this deduction with an interface base reasoning: arrays implements only Cloneable and Serializable, so if a type implements anything else, it cannot be an array.
> 
> This change partially reverts the changes from [JDK-8348631](https://bugs.openjdk.org/browse/JDK-8348631) (#23331) (in `LibraryCallKit::generate_array_guard_common`) and the test still passes.
> 
> The way interfaces are check might be done differently. The current situation is a balance between visibility (not to leak too much things explicitly private), having not overly general methods for one use-case and avoiding too concrete (and brittle) interfaces.
> 
> Tested with tier1..3, hs-precheckin-comp and hs-comp-stress
> 
> Thanks,
> Marc

Marc Chevalier 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 five additional commits since the last revision:

 - Merge branch 'master' into feat/Fold-layout-helper-check-for-objects-implementing-non-array-interfaces
 - Merge branch 'master' into feat/Fold-layout-helper-check-for-objects-implementing-non-array-interfaces
 - not reinventing the wheel
 - Revert now useless fix
 - Generalize the not-array proof

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24245/files
  - new: https://git.openjdk.org/jdk/pull/24245/files/daaaf9ae..b1fb82a2

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

  Stats: 74611 lines in 2220 files changed: 27997 ins; 41827 del; 4787 mod
  Patch: https://git.openjdk.org/jdk/pull/24245.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24245/head:pull/24245

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


More information about the graal-dev mailing list