RFR: 8338471: Refactor Method::get_new_method() for better NoSuchMethodError handling
Dean Long
dlong at openjdk.org
Thu Sep 12 03:38:07 UTC 2024
On Fri, 6 Sep 2024 13:12:29 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> This patch cleans up the use of `get_new_method()` so callers don't have to worry about throwing `NoSuchMethodError`. The method is refactored to throw the error and avoid ever returning nullptr. Verified with tier1-5 tests.
>
> What should this return for a deleted method?
>
> // ------------------------------------------------------------------
> // ciMethod::equals
> //
> // Returns true if the methods are the same, taking redefined methods
> // into account.
> bool ciMethod::equals(const ciMethod* m) const {
> if (this == m) return true;
> VM_ENTRY_MARK;
> Method* m1 = this->get_Method();
> Method* m2 = m->get_Method();
> if (m1->is_old()) m1 = m1->get_new_method();
> if (m2->is_old()) m2 = m2->get_new_method();
> return m1 != Universe::no_such_method_error() && m1 == m2; // ???
> }
@coleenp , I think it is enough for ciMethod::equals() to simply compare the values of orig_method_idnum() and not deal with old/deleted methods directly, but the last time I checked what orig_method_idnum() really meant I got confused by the idnum renumbering, so I wasn't able to convince myself that using orig_method_idnum() for comparison was correct.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20874#issuecomment-2345200106
More information about the serviceability-dev
mailing list