RFR: JDK-8258603 c1 IR::verify is expensive

Ludvig Janiuk duke at openjdk.java.net
Thu Dec 16 12:35:57 UTC 2021


On Thu, 16 Dec 2021 10:40:15 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> IR::verify iterates the whole object graph. This proves costly when used in e.g. BlockMerger inside of iterations over BlockLists, leading to quadratic or worse complexities as a function of bytecode length. In several cases, only a few Blocks were changed, and there was no need to go over the whole graph, but until now there was no less blunt tool for verification than IR::verify.
>> 
>> This PR introduces IR::verify_local, intended to be used when only a defined set of blocks have been modified. As a complement, expand_with_neighbors provides a way to also capture the neighbors of the "modified set" ahead of modification, so that afterwards the appropriate asserts can be made on all blocks which might possibly have been changed. All this should let us remove the expensive IR::verify calls, while still performing equivalent (or stricter) assertions.
>> 
>> Some changes have been made in the verifiers along the way. Some amount of refactoring, and even added invariants (see validate_edge_mutiality).
>
> I think it's a good idea to narrow the verification down to the blocks which are actually changed and also add some additional verification steps. Even with the newly added checks, it should still be better than running a complete check each time. Did you observe a big gain in the C1 compilation time for debug builds with your new patch? Maybe you also want to check again with the tests from https://github.com/openjdk/jdk16/pull/44.

@chhagedorn Thank you for the review! I will get to cleaning up the comments, and I'll also get back about changes in compilations times.

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

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


More information about the hotspot-compiler-dev mailing list