RFR: 8289943: Simplify some object allocation merges [v14]

Cesar Soares Lucas cslucas at openjdk.org
Tue Mar 7 02:14:51 UTC 2023


On Tue, 3 Jan 2023 20:27:41 GMT, Cesar Soares Lucas <cslucas at openjdk.org> wrote:

>> Hi there, can I please get some feedback on this approach to simplify object allocation merges in order to promote Scalar Replacement of the objects involved in the merge?
>> 
>> The basic idea for this [approach was discussed in this thread](https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2022-April/055189.html) and it consists of: 
>> 1) Identify Phi nodes that merge object allocations and replace them with a new IR node called ReducedAllocationMergeNode (RAM node).
>> 2) Scalar Replace the incoming allocations to the RAM node.
>> 3) Scalar Replace the RAM node itself.
>> 
>> There are a few conditions for doing the replacement of the Phi by a RAM node though - Although I plan to work on removing them in subsequent PRs:
>> 
>> - The only supported users of the original Phi are AddP->Load, SafePoints/Traps, DecodeN.
>> 
>> These are the critical parts of the implementation and I'd appreciate it very much if you could tell me if what I implemented isn't violating any C2 IR constraints:
>> 
>> - The way I identify/use the memory edges that will be used to find the last stored values to the merged object fields.
>> - The way I check if there is an incoming Allocate node to the original Phi node.
>> - The way I check if there is no store to the merged objects after they are merged.
>> 
>> Testing:
>> - Windows/Linux/MAC fastdebug/release 
>>   - hotspot_all
>>   - tier1
>>   - Renaissance
>>   - dacapo
>>   - new IR-based tests
>
> Cesar Soares Lucas has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 43 commits:
> 
>  - updating with master branch
>  - Fix x86 tests.
>  - Fix code style.
>  - Address PR feedback. Fix test & one bug. Set RAM parameter to true by default.
>  - Addressing PR feedback. Added new constraint for case of merging SR and NSR allocations.
>  - Merge branch 'openjdk:master' into allocation-merges
>  - Remove debug messages.
>  - Add functional tests, micro benchmarks and fix some bugs.
>  - fix 32 bit execution.
>  - Back out on fixing existing issue. Some tests depend on it.
>  - ... and 33 more: https://git.openjdk.org/jdk/compare/ea25a561...d26909fa

Hi, ALL.

I decided to [create a new PR](https://github.com/openjdk/jdk/pull/12897) since after the latest changes the code looked much different than the version in this PR. I also attacked the problem from another direction: I decided to create an infrastructure for re-materializing objects before anything else since merges being used as debug information is the most common use case (see charts on new PR).

Still, in this new approach, I plan to include all the feedback I received here. 1) No need for RAM node; 2) Improve split-unique-types, 3) Make use of split-through-phi.

Thank you all again!

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

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


More information about the hotspot-compiler-dev mailing list