RFR (S): 8072588 - JVM crashes in JNI if toString is declared as an interface method

Andreas Eriksson andreas.eriksson at oracle.com
Fri Mar 20 14:24:18 UTC 2015


Hi Karen

I discussed this with David, and he thought it best if you took a look, 
if you can spare the time.
Webrev is here: http://cr.openjdk.java.net/~aeriksso/8072588/webrev.00/

Also, we discussed another way that might solve this, which is to 
replace the vtable index with an itable index for interface classes.
Basically, in assign_itable_indices_for_interface (klassVtable.cpp) 
remove the checks for if there already is a vtable index.

if (!m->has_vtable_index()) {
   assert(m->vtable_index() == Method::pending_itable_index, "set by initialize_vtable");
   m->set_itable_index(ime_num);
   ...

Which way do you think is best?

Regards,
Andreas

On 2015-03-20 10:14, David Simms wrote:
>
> Looks good to me (not a 'R'-eviewer)
>
> I'd like to have your test checked in if possible. Native JNI testing 
> has just recently been added, we can talk about the details off-list.
>
> /David Simms
>
> On 19/03/15 17:45, Andreas Eriksson wrote:
>> Hi,
>>
>> Could someone please take a look at this?
>>
>> Regards,
>> Andreas
>>
>> On 2015-03-10 17:10, Andreas Eriksson wrote:
>>> Hi,
>>>
>>> Please review this fix for a JNI issue in jni_invoke_nonstatic.
>>>
>>> The problem is that when toString is declared as an interface method 
>>> it still has a vtable index, not an itable index as 
>>> jni_invoke_nonstatic expects.
>>>
>>> This fix checks for a valid itable index instead of checking if the 
>>> holder is an interface.
>>> I also moved a duplicated check for JNI_VIRTUAL to be done in one 
>>> check instead.
>>> The change has been verified to fix the problem with a small JNI 
>>> test, and has passed a jprt run with the hotspot testset.
>>>
>>> Webrev:
>>> http://cr.openjdk.java.net/~aeriksso/8072588/webrev.00/
>>>
>>> Regards,
>>> Andreas
>>
>



More information about the hotspot-runtime-dev mailing list