RFR: 8340093: C2 SuperWord: implement cost model [v3]

Emanuel Peter epeter at openjdk.org
Wed Nov 5 09:50:49 UTC 2025


On Tue, 4 Nov 2025 18:19:29 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   More comments for SirYwell
>
> This looks fine and not complex. I have only nit picks.

@vnkozlov Thanks for reviewing and the suggestions. I renamed some cost functions, and I like it better this way now too :)

> src/hotspot/share/opto/vectorization.cpp line 572:
> 
>> 570: 
>> 571: // Compute the cost over all operations in the (scalar) loop.
>> 572: float VLoopAnalyzer::cost() const {
> 
> consider renaming it to `cost_for_scalar()` and `cost_for_scalar()` to `cost_for_scalar_node()`

I'll do some renamings to make it explicit which are for nodes, and which for the loop.

> src/hotspot/share/opto/vectorization.cpp line 580:
> 
>> 578: 
>> 579:   float sum = 0;
>> 580:   for (int j = 0; j < body().body().length(); j++) {
> 
> What is `body().body()` mean?

`VLoopAnalyzer` (`this`) has multiple analysis subcomponents. One of them is the `VLoopBody`, i.e. `this->body()` / `this->_body.` And it has access to a `GrowableArray` `body()`, which maps the nodes of the loop.

Maybe `loopBody().nodes()` would sound better here. If you prefer that, I file a separate renaming RFE.

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

PR Comment: https://git.openjdk.org/jdk/pull/27803#issuecomment-3490211351
PR Review Comment: https://git.openjdk.org/jdk/pull/27803#discussion_r2493712328
PR Review Comment: https://git.openjdk.org/jdk/pull/27803#discussion_r2493630689


More information about the hotspot-compiler-dev mailing list