RFR: 8339299: C1 will miss type profile when inline final method

Dean Long dlong at openjdk.org
Fri Aug 30 22:37:32 UTC 2024


On Fri, 30 Aug 2024 22:21:10 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> src/hotspot/share/c1/c1_LIR.hpp line 2037:
>> 
>>> 2035:     bool callee_is_static = _profiled_callee->is_loaded() && _profiled_callee->is_static();
>>> 2036:     Bytecodes::Code bc = _profiled_method->java_code_at_bci(_profiled_bci);
>>> 2037:     bool call_is_virtual = (bc == Bytecodes::_invokevirtual && (UseCHA || !_profiled_callee->can_be_statically_bound())) || bc == Bytecodes::_invokeinterface;
>> 
>> UseCHA is on by default, so this effectively always turns on profiling.  I think it would be better if we set a flag that says if CHA was used or not.
>
> IMO a better option is to simply drop `can_be_statically_bound()` check here. As this bug demonstrates, selected method at call site (represented by `_profiled_callee`) is not an accurate representation of call site behavior.
> 
> Instead, to keep things simple, a check for private methods (which don't participate in virtual dispatch) can be introduced.

Would it be more appropriate to use can_be_statically_bound(ciInstanceKlass* context) here, where in this case _profiled_callee is Child1 and context is Parent?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20786#discussion_r1739484828


More information about the hotspot-compiler-dev mailing list