RFR: 8325589: C2 SuperWord refactoring: create VLoopAnalyzer with Submodules [v2]

Emanuel Peter epeter at openjdk.org
Sun Feb 11 13:52:11 UTC 2024


On Sun, 11 Feb 2024 13:48:42 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Subtask of https://github.com/openjdk/jdk/pull/16620
>> 
>> **Goals**:
>> - **modularity**: SuperWord is a nasty large class, and it is difficult to know what impacts what.
>> - **code reuse**: In the future, we may want to reuse some components of SuperWord in other Vectorizers. For example the post-loop-vectorizer ([JDK-8308994](https://bugs.openjdk.org/browse/JDK-8308994)).
>> 
>> Hence, I pull some parts out of SuperWord, and put them in a new class `VLoopAnalyzer`, with submodules:
>> 
>> VLoopAnalyzer
>>   VLoopReductions
>>   VLoopMemorySlices
>>   VLoopBody
>>   VLoopTypes
>> 
>> 
>> **Future Work**
>> In my draft for https://github.com/openjdk/jdk/pull/16620, I also created a submodule `VLoopDependenceGraph`.
>> But that is also a lot of code change.
>> I decided to do this in a separate RFE, to keep this patch here reasonably short.
>> 
>> I also left many functions in `superword.cpp`, even though their classes are in `vectorization.hpp`.
>> I think it is easier to review them in their old palces, with minor changes, for now.
>> In a future RFE, I can then cleanly copy them, without any changes to them.
>
> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   move _loop_or_ctrl from ResouceArena, bc ResourceMark in SuperWord::dependence_graph

src/hotspot/share/opto/loopnode.hpp line 1116:

> 1114:   PhaseIdealLoop(PhaseIterGVN& igvn, const PhaseIdealLoop* verify_me = nullptr) :
> 1115:     PhaseTransform(Ideal_Loop),
> 1116:     _loop_or_ctrl(igvn.C->comp_arena()),

Note: `_loop_or_ctrl` used to be on thread `ResourceArea`. This is bad, if we ever modify it during loopopts, inside the scope of a `ResourceMark`. I just wittnessed such a case (memory corruption) because of the new `ResourceMark` in `SuperWord::dependence_graph`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17800#discussion_r1485598592


More information about the hotspot-compiler-dev mailing list