RFR: 8282024: add EscapeAnalysis statistics under PrintOptoStatistics [v8]
Xin Liu
xliu at openjdk.java.net
Tue May 10 21:17:54 UTC 2022
On Tue, 10 May 2022 19:31:03 GMT, Cesar Soares <duke at openjdk.java.net> wrote:
>> 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.
I see. this patch counts the scalarized objects twice in last iteration. need to subtract `mexp._local_scalar_replaced` .
-------------
PR: https://git.openjdk.java.net/jdk/pull/8019
More information about the hotspot-compiler-dev
mailing list