< prev index next >

src/share/vm/prims/methodHandles.cpp

Print this page
rev 8110 : 8030680: 292 cleanup from default method code assessment


 168       CallInfo info(m, k());
 169       return init_method_MemberName(mname, info);
 170     }
 171   } else if (target_klass == SystemDictionary::reflect_Constructor_klass()) {
 172     oop clazz  = java_lang_reflect_Constructor::clazz(target_oop);
 173     int slot   = java_lang_reflect_Constructor::slot(target_oop);
 174     KlassHandle k(thread, java_lang_Class::as_Klass(clazz));
 175     if (!k.is_null() && k->oop_is_instance()) {
 176       Method* m = InstanceKlass::cast(k())->method_with_idnum(slot);
 177       if (m == NULL)  return NULL;
 178       CallInfo info(m, k());
 179       return init_method_MemberName(mname, info);
 180     }
 181   }
 182   return NULL;
 183 }
 184 
 185 oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) {
 186   assert(info.resolved_appendix().is_null(), "only normal methods here");
 187   methodHandle m = info.resolved_method();

 188   KlassHandle m_klass = m->method_holder();

 189   int flags = (jushort)( m->access_flags().as_short() & JVM_RECOGNIZED_METHOD_MODIFIERS );
 190   int vmindex = Method::invalid_vtable_index;
 191 
 192   switch (info.call_kind()) {
 193   case CallInfo::itable_call:
 194     vmindex = info.itable_index();
 195     // More importantly, the itable index only works with the method holder.
 196     assert(m_klass->verify_itable_index(vmindex), "");
 197     flags |= IS_METHOD | (JVM_REF_invokeInterface << REFERENCE_KIND_SHIFT);
 198     if (TraceInvokeDynamic) {
 199       ResourceMark rm;
 200       tty->print_cr("memberName: invokeinterface method_holder::method: %s, itableindex: %d, access_flags:",
 201             Method::name_and_sig_as_C_string(m->method_holder(), m->name(), m->signature()),
 202             vmindex);
 203        m->access_flags().print_on(tty);
 204        if (!m->is_abstract()) {
 205          tty->print("default");
 206        }
 207        tty->cr();
 208     }




 168       CallInfo info(m, k());
 169       return init_method_MemberName(mname, info);
 170     }
 171   } else if (target_klass == SystemDictionary::reflect_Constructor_klass()) {
 172     oop clazz  = java_lang_reflect_Constructor::clazz(target_oop);
 173     int slot   = java_lang_reflect_Constructor::slot(target_oop);
 174     KlassHandle k(thread, java_lang_Class::as_Klass(clazz));
 175     if (!k.is_null() && k->oop_is_instance()) {
 176       Method* m = InstanceKlass::cast(k())->method_with_idnum(slot);
 177       if (m == NULL)  return NULL;
 178       CallInfo info(m, k());
 179       return init_method_MemberName(mname, info);
 180     }
 181   }
 182   return NULL;
 183 }
 184 
 185 oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) {
 186   assert(info.resolved_appendix().is_null(), "only normal methods here");
 187   methodHandle m = info.resolved_method();
 188   assert(m.not_null(), "null method handle");
 189   KlassHandle m_klass = m->method_holder();
 190   assert(m.not_null(), "null holder for method handle");
 191   int flags = (jushort)( m->access_flags().as_short() & JVM_RECOGNIZED_METHOD_MODIFIERS );
 192   int vmindex = Method::invalid_vtable_index;
 193 
 194   switch (info.call_kind()) {
 195   case CallInfo::itable_call:
 196     vmindex = info.itable_index();
 197     // More importantly, the itable index only works with the method holder.
 198     assert(m_klass->verify_itable_index(vmindex), "");
 199     flags |= IS_METHOD | (JVM_REF_invokeInterface << REFERENCE_KIND_SHIFT);
 200     if (TraceInvokeDynamic) {
 201       ResourceMark rm;
 202       tty->print_cr("memberName: invokeinterface method_holder::method: %s, itableindex: %d, access_flags:",
 203             Method::name_and_sig_as_C_string(m->method_holder(), m->name(), m->signature()),
 204             vmindex);
 205        m->access_flags().print_on(tty);
 206        if (!m->is_abstract()) {
 207          tty->print("default");
 208        }
 209        tty->cr();
 210     }


< prev index next >