ResolvedMethodName::vmholder unused?
coleen.phillimore at oracle.com
coleen.phillimore at oracle.com
Tue May 8 00:52:46 UTC 2018
The vmholder field is the owner (mirror) of the Method* that is stored
in the ResolvedMethodName. If all references to the mirror go away,
then the Method* memory in metaspace will be reclaimed. Unfortunately
for a special case, the clazz field of MemberName is not the holder of
the method. Unless this has changed.
java_lang_invoke_MemberName::set_clazz (mname_oop,
m_klass->java_mirror());
m_klass for an interface for vtable_call is java.lang.Object so would
not keep the Method* from being reclaimed.
// Add a reference to the loader (actually mirror because anonymous
classes will not have
// distinct loaders) to ensure the metadata is kept alive.
// This mirror may be different than the one in clazz field.
new_resolved_method->obj_field_put(_vmholder_offset,
m->method_holder()->java_mirror());
resolved_method = ResolvedMethodTable::add_method(Handle(THREAD,
new_resolved_method));
Thanks,
Coleen
On 5/7/18 8:45 PM, Vladimir Ivanov wrote:
> Ioi,
>
> Though the field is never accessed directly,
> ResolvedMethodName::vmholder is still tracked by GC and keeps the
> metadata it accompanies (RMN::vmtarget) alive until RMN is reachable.
>
> Best regards,
> Vladimir Ivanov
>
> On 5/7/18 17:29, Ioi Lam wrote:
>> I don't see anywhere in HotSpot that uses
>> java_lang_invoke_ResolvedMethodName::_vmholder_offset, which is
>> declared here:
>>
>> http://hg.openjdk.java.net/jdk/jdk/file/7444101401b2/src/hotspot/share/classfile/javaClasses.hpp#l1057
>>
>> http://hg.openjdk.java.net/jdk/jdk/file/9608f7f41c4e/src/java.base/share/classes/java/lang/invoke/MemberName.java#l75
>>
>>
>> I tried commenting out the initialization of this field and was able
>> to run a simple Lambda test.
>>
>> diff -r 9255cb73f048 src/hotspot/share/classfile/javaClasses.cpp
>> --- a/src/hotspot/share/classfile/javaClasses.cpp Mon May 07
>> 15:29:31 2018 -0700
>> +++ b/src/hotspot/share/classfile/javaClasses.cpp Mon May 07
>> 17:27:27 2018 -0700
>> @@ -3808,7 +3808,7 @@
>> // Add a reference to the loader (actually mirror because
>> anonymous classes will not have
>> // distinct loaders) to ensure the metadata is kept alive.
>> // This mirror may be different than the one in clazz field.
>> - new_resolved_method->obj_field_put(_vmholder_offset,
>> m->method_holder()->java_mirror());
>> + //new_resolved_method->obj_field_put(_vmholder_offset,
>> m->method_holder()->java_mirror());
>> resolved_method =
>> ResolvedMethodTable::add_method(Handle(THREAD, new_resolved_method));
>> }
>>
>>
>> Any plans to use vmholder in the future? Or, is this used by any
>> non-HotSpot VM?
>>
>> If no one uses it, I'll file an RFE to remove it, so we can save a
>> pointer per MemberName.
>>
>> Thanks
>> - Ioi
>>
>>
>>
>> _______________________________________________
>> mlvm-dev mailing list
>> mlvm-dev at openjdk.java.net
>> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
More information about the hotspot-dev
mailing list