RFR: JDK-8277139 Improve code readability in PredecessorValidator (c1_IR.cpp) [v3]

Christian Hagedorn chagedorn at openjdk.java.net
Thu Nov 25 08:34:08 UTC 2021


On Thu, 25 Nov 2021 08:06:28 GMT, Ludvig Janiuk <duke at openjdk.java.net> wrote:

>> src/hotspot/share/c1/c1_IR.cpp line 1308:
>> 
>>> 1306:     }
>>> 1307:     for (int i = 0; i < block->number_of_exception_handlers(); i++) {
>>> 1308:       assert(block->exception_handler_at(i)->is_set(BlockBegin::exception_entry_flag), "must be xhandler");
>> 
>> Could these two assertions also directly be moved before the `collect_predecessor()` calls below?
>
> I've split these loops up on purpose because I want to separate concerns. I appreciate the urge to optimize for fewer iterations, but I think the added readability will enable other, bigger optimizations.

I don't have a strict opinion here but I thought the assertions belong to the `block->end()->sux_at(i)/block->exception_handler_at(i)` calls below as an additional verification of the kind of blocks. But I'm fine with both.

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

PR: https://git.openjdk.java.net/jdk/pull/6394


More information about the hotspot-compiler-dev mailing list