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

Frederic Parain fparain at openjdk.org
Tue Feb 17 21:19:05 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 incrementally with two additional commits since the last revision:

 - Fix Copyrights years
 - Fix indentation

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

Changes:
  - all: https://git.openjdk.org/valhalla/pull/2033/files
  - new: https://git.openjdk.org/valhalla/pull/2033/files/263c38d4..0f67d907

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

  Stats: 49 lines in 45 files changed: 2 ins; 0 del; 47 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