hotspot/src/share/vm/ci/ciMethod.cpp
changeset 31019 d05fcdd70109
parent 30223 82ab7b6b4927
child 31228 8e427370cdd1
equal deleted inserted replaced
30886:d2a0ec86d6ef 31019:d05fcdd70109
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   784    KlassHandle h_recv       (THREAD, exact_receiver->get_Klass());
   784    KlassHandle h_recv       (THREAD, exact_receiver->get_Klass());
   785    KlassHandle h_resolved   (THREAD, holder()->get_Klass());
   785    KlassHandle h_resolved   (THREAD, holder()->get_Klass());
   786    Symbol* h_name      = name()->get_symbol();
   786    Symbol* h_name      = name()->get_symbol();
   787    Symbol* h_signature = signature()->get_symbol();
   787    Symbol* h_signature = signature()->get_symbol();
   788 
   788 
       
   789    LinkInfo link_info(h_resolved, h_name, h_signature, caller_klass, check_access);
   789    methodHandle m;
   790    methodHandle m;
   790    // Only do exact lookup if receiver klass has been linked.  Otherwise,
   791    // Only do exact lookup if receiver klass has been linked.  Otherwise,
   791    // the vtable has not been setup, and the LinkResolver will fail.
   792    // the vtable has not been setup, and the LinkResolver will fail.
   792    if (h_recv->oop_is_array()
   793    if (h_recv->oop_is_array()
   793         ||
   794         ||
   794        InstanceKlass::cast(h_recv())->is_linked() && !exact_receiver->is_interface()) {
   795        InstanceKlass::cast(h_recv())->is_linked() && !exact_receiver->is_interface()) {
   795      if (holder()->is_interface()) {
   796      if (holder()->is_interface()) {
   796        m = LinkResolver::resolve_interface_call_or_null(h_recv, h_resolved, h_name, h_signature, caller_klass, check_access);
   797        m = LinkResolver::resolve_interface_call_or_null(h_recv, link_info);
   797      } else {
   798      } else {
   798        m = LinkResolver::resolve_virtual_call_or_null(h_recv, h_resolved, h_name, h_signature, caller_klass, check_access);
   799        m = LinkResolver::resolve_virtual_call_or_null(h_recv, link_info);
   799      }
   800      }
   800    }
   801    }
   801 
   802 
   802    if (m.is_null()) {
   803    if (m.is_null()) {
   803      // Return NULL only if there was a problem with lookup (uninitialized class, etc.)
   804      // Return NULL only if there was a problem with lookup (uninitialized class, etc.)
   837      KlassHandle caller_klass (THREAD, caller->get_Klass());
   838      KlassHandle caller_klass (THREAD, caller->get_Klass());
   838      KlassHandle h_recv       (THREAD, receiver->get_Klass());
   839      KlassHandle h_recv       (THREAD, receiver->get_Klass());
   839      Symbol* h_name = name()->get_symbol();
   840      Symbol* h_name = name()->get_symbol();
   840      Symbol* h_signature = signature()->get_symbol();
   841      Symbol* h_signature = signature()->get_symbol();
   841 
   842 
   842      vtable_index = LinkResolver::resolve_virtual_vtable_index(h_recv, h_recv, h_name, h_signature, caller_klass);
   843      LinkInfo link_info(h_recv, h_name, h_signature, caller_klass);
       
   844      vtable_index = LinkResolver::resolve_virtual_vtable_index(h_recv, link_info);
   843      if (vtable_index == Method::nonvirtual_vtable_index) {
   845      if (vtable_index == Method::nonvirtual_vtable_index) {
   844        // A statically bound method.  Return "no such index".
   846        // A statically bound method.  Return "no such index".
   845        vtable_index = Method::invalid_vtable_index;
   847        vtable_index = Method::invalid_vtable_index;
   846      }
   848      }
   847    }
   849    }
  1283   VM_ENTRY_MARK;
  1285   VM_ENTRY_MARK;
  1284   {
  1286   {
  1285     EXCEPTION_MARK;
  1287     EXCEPTION_MARK;
  1286     HandleMark hm(THREAD);
  1288     HandleMark hm(THREAD);
  1287     constantPoolHandle pool (THREAD, get_Method()->constants());
  1289     constantPoolHandle pool (THREAD, get_Method()->constants());
  1288     methodHandle spec_method;
       
  1289     KlassHandle  spec_klass;
       
  1290     Bytecodes::Code code = (is_static ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual);
  1290     Bytecodes::Code code = (is_static ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual);
  1291     LinkResolver::resolve_method_statically(spec_method, spec_klass, code, pool, refinfo_index, THREAD);
  1291     methodHandle spec_method = LinkResolver::resolve_method_statically(code, pool, refinfo_index, THREAD);
  1292     if (HAS_PENDING_EXCEPTION) {
  1292     if (HAS_PENDING_EXCEPTION) {
  1293       CLEAR_PENDING_EXCEPTION;
  1293       CLEAR_PENDING_EXCEPTION;
  1294       return false;
  1294       return false;
  1295     } else {
  1295     } else {
  1296       return (spec_method->is_static() == is_static);
  1296       return (spec_method->is_static() == is_static);