RFR: 8338471: Refactor Method::get_new_method() for better NoSuchMethodError handling [v2]

David Holmes dholmes at openjdk.org
Mon Sep 9 03:32:05 UTC 2024


On Mon, 9 Sep 2024 03:24:05 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Matias Saavedra Silva has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fixed conditional to check for is_deleted()
>
> src/hotspot/share/oops/method.hpp line 853:
> 
>> 851:     Method* new_method = method_holder()->method_with_idnum(orig_method_idnum());
>> 852:     assert(this != new_method, "sanity check");
>> 853:     return (new_method == nullptr || is_deleted()) ? Universe::throw_no_such_method_error() : new_method;
> 
> I am still confused by the different possibilities here. Under what conditions will we get nullptr? Is it the case that `get_new_method` should only be called when `is_old()` is true? Can `is_old` and `is_deleted` be true at the same time?

To answer some of my own questions:
- yes `get_new_method` should only be called if `is_old` is true. (Should we assert that?)
- yes a method can be old and deleted at the same time.

I remain unclear how nullptr can appear here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20874#discussion_r1749510581


More information about the hotspot-dev mailing list