On Fri, 20 Mar 2026 22:40:53 GMT, Chen Liang <[email protected]> wrote:

>> Hi all, 
>> 
>> This change eliminates more box cache usages when running with 
>> `--enable-preview`:
>> * The majority of the change is contributed by @xmas92 who disabled CDS 
>> loading an archived cache.
>> * There's an autobox cache cast in C2 that needed to be disabled.
>> 
>> Notably, this change does not prevent the `XXXCache`'s `cache` variables 
>> from being CDS archived. This is due to the fact that the infrastructure is 
>> common to preview and non-preview mode, and the code complexity is not 
>> justifiable when the cost is storing five `null`s.  Instead, it is ensured 
>> that the cache is never read from.
>> 
>> Testing: tiers 1-4.
>
> What does this really solve? This doesn't identify the sites that incorrectly 
> initialized these caches. This doesn't remove the C2 recognition of special 
> wrapper arrays. Why do we need this?

Thanks for your comments @liach.
> What does this really solve? 

The purpose of this PR is to clean up the remaining box cache changes that are 
necessary. Once the scope of this task is finalized and the PR goes out of 
draft, I will update the description to be more representative.

> This doesn't identify the sites that incorrectly initialized these caches.

There are likely other usage sites that I have not overhauled. This is still a 
draft.

> This doesn't remove the C2 recognition of special wrapper arrays. 

We cannot remove C2's recognition of these arrays. The box caches are VM 
symbols, we can only restrict their usages from the VM's side by ensuring 
control flow does not use them and verifying this through assertions. One 
prominent usage is during deoptimization. Axel has already changed the VM code 
for this in [JDK-8378531](https://bugs.openjdk.org/browse/JDK-8378531).

We still had underlying test failures, for instance 
[JDK-8379863](https://bugs.openjdk.org/browse/JDK-8379863), which was a missing 
piece for this PR. Now that this has been integrated, things will look a lot 
clearer.

> Why do we need this?

When it comes to boxed caches, we should not initialize from (nor write to) the 
CDS archives.

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

PR Comment: https://git.openjdk.org/valhalla/pull/2249#issuecomment-4141620059

Reply via email to