[lworld] RFR: 8375306: [lworld] Investigate alternatives to flatArrayOopDesc::obj_at implementation [v2]

Frederic Parain fparain at openjdk.org
Mon Feb 9 22:02:37 UTC 2026


> First batch of changes to remove potentially dangerous calls to objArrayOopDesc::obj_at().
> Changes are more extensive than intended. In most cases, code modifications consist in using a refArrayOop type instead of a objArrayOop type, because most of the arrays the JVM deals with for its own purpose are always reference arrays (because they are arrays of identity type elements). The patch also adds a new API allowing the VM to request the allocation of a reference array.
> Code dealing with user provided arrays must be ready to handle exceptions when accessing objArrays.
> 
> This is a short term fix, fixing a few bugs, and trying to make the code more robust using the meta-data types. For the long term, a better solution is needed. Accesses to both arrays and fields are becoming more and more complex because of the introduction of flattening, multiple layouts, additional properties. Forcing enforcement at each access would be expensive and wasteful, as the JVM usually operates on well-known objects or arrays. But because of the increasing complexity, having a way to quickly check the validity of an access would help making the VM code more robust.

Frederic Parain 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 12 additional commits since the last revision:

 - Comments update
 - Rename new_default_refArray to new_refArray with overload
 - Fixes issues mentioned in reviews
 - Remove force_refarray and add array klass creation from ArrayDescription
 - Fix merge
 - Merge remote-tracking branch 'upstream/lworld' into refarray_factory
 - Revert foreign methods signature changes
 - Foreign API and other fixes
 - CI fixes
 - More fixes in serviceability code
 - ... and 2 more: https://git.openjdk.org/valhalla/compare/dbed07f5...bd5f33d0

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

Changes:
  - all: https://git.openjdk.org/valhalla/pull/2033/files
  - new: https://git.openjdk.org/valhalla/pull/2033/files/70e8ec6f..bd5f33d0

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=valhalla&pr=2033&range=01
 - incr: https://webrevs.openjdk.org/?repo=valhalla&pr=2033&range=00-01

  Stats: 109401 lines in 3714 files changed: 42218 ins; 42463 del; 24720 mod
  Patch: https://git.openjdk.org/valhalla/pull/2033.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2033/head:pull/2033

PR: https://git.openjdk.org/valhalla/pull/2033


More information about the valhalla-dev mailing list