RFR: 8309203: C2: remove copy-by-value of GrowableArray for InterfaceSet [v4]

Roland Westrelin roland at openjdk.org
Wed Oct 25 15:33:48 UTC 2023


> The `InterfaceSet` component of types is immutable (once it is fully
> constructed). In that way, it's similar to other type components. In
> this change I propose making `InterfaceSet` a subtype of `Type` (and
> renaming it `TypeInterfaces`). It's then feasible to `hashcons`
> `TypeInterfaces` instances the way it's done for other `Type`
> instance.  A single copy of a `TypeInterfaces` for a particular set of
> interfaces is live during a compilation (and for the entire length of
> the compilation) and pointer equality can be used to check two sets of
> interfaces for equality. I think that change makes interface support
> fit better with the type system implementation and has the added
> benefits that there's no copy by value of the GrowableArray that holds
> the set of interfaces anymore.
> 
> A couple of required virtual methods for `Type` are not implemented
> for `TypeInterfaces`: `xmeet` and `singleton` (their body now calls
> `ShouldNotReachHere`). They would need a way to tell whether
> `TypeInterfaces` instances are above the center line or not. I thought
> about (and tried) having a root class `Type` that would contain the
> bare minimum for type that can be `hashcons`'ed so this method
> wouldn't need to be implemented by `TypeInterfaces`. That proved to be
> quite complicated and I gave up.

Roland Westrelin 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 seven additional commits since the last revision:

 - ciKlass* -> ciInstanceKlass*
 - review
 - Merge branch 'master' into JDK-8309203
 - Update src/hotspot/share/opto/type.cpp
   
   Co-authored-by: Tobias Hartmann <tobias.hartmann at oracle.com>
 - Update src/hotspot/share/opto/type.cpp
   
   Co-authored-by: Tobias Hartmann <tobias.hartmann at oracle.com>
 - build fix
 - fix

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/16309/files
  - new: https://git.openjdk.org/jdk/pull/16309/files/8cdcde07..b7ed7dbd

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

  Stats: 44593 lines in 1387 files changed: 27012 ins; 8666 del; 8915 mod
  Patch: https://git.openjdk.org/jdk/pull/16309.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16309/head:pull/16309

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


More information about the hotspot-compiler-dev mailing list