RFR: 8320649: C2: Optimize scoped values [v15]

Roland Westrelin roland at openjdk.org
Thu May 2 06:58:12 UTC 2024


On Thu, 18 Apr 2024 10:16:55 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Roland Westrelin has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 22 commits:
>> 
>>  - Merge branch 'master' into JDK-8320649
>>  - review
>>  - test fix
>>  - test fix
>>  - Merge branch 'master' into JDK-8320649
>>  - whitespaces
>>  - review
>>  - Merge branch 'master' into JDK-8320649
>>  - review
>>  - 32 bit build fix
>>  - ... and 12 more: https://git.openjdk.org/jdk/compare/bfff02ee...a4ffc11e
>
> test/hotspot/jtreg/compiler/c2/irTests/TestScopedValue.java line 2:
> 
>> 1: /*
>> 2:  * Copyright (c) 2024, Red Hat, Inc. All rights reserved.
> 
> I like the tests, there is a lot of material here.
> 
> A few more ideas:
> - have two scoped values, and then have a sequence of `get` and `getValue` calls on them, in some random mix. And check that everything gets commoned, and the result is correct.
> - have a method that directly uses `get`, but also has inner scopes of `where`/`get`. Interleave these, maybe even with multiple different scoped values. And nest them with various depths. And then verify both the expected number of calls / loads, as well as the result.
> 
> Also: is it possible to stuff ScopedValues into ScopedValues? That would be another interesting stress-test with lots of options.

In the commit that I will push soon, I added more tests: a couple with 3 scoped values and a few with ScopedValues into ScopedValues. The ones you suggest with has inner scopes of `where/get ` can't work because `Cache.invalidate()` would then be called: when C2 sees a call to `Cache.invalidate()` , it doesn't perform any optimization.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16966#discussion_r1587151951


More information about the hotspot-compiler-dev mailing list