RFR: 8255301: Common and strengthen the code in ciMemberName and ciMethodHandle
Vladimir Ivanov
vlivanov at openjdk.java.net
Fri Oct 23 08:55:37 UTC 2020
On Fri, 23 Oct 2020 08:40:55 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> src/hotspot/share/ci/ciMemberName.cpp line 46:
>>
>>> 44: return CURRENT_ENV->get_method((Method*) vmtarget);
>>> 45: } else {
>>> 46: fatal("vmtarget should be a method");
>>
>> There's a slight difference in behavior here: `fatal()` is present in product binaries while `assert()` is not.
>> Is the change deliberate?
>
> Yes. Because AFAICS, the `get_vmtarget` callers use the result without any null checks, calling member methods off that `ciMethod*`, and thus release bits would (hopefully) `SEGV` if this path is taken. In this case, it seems prudent to `fatal()` at sensible point before that happens.
Ok. I took a closer look and noticed that `java_lang_invoke_MemberName::vmtarget` already returns `Method*`. So, the code can be rewritten as follows:
Method* vmtarget = java_lang_invoke_MemberName::vmtarget(get_oop());
return CURRENT_ENV->get_method(vmtarget);
-------------
PR: https://git.openjdk.java.net/jdk/pull/825
More information about the hotspot-compiler-dev
mailing list