RFR: JDK-8258603 c1 IR::verify is expensive [v7]
Vladimir Kozlov
kvn at openjdk.java.net
Tue Jan 4 20:08:16 UTC 2022
On Mon, 3 Jan 2022 09:44:41 GMT, Ludvig Janiuk <duke at openjdk.java.net> 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).
>
> Ludvig Janiuk has updated the pull request incrementally with three additional commits since the last revision:
>
> - whitespace
> - fix on SSOT
> - SSOT part 2
I am not comfortable with repeated `#ifdef` around verification methods calls. But you have to pass local `blocks_to_verify_later` which is defined only in debug VM.
I'm fine with using `__DO_DELAYED_VERIFICATION` but add comment to the definition explaining what it is for.
Also don't use leading `__` - we don't do that.
I think you can simply put verification methods declaration undo `ASSERT` in `c1_IR.hpp`:
void print(bool cfg_only, bool live_only = false) PRODUCT_RETURN;
- void verify() PRODUCT_RETURN;
+
+#ifdef ASSERT
+ void verify();
+ void expand_with_neighborhood();
+ void verify_local();
+#endif // ASSERT
};
And put everything from `class EndNotNullValidator` to `IR::verify()` under `#ifdef ASSERT` in `c1_IR.cpp`.
(And move `#endif // PRODUCT` before `class EndNotNullValidator`.)
This way verification code will be defined only in debug VM and print code will be in optimized and debug VM.
And please update copyright year to 2022 in changed files headers.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6850
More information about the hotspot-compiler-dev
mailing list