Skip to content

Conversation

@chhagedorn
Copy link
Member

@chhagedorn chhagedorn commented Jan 19, 2026

When using compiler replay with --enable-preview with array store/load profiling, we only create ObjArrayKlass objects instead of subclass objects (i.e. RefArrayKlass or FlatArrayKlass). The reason is that we are directly resolving klasses with SystemDirectory::resolve_or_fail():

k = SystemDictionary::resolve_or_fail(klass_name, _loader, true, THREAD);

This method will call InstanceKlass::array_klass() at some point which directly creates an ObjArrayKlass object. This let's the replayed compilation fail when trying to speculate on an value class array which expects a subclass of ObjArrayKlass.

The fix I propose is to make sure that we are always creating subclass objects by explicitly using ArrayProperties::DEFAULT when parsing an ArrayKlass during replay compilation.

I added a compiler replay test which triggers the same assert as shown in the report.

Thanks,
Christian


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (1 review required, with at least 1 Committer)

Issue

  • JDK-8375548: [lworld] C2: Compiler replay does not work due to not creating ObjArrayKlass objects with ArrayProperties::DEFAULT (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/1931/head:pull/1931
$ git checkout pull/1931

Update a local copy of the PR:
$ git checkout pull/1931
$ git pull https://git.openjdk.org/valhalla.git pull/1931/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1931

View PR using the GUI difftool:
$ git pr show -t 1931

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1931.diff

Using Webrev

Link to Webrev Comment

…not loading object array klasses with ArrayProperties::DEFAULT
@bridgekeeper
Copy link

bridgekeeper bot commented Jan 19, 2026

👋 Welcome back chagedorn! A progress list of the required criteria for merging this PR into lworld will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jan 19, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 19, 2026
@mlbridge
Copy link

mlbridge bot commented Jan 19, 2026

Webrevs

if (Arguments::is_valhalla_enabled() && k->is_objArray_klass()) {
// Create ref or flat array klass.
k = ObjArrayKlass::cast(k)->klass_with_properties(ArrayKlass::ArrayProperties::DEFAULT, THREAD);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will always create the default refined klass. Shouldn't we keep track of which refined klass was actually referenced in the replay file and then create that particular one here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants