RFR: 8282024: add EscapeAnalysis statistics under PrintOptoStatistics [v8]
Cesar Soares
duke at openjdk.java.net
Tue May 10 19:33:35 UTC 2022
On Mon, 9 May 2022 23:48:58 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> aamarsh has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
>>
>> adding escape analysis and scalar replacement statistics
>
> src/hotspot/share/opto/compile.cpp line 2217:
>
>> 2215: Atomic::add(&ConnectionGraph::_arg_escape_counter, _local_arg_escape_ctr);
>> 2216: Atomic::add(&ConnectionGraph::_global_escape_counter, _local_global_escape_ctr);
>> 2217: #endif
>
> These should be done inside `ConnectionGraph` - don't expose EA counters to an other class. You can use a static method in `ConnectionGraph` to do that.
>
> `_no_escape_counter, _local_no_escape_ctr + total_scalar_replaced` is wrong. You are doubling number because `total_scalar_replaced` is part of `_local_no_escape_ctr`. Keep these numbers separate. Also `mexp._local_scalar_replaced` could be update later during `PhaseMacroExpand::expand_macro_nodes()` call after loop optimizations.
>
> And such collection is not accurate (over-counted) due to EA iterations - each iteration may add the same numbers. Which could be fine if you say that in comments so people know.
Thanks for the review @vnkozlov .
> These should be done inside ConnectionGraph - don't expose EA counters to an other class. You can use a static method in ConnectionGraph to do that.
I also didn't like this. The iterative EA and not having the last `congraph` available after the loop complicated a bit the logic here. We'll work to improve this code.
> _no_escape_counter, _local_no_escape_ctr + total_scalar_replaced is wrong. You are doubling number because total_scalar_replaced is part of _local_no_escape_ctr
I see your point here. As @navyxliu mentioned, the "local_scalar_replaced" is used as an adjustment to keep record of the objects scalar replaced in **previous iterations**. However, this approach incorrectly handles numbers in the **last iteration**. In the last iteration _local_no_escape_ctr is always correct and we don't need to add the objects SR in that iteration.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8019
More information about the hotspot-compiler-dev
mailing list