Path: blob/master/src/hotspot/share/ci/ciMethod.cpp
64440 views
/*1* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "ci/ciCallProfile.hpp"26#include "ci/ciExceptionHandler.hpp"27#include "ci/ciInstanceKlass.hpp"28#include "ci/ciMethod.hpp"29#include "ci/ciMethodBlocks.hpp"30#include "ci/ciMethodData.hpp"31#include "ci/ciStreams.hpp"32#include "ci/ciSymbol.hpp"33#include "ci/ciReplay.hpp"34#include "ci/ciSymbols.hpp"35#include "ci/ciUtilities.inline.hpp"36#include "compiler/abstractCompiler.hpp"37#include "compiler/methodLiveness.hpp"38#include "interpreter/interpreter.hpp"39#include "interpreter/linkResolver.hpp"40#include "interpreter/oopMapCache.hpp"41#include "memory/allocation.inline.hpp"42#include "memory/resourceArea.hpp"43#include "oops/generateOopMap.hpp"44#include "oops/method.inline.hpp"45#include "oops/oop.inline.hpp"46#include "prims/methodHandles.hpp"47#include "runtime/deoptimization.hpp"48#include "runtime/handles.inline.hpp"49#include "utilities/bitMap.inline.hpp"50#include "utilities/xmlstream.hpp"51#ifdef COMPILER252#include "ci/bcEscapeAnalyzer.hpp"53#include "ci/ciTypeFlow.hpp"54#include "oops/method.hpp"55#endif5657// ciMethod58//59// This class represents a Method* in the HotSpot virtual60// machine.616263// ------------------------------------------------------------------64// ciMethod::ciMethod65//66// Loaded method.67ciMethod::ciMethod(const methodHandle& h_m, ciInstanceKlass* holder) :68ciMetadata(h_m()),69_holder(holder)70{71assert(h_m() != NULL, "no null method");7273if (LogTouchedMethods) {74h_m->log_touched(Thread::current());75}76// These fields are always filled in in loaded methods.77_flags = ciFlags(h_m->access_flags());7879// Easy to compute, so fill them in now.80_max_stack = h_m->max_stack();81_max_locals = h_m->max_locals();82_code_size = h_m->code_size();83_handler_count = h_m->exception_table_length();84_size_of_parameters = h_m->size_of_parameters();85_uses_monitors = h_m->access_flags().has_monitor_bytecodes();86_balanced_monitors = !_uses_monitors || h_m->access_flags().is_monitor_matching();87_is_c1_compilable = !h_m->is_not_c1_compilable();88_is_c2_compilable = !h_m->is_not_c2_compilable();89_can_be_parsed = true;90_has_reserved_stack_access = h_m->has_reserved_stack_access();91_is_overpass = h_m->is_overpass();92// Lazy fields, filled in on demand. Require allocation.93_code = NULL;94_exception_handlers = NULL;95_liveness = NULL;96_method_blocks = NULL;97#if defined(COMPILER2)98_flow = NULL;99_bcea = NULL;100#endif // COMPILER2101102// Check for blackhole intrinsic and then populate the intrinsic ID.103CompilerOracle::tag_blackhole_if_possible(h_m);104_intrinsic_id = h_m->intrinsic_id();105106ciEnv *env = CURRENT_ENV;107if (env->jvmti_can_hotswap_or_post_breakpoint()) {108// 6328518 check hotswap conditions under the right lock.109MutexLocker locker(Compile_lock);110if (Dependencies::check_evol_method(h_m()) != NULL) {111_is_c1_compilable = false;112_is_c2_compilable = false;113_can_be_parsed = false;114}115} else {116DEBUG_ONLY(CompilerThread::current()->check_possible_safepoint());117}118119if (h_m->method_holder()->is_linked()) {120_can_be_statically_bound = h_m->can_be_statically_bound();121} else {122// Have to use a conservative value in this case.123_can_be_statically_bound = false;124}125126// Adjust the definition of this condition to be more useful:127// %%% take these conditions into account in vtable generation128if (!_can_be_statically_bound && h_m->is_private())129_can_be_statically_bound = true;130if (_can_be_statically_bound && h_m->is_abstract())131_can_be_statically_bound = false;132133// generating _signature may allow GC and therefore move m.134// These fields are always filled in.135_name = env->get_symbol(h_m->name());136ciSymbol* sig_symbol = env->get_symbol(h_m->signature());137constantPoolHandle cpool(Thread::current(), h_m->constants());138_signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol);139_method_data = NULL;140_nmethod_age = h_m->nmethod_age();141// Take a snapshot of these values, so they will be commensurate with the MDO.142if (ProfileInterpreter || CompilerConfig::is_c1_profiling()) {143int invcnt = h_m->interpreter_invocation_count();144// if the value overflowed report it as max int145_interpreter_invocation_count = invcnt < 0 ? max_jint : invcnt ;146_interpreter_throwout_count = h_m->interpreter_throwout_count();147} else {148_interpreter_invocation_count = 0;149_interpreter_throwout_count = 0;150}151if (_interpreter_invocation_count == 0)152_interpreter_invocation_count = 1;153_instructions_size = -1;154#ifdef ASSERT155if (ReplayCompiles) {156ciReplay::initialize(this);157}158#endif159}160161162// ------------------------------------------------------------------163// ciMethod::ciMethod164//165// Unloaded method.166ciMethod::ciMethod(ciInstanceKlass* holder,167ciSymbol* name,168ciSymbol* signature,169ciInstanceKlass* accessor) :170ciMetadata((Metadata*)NULL),171_name( name),172_holder( holder),173_method_data( NULL),174_method_blocks( NULL),175_intrinsic_id( vmIntrinsics::_none),176_instructions_size(-1),177_can_be_statically_bound(false),178_liveness( NULL)179#if defined(COMPILER2)180,181_flow( NULL),182_bcea( NULL)183#endif // COMPILER2184{185// Usually holder and accessor are the same type but in some cases186// the holder has the wrong class loader (e.g. invokedynamic call187// sites) so we pass the accessor.188_signature = new (CURRENT_ENV->arena()) ciSignature(accessor, constantPoolHandle(), signature);189}190191192// ------------------------------------------------------------------193// ciMethod::load_code194//195// Load the bytecodes and exception handler table for this method.196void ciMethod::load_code() {197VM_ENTRY_MARK;198assert(is_loaded(), "only loaded methods have code");199200Method* me = get_Method();201Arena* arena = CURRENT_THREAD_ENV->arena();202203// Load the bytecodes.204_code = (address)arena->Amalloc(code_size());205memcpy(_code, me->code_base(), code_size());206207#if INCLUDE_JVMTI208// Revert any breakpoint bytecodes in ci's copy209if (me->number_of_breakpoints() > 0) {210BreakpointInfo* bp = me->method_holder()->breakpoints();211for (; bp != NULL; bp = bp->next()) {212if (bp->match(me)) {213code_at_put(bp->bci(), bp->orig_bytecode());214}215}216}217#endif218219// And load the exception table.220ExceptionTable exc_table(me);221222// Allocate one extra spot in our list of exceptions. This223// last entry will be used to represent the possibility that224// an exception escapes the method. See ciExceptionHandlerStream225// for details.226_exception_handlers =227(ciExceptionHandler**)arena->Amalloc(sizeof(ciExceptionHandler*)228* (_handler_count + 1));229if (_handler_count > 0) {230for (int i=0; i<_handler_count; i++) {231_exception_handlers[i] = new (arena) ciExceptionHandler(232holder(),233/* start */ exc_table.start_pc(i),234/* limit */ exc_table.end_pc(i),235/* goto pc */ exc_table.handler_pc(i),236/* cp index */ exc_table.catch_type_index(i));237}238}239240// Put an entry at the end of our list to represent the possibility241// of exceptional exit.242_exception_handlers[_handler_count] =243new (arena) ciExceptionHandler(holder(), 0, code_size(), -1, 0);244245if (CIPrintMethodCodes) {246print_codes();247}248}249250251// ------------------------------------------------------------------252// ciMethod::has_linenumber_table253//254// length unknown until decompression255bool ciMethod::has_linenumber_table() const {256check_is_loaded();257VM_ENTRY_MARK;258return get_Method()->has_linenumber_table();259}260261262// ------------------------------------------------------------------263// ciMethod::line_number_from_bci264int ciMethod::line_number_from_bci(int bci) const {265check_is_loaded();266VM_ENTRY_MARK;267return get_Method()->line_number_from_bci(bci);268}269270271// ------------------------------------------------------------------272// ciMethod::vtable_index273//274// Get the position of this method's entry in the vtable, if any.275int ciMethod::vtable_index() {276check_is_loaded();277assert(holder()->is_linked(), "must be linked");278VM_ENTRY_MARK;279return get_Method()->vtable_index();280}281282// ------------------------------------------------------------------283// ciMethod::uses_balanced_monitors284//285// Does this method use monitors in a strict stack-disciplined manner?286bool ciMethod::has_balanced_monitors() {287check_is_loaded();288if (_balanced_monitors) return true;289290// Analyze the method to see if monitors are used properly.291VM_ENTRY_MARK;292methodHandle method(THREAD, get_Method());293assert(method->has_monitor_bytecodes(), "should have checked this");294295// Check to see if a previous compilation computed the296// monitor-matching analysis.297if (method->guaranteed_monitor_matching()) {298_balanced_monitors = true;299return true;300}301302{303ExceptionMark em(THREAD);304ResourceMark rm(THREAD);305GeneratePairingInfo gpi(method);306if (!gpi.compute_map(THREAD)) {307fatal("Unrecoverable verification or out-of-memory error");308}309if (!gpi.monitor_safe()) {310return false;311}312method->set_guaranteed_monitor_matching();313_balanced_monitors = true;314}315return true;316}317318319// ------------------------------------------------------------------320// ciMethod::get_flow_analysis321ciTypeFlow* ciMethod::get_flow_analysis() {322#if defined(COMPILER2)323if (_flow == NULL) {324ciEnv* env = CURRENT_ENV;325_flow = new (env->arena()) ciTypeFlow(env, this);326_flow->do_flow();327}328return _flow;329#else // COMPILER2330ShouldNotReachHere();331return NULL;332#endif // COMPILER2333}334335336// ------------------------------------------------------------------337// ciMethod::get_osr_flow_analysis338ciTypeFlow* ciMethod::get_osr_flow_analysis(int osr_bci) {339#if defined(COMPILER2)340// OSR entry points are always place after a call bytecode of some sort341assert(osr_bci >= 0, "must supply valid OSR entry point");342ciEnv* env = CURRENT_ENV;343ciTypeFlow* flow = new (env->arena()) ciTypeFlow(env, this, osr_bci);344flow->do_flow();345return flow;346#else // COMPILER2347ShouldNotReachHere();348return NULL;349#endif // COMPILER2350}351352// ------------------------------------------------------------------353// ciMethod::raw_liveness_at_bci354//355// Which local variables are live at a specific bci?356MethodLivenessResult ciMethod::raw_liveness_at_bci(int bci) {357check_is_loaded();358if (_liveness == NULL) {359// Create the liveness analyzer.360Arena* arena = CURRENT_ENV->arena();361_liveness = new (arena) MethodLiveness(arena, this);362_liveness->compute_liveness();363}364return _liveness->get_liveness_at(bci);365}366367// ------------------------------------------------------------------368// ciMethod::liveness_at_bci369//370// Which local variables are live at a specific bci? When debugging371// will return true for all locals in some cases to improve debug372// information.373MethodLivenessResult ciMethod::liveness_at_bci(int bci) {374if (CURRENT_ENV->should_retain_local_variables() || DeoptimizeALot) {375// Keep all locals live for the user's edification and amusement.376MethodLivenessResult result(_max_locals);377result.set_range(0, _max_locals);378result.set_is_valid();379return result;380}381return raw_liveness_at_bci(bci);382}383384// ciMethod::live_local_oops_at_bci385//386// find all the live oops in the locals array for a particular bci387// Compute what the interpreter believes by using the interpreter388// oopmap generator. This is used as a double check during osr to389// guard against conservative result from MethodLiveness making us390// think a dead oop is live. MethodLiveness is conservative in the391// sense that it may consider locals to be live which cannot be live,392// like in the case where a local could contain an oop or a primitive393// along different paths. In that case the local must be dead when394// those paths merge. Since the interpreter's viewpoint is used when395// gc'ing an interpreter frame we need to use its viewpoint during396// OSR when loading the locals.397398ResourceBitMap ciMethod::live_local_oops_at_bci(int bci) {399VM_ENTRY_MARK;400InterpreterOopMap mask;401OopMapCache::compute_one_oop_map(methodHandle(THREAD, get_Method()), bci, &mask);402int mask_size = max_locals();403ResourceBitMap result(mask_size);404int i;405for (i = 0; i < mask_size ; i++ ) {406if (mask.is_oop(i)) result.set_bit(i);407}408return result;409}410411412#ifdef COMPILER1413// ------------------------------------------------------------------414// ciMethod::bci_block_start415//416// Marks all bcis where a new basic block starts417const BitMap& ciMethod::bci_block_start() {418check_is_loaded();419if (_liveness == NULL) {420// Create the liveness analyzer.421Arena* arena = CURRENT_ENV->arena();422_liveness = new (arena) MethodLiveness(arena, this);423_liveness->compute_liveness();424}425426return _liveness->get_bci_block_start();427}428#endif // COMPILER1429430431// ------------------------------------------------------------------432// ciMethod::check_overflow433//434// Check whether the profile counter is overflowed and adjust if true.435// For invoke* it will turn negative values into max_jint,436// and for checkcast/aastore/instanceof turn positive values into min_jint.437int ciMethod::check_overflow(int c, Bytecodes::Code code) {438switch (code) {439case Bytecodes::_aastore: // fall-through440case Bytecodes::_checkcast: // fall-through441case Bytecodes::_instanceof: {442return (c > 0 ? min_jint : c); // always non-positive443}444default: {445assert(Bytecodes::is_invoke(code), "%s", Bytecodes::name(code));446return (c < 0 ? max_jint : c); // always non-negative447}448}449}450451452// ------------------------------------------------------------------453// ciMethod::call_profile_at_bci454//455// Get the ciCallProfile for the invocation of this method.456// Also reports receiver types for non-call type checks (if TypeProfileCasts).457ciCallProfile ciMethod::call_profile_at_bci(int bci) {458ResourceMark rm;459ciCallProfile result;460if (method_data() != NULL && method_data()->is_mature()) {461ciProfileData* data = method_data()->bci_to_data(bci);462if (data != NULL && data->is_CounterData()) {463// Every profiled call site has a counter.464int count = check_overflow(data->as_CounterData()->count(), java_code_at_bci(bci));465466if (!data->is_ReceiverTypeData()) {467result._receiver_count[0] = 0; // that's a definite zero468} else { // ReceiverTypeData is a subclass of CounterData469ciReceiverTypeData* call = (ciReceiverTypeData*)data->as_ReceiverTypeData();470// In addition, virtual call sites have receiver type information471int receivers_count_total = 0;472int morphism = 0;473// Precompute morphism for the possible fixup474for (uint i = 0; i < call->row_limit(); i++) {475ciKlass* receiver = call->receiver(i);476if (receiver == NULL) continue;477morphism++;478}479int epsilon = 0;480// For a call, it is assumed that either the type of the receiver(s)481// is recorded or an associated counter is incremented, but not both. With482// tiered compilation, however, both can happen due to the interpreter and483// C1 profiling invocations differently. Address that inconsistency here.484if (morphism == 1 && count > 0) {485epsilon = count;486count = 0;487}488for (uint i = 0; i < call->row_limit(); i++) {489ciKlass* receiver = call->receiver(i);490if (receiver == NULL) continue;491int rcount = saturated_add(call->receiver_count(i), epsilon);492if (rcount == 0) rcount = 1; // Should be valid value493receivers_count_total = saturated_add(receivers_count_total, rcount);494// Add the receiver to result data.495result.add_receiver(receiver, rcount);496// If we extend profiling to record methods,497// we will set result._method also.498}499// Determine call site's morphism.500// The call site count is 0 with known morphism (only 1 or 2 receivers)501// or < 0 in the case of a type check failure for checkcast, aastore, instanceof.502// The call site count is > 0 in the case of a polymorphic virtual call.503if (morphism > 0 && morphism == result._limit) {504// The morphism <= MorphismLimit.505if ((morphism < ciCallProfile::MorphismLimit) ||506(morphism == ciCallProfile::MorphismLimit && count == 0)) {507#ifdef ASSERT508if (count > 0) {509this->print_short_name(tty);510tty->print_cr(" @ bci:%d", bci);511this->print_codes();512assert(false, "this call site should not be polymorphic");513}514#endif515result._morphism = morphism;516}517}518// Make the count consistent if this is a call profile. If count is519// zero or less, presume that this is a typecheck profile and520// do nothing. Otherwise, increase count to be the sum of all521// receiver's counts.522if (count >= 0) {523count = saturated_add(count, receivers_count_total);524}525}526result._count = count;527}528}529return result;530}531532// ------------------------------------------------------------------533// Add new receiver and sort data by receiver's profile count.534void ciCallProfile::add_receiver(ciKlass* receiver, int receiver_count) {535// Add new receiver and sort data by receiver's counts when we have space536// for it otherwise replace the less called receiver (less called receiver537// is placed to the last array element which is not used).538// First array's element contains most called receiver.539int i = _limit;540for (; i > 0 && receiver_count > _receiver_count[i-1]; i--) {541_receiver[i] = _receiver[i-1];542_receiver_count[i] = _receiver_count[i-1];543}544_receiver[i] = receiver;545_receiver_count[i] = receiver_count;546if (_limit < MorphismLimit) _limit++;547}548549550void ciMethod::assert_virtual_call_type_ok(int bci) {551assert(java_code_at_bci(bci) == Bytecodes::_invokevirtual ||552java_code_at_bci(bci) == Bytecodes::_invokeinterface, "unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci)));553}554555void ciMethod::assert_call_type_ok(int bci) {556assert(java_code_at_bci(bci) == Bytecodes::_invokestatic ||557java_code_at_bci(bci) == Bytecodes::_invokespecial ||558java_code_at_bci(bci) == Bytecodes::_invokedynamic, "unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci)));559}560561/**562* Check whether profiling provides a type for the argument i to the563* call at bci bci564*565* @param [in]bci bci of the call566* @param [in]i argument number567* @param [out]type profiled type of argument, NULL if none568* @param [out]ptr_kind whether always null, never null or maybe null569* @return true if profiling exists570*571*/572bool ciMethod::argument_profiled_type(int bci, int i, ciKlass*& type, ProfilePtrKind& ptr_kind) {573if (MethodData::profile_parameters() && method_data() != NULL && method_data()->is_mature()) {574ciProfileData* data = method_data()->bci_to_data(bci);575if (data != NULL) {576if (data->is_VirtualCallTypeData()) {577assert_virtual_call_type_ok(bci);578ciVirtualCallTypeData* call = (ciVirtualCallTypeData*)data->as_VirtualCallTypeData();579if (i >= call->number_of_arguments()) {580return false;581}582type = call->valid_argument_type(i);583ptr_kind = call->argument_ptr_kind(i);584return true;585} else if (data->is_CallTypeData()) {586assert_call_type_ok(bci);587ciCallTypeData* call = (ciCallTypeData*)data->as_CallTypeData();588if (i >= call->number_of_arguments()) {589return false;590}591type = call->valid_argument_type(i);592ptr_kind = call->argument_ptr_kind(i);593return true;594}595}596}597return false;598}599600/**601* Check whether profiling provides a type for the return value from602* the call at bci bci603*604* @param [in]bci bci of the call605* @param [out]type profiled type of argument, NULL if none606* @param [out]ptr_kind whether always null, never null or maybe null607* @return true if profiling exists608*609*/610bool ciMethod::return_profiled_type(int bci, ciKlass*& type, ProfilePtrKind& ptr_kind) {611if (MethodData::profile_return() && method_data() != NULL && method_data()->is_mature()) {612ciProfileData* data = method_data()->bci_to_data(bci);613if (data != NULL) {614if (data->is_VirtualCallTypeData()) {615assert_virtual_call_type_ok(bci);616ciVirtualCallTypeData* call = (ciVirtualCallTypeData*)data->as_VirtualCallTypeData();617if (call->has_return()) {618type = call->valid_return_type();619ptr_kind = call->return_ptr_kind();620return true;621}622} else if (data->is_CallTypeData()) {623assert_call_type_ok(bci);624ciCallTypeData* call = (ciCallTypeData*)data->as_CallTypeData();625if (call->has_return()) {626type = call->valid_return_type();627ptr_kind = call->return_ptr_kind();628}629return true;630}631}632}633return false;634}635636/**637* Check whether profiling provides a type for the parameter i638*639* @param [in]i parameter number640* @param [out]type profiled type of parameter, NULL if none641* @param [out]ptr_kind whether always null, never null or maybe null642* @return true if profiling exists643*644*/645bool ciMethod::parameter_profiled_type(int i, ciKlass*& type, ProfilePtrKind& ptr_kind) {646if (MethodData::profile_parameters() && method_data() != NULL && method_data()->is_mature()) {647ciParametersTypeData* parameters = method_data()->parameters_type_data();648if (parameters != NULL && i < parameters->number_of_parameters()) {649type = parameters->valid_parameter_type(i);650ptr_kind = parameters->parameter_ptr_kind(i);651return true;652}653}654return false;655}656657658// ------------------------------------------------------------------659// ciMethod::find_monomorphic_target660//661// Given a certain calling environment, find the monomorphic target662// for the call. Return NULL if the call is not monomorphic in663// its calling environment, or if there are only abstract methods.664// The returned method is never abstract.665// Note: If caller uses a non-null result, it must inform dependencies666// via assert_unique_concrete_method or assert_leaf_type.667ciMethod* ciMethod::find_monomorphic_target(ciInstanceKlass* caller,668ciInstanceKlass* callee_holder,669ciInstanceKlass* actual_recv,670bool check_access) {671check_is_loaded();672673if (actual_recv->is_interface()) {674// %%% We cannot trust interface types, yet. See bug 6312651.675return NULL;676}677678ciMethod* root_m = resolve_invoke(caller, actual_recv, check_access, true /* allow_abstract */);679if (root_m == NULL) {680// Something went wrong looking up the actual receiver method.681return NULL;682}683684// Make certain quick checks even if UseCHA is false.685686// Is it private or final?687if (root_m->can_be_statically_bound()) {688assert(!root_m->is_abstract(), "sanity");689return root_m;690}691692if (actual_recv->is_leaf_type() && actual_recv == root_m->holder()) {693// Easy case. There is no other place to put a method, so don't bother694// to go through the VM_ENTRY_MARK and all the rest.695if (root_m->is_abstract()) {696return NULL;697}698return root_m;699}700701// Array methods (clone, hashCode, etc.) are always statically bound.702// If we were to see an array type here, we'd return root_m.703// However, this method processes only ciInstanceKlasses. (See 4962591.)704// The inline_native_clone intrinsic narrows Object to T[] properly,705// so there is no need to do the same job here.706707if (!UseCHA) return NULL;708709VM_ENTRY_MARK;710711methodHandle target;712{713MutexLocker locker(Compile_lock);714InstanceKlass* context = actual_recv->get_instanceKlass();715if (UseVtableBasedCHA) {716target = methodHandle(THREAD, Dependencies::find_unique_concrete_method(context,717root_m->get_Method(),718callee_holder->get_Klass(),719this->get_Method()));720} else {721if (root_m->is_abstract()) {722return NULL; // not supported723}724target = methodHandle(THREAD, Dependencies::find_unique_concrete_method(context, root_m->get_Method()));725}726assert(target() == NULL || !target()->is_abstract(), "not allowed");727// %%% Should upgrade this ciMethod API to look for 1 or 2 concrete methods.728}729730#ifndef PRODUCT731if (TraceDependencies && target() != NULL && target() != root_m->get_Method()) {732tty->print("found a non-root unique target method");733tty->print_cr(" context = %s", actual_recv->get_Klass()->external_name());734tty->print(" method = ");735target->print_short_name(tty);736tty->cr();737}738#endif //PRODUCT739740if (target() == NULL) {741return NULL;742}743if (target() == root_m->get_Method()) {744return root_m;745}746if (!root_m->is_public() &&747!root_m->is_protected()) {748// If we are going to reason about inheritance, it's easiest749// if the method in question is public, protected, or private.750// If the answer is not root_m, it is conservatively correct751// to return NULL, even if the CHA encountered irrelevant752// methods in other packages.753// %%% TO DO: Work out logic for package-private methods754// with the same name but different vtable indexes.755return NULL;756}757return CURRENT_THREAD_ENV->get_method(target());758}759760// ------------------------------------------------------------------761// ciMethod::can_be_statically_bound762//763// Tries to determine whether a method can be statically bound in some context.764bool ciMethod::can_be_statically_bound(ciInstanceKlass* context) const {765return (holder() == context) && can_be_statically_bound();766}767768// ------------------------------------------------------------------769// ciMethod::resolve_invoke770//771// Given a known receiver klass, find the target for the call.772// Return NULL if the call has no target or the target is abstract.773ciMethod* ciMethod::resolve_invoke(ciKlass* caller, ciKlass* exact_receiver, bool check_access, bool allow_abstract) {774check_is_loaded();775VM_ENTRY_MARK;776777Klass* caller_klass = caller->get_Klass();778Klass* recv = exact_receiver->get_Klass();779Klass* resolved = holder()->get_Klass();780Symbol* h_name = name()->get_symbol();781Symbol* h_signature = signature()->get_symbol();782783LinkInfo link_info(resolved, h_name, h_signature, caller_klass,784check_access ? LinkInfo::AccessCheck::required : LinkInfo::AccessCheck::skip,785check_access ? LinkInfo::LoaderConstraintCheck::required : LinkInfo::LoaderConstraintCheck::skip);786Method* m = NULL;787// Only do exact lookup if receiver klass has been linked. Otherwise,788// the vtable has not been setup, and the LinkResolver will fail.789if (recv->is_array_klass()790||791(InstanceKlass::cast(recv)->is_linked() && !exact_receiver->is_interface())) {792if (holder()->is_interface()) {793m = LinkResolver::resolve_interface_call_or_null(recv, link_info);794} else {795m = LinkResolver::resolve_virtual_call_or_null(recv, link_info);796}797}798799if (m == NULL) {800// Return NULL only if there was a problem with lookup (uninitialized class, etc.)801return NULL;802}803804ciMethod* result = this;805if (m != get_Method()) {806result = CURRENT_THREAD_ENV->get_method(m);807}808809if (result->is_abstract() && !allow_abstract) {810// Don't return abstract methods because they aren't optimizable or interesting.811return NULL;812}813return result;814}815816// ------------------------------------------------------------------817// ciMethod::resolve_vtable_index818//819// Given a known receiver klass, find the vtable index for the call.820// Return Method::invalid_vtable_index if the vtable_index is unknown.821int ciMethod::resolve_vtable_index(ciKlass* caller, ciKlass* receiver) {822check_is_loaded();823824int vtable_index = Method::invalid_vtable_index;825// Only do lookup if receiver klass has been linked. Otherwise,826// the vtable has not been setup, and the LinkResolver will fail.827if (!receiver->is_interface()828&& (!receiver->is_instance_klass() ||829receiver->as_instance_klass()->is_linked())) {830VM_ENTRY_MARK;831832Klass* caller_klass = caller->get_Klass();833Klass* recv = receiver->get_Klass();834Symbol* h_name = name()->get_symbol();835Symbol* h_signature = signature()->get_symbol();836837LinkInfo link_info(recv, h_name, h_signature, caller_klass);838vtable_index = LinkResolver::resolve_virtual_vtable_index(recv, link_info);839if (vtable_index == Method::nonvirtual_vtable_index) {840// A statically bound method. Return "no such index".841vtable_index = Method::invalid_vtable_index;842}843}844845return vtable_index;846}847848// ------------------------------------------------------------------849// ciMethod::get_field_at_bci850ciField* ciMethod::get_field_at_bci(int bci, bool &will_link) {851ciBytecodeStream iter(this);852iter.reset_to_bci(bci);853iter.next();854return iter.get_field(will_link);855}856857// ------------------------------------------------------------------858// ciMethod::get_method_at_bci859ciMethod* ciMethod::get_method_at_bci(int bci, bool &will_link, ciSignature* *declared_signature) {860ciBytecodeStream iter(this);861iter.reset_to_bci(bci);862iter.next();863return iter.get_method(will_link, declared_signature);864}865866// ------------------------------------------------------------------867ciKlass* ciMethod::get_declared_method_holder_at_bci(int bci) {868ciBytecodeStream iter(this);869iter.reset_to_bci(bci);870iter.next();871return iter.get_declared_method_holder();872}873874// ------------------------------------------------------------------875// Adjust a CounterData count to be commensurate with876// interpreter_invocation_count. If the MDO exists for877// only 25% of the time the method exists, then the878// counts in the MDO should be scaled by 4X, so that879// they can be usefully and stably compared against the880// invocation counts in methods.881int ciMethod::scale_count(int count, float prof_factor) {882if (count > 0 && method_data() != NULL) {883int counter_life;884int method_life = interpreter_invocation_count();885// In tiered the MDO's life is measured directly, so just use the snapshotted counters886counter_life = MAX2(method_data()->invocation_count(), method_data()->backedge_count());887888// counter_life due to backedge_counter could be > method_life889if (counter_life > method_life)890counter_life = method_life;891if (0 < counter_life && counter_life <= method_life) {892count = (int)((double)count * prof_factor * method_life / counter_life + 0.5);893count = (count > 0) ? count : 1;894}895}896return count;897}898899900// ------------------------------------------------------------------901// ciMethod::is_special_get_caller_class_method902//903bool ciMethod::is_ignored_by_security_stack_walk() const {904check_is_loaded();905VM_ENTRY_MARK;906return get_Method()->is_ignored_by_security_stack_walk();907}908909// ------------------------------------------------------------------910// ciMethod::needs_clinit_barrier911//912bool ciMethod::needs_clinit_barrier() const {913check_is_loaded();914return is_static() && !holder()->is_initialized();915}916917// ------------------------------------------------------------------918// invokedynamic support919920// ------------------------------------------------------------------921// ciMethod::is_method_handle_intrinsic922//923// Return true if the method is an instance of the JVM-generated924// signature-polymorphic MethodHandle methods, _invokeBasic, _linkToVirtual, etc.925bool ciMethod::is_method_handle_intrinsic() const {926vmIntrinsics::ID iid = _intrinsic_id; // do not check if loaded927return (MethodHandles::is_signature_polymorphic(iid) &&928MethodHandles::is_signature_polymorphic_intrinsic(iid));929}930931// ------------------------------------------------------------------932// ciMethod::is_compiled_lambda_form933//934// Return true if the method is a generated MethodHandle adapter.935// These are built by Java code.936bool ciMethod::is_compiled_lambda_form() const {937vmIntrinsics::ID iid = _intrinsic_id; // do not check if loaded938return iid == vmIntrinsics::_compiledLambdaForm;939}940941// ------------------------------------------------------------------942// ciMethod::is_object_initializer943//944bool ciMethod::is_object_initializer() const {945return name() == ciSymbols::object_initializer_name();946}947948// ------------------------------------------------------------------949// ciMethod::has_member_arg950//951// Return true if the method is a linker intrinsic like _linkToVirtual.952// These are built by the JVM.953bool ciMethod::has_member_arg() const {954vmIntrinsics::ID iid = _intrinsic_id; // do not check if loaded955return (MethodHandles::is_signature_polymorphic(iid) &&956MethodHandles::has_member_arg(iid));957}958959// ------------------------------------------------------------------960// ciMethod::ensure_method_data961//962// Generate new MethodData* objects at compile time.963// Return true if allocation was successful or no MDO is required.964bool ciMethod::ensure_method_data(const methodHandle& h_m) {965EXCEPTION_CONTEXT;966if (is_native() || is_abstract() || h_m()->is_accessor()) {967return true;968}969if (h_m()->method_data() == NULL) {970Method::build_interpreter_method_data(h_m, THREAD);971if (HAS_PENDING_EXCEPTION) {972CLEAR_PENDING_EXCEPTION;973}974}975if (h_m()->method_data() != NULL) {976_method_data = CURRENT_ENV->get_method_data(h_m()->method_data());977return _method_data->load_data();978} else {979_method_data = CURRENT_ENV->get_empty_methodData();980return false;981}982}983984// public, retroactive version985bool ciMethod::ensure_method_data() {986bool result = true;987if (_method_data == NULL || _method_data->is_empty()) {988GUARDED_VM_ENTRY({989methodHandle mh(Thread::current(), get_Method());990result = ensure_method_data(mh);991});992}993return result;994}995996997// ------------------------------------------------------------------998// ciMethod::method_data999//1000ciMethodData* ciMethod::method_data() {1001if (_method_data != NULL) {1002return _method_data;1003}1004VM_ENTRY_MARK;1005ciEnv* env = CURRENT_ENV;1006Thread* my_thread = JavaThread::current();1007methodHandle h_m(my_thread, get_Method());10081009if (h_m()->method_data() != NULL) {1010_method_data = CURRENT_ENV->get_method_data(h_m()->method_data());1011_method_data->load_data();1012} else {1013_method_data = CURRENT_ENV->get_empty_methodData();1014}1015return _method_data;10161017}10181019// ------------------------------------------------------------------1020// ciMethod::method_data_or_null1021// Returns a pointer to ciMethodData if MDO exists on the VM side,1022// NULL otherwise.1023ciMethodData* ciMethod::method_data_or_null() {1024ciMethodData *md = method_data();1025if (md->is_empty()) {1026return NULL;1027}1028return md;1029}10301031// ------------------------------------------------------------------1032// ciMethod::ensure_method_counters1033//1034MethodCounters* ciMethod::ensure_method_counters() {1035check_is_loaded();1036VM_ENTRY_MARK;1037methodHandle mh(THREAD, get_Method());1038MethodCounters* method_counters = mh->get_method_counters(CHECK_NULL);1039return method_counters;1040}10411042// ------------------------------------------------------------------1043// ciMethod::has_option1044//1045bool ciMethod::has_option(enum CompileCommand option) {1046check_is_loaded();1047VM_ENTRY_MARK;1048methodHandle mh(THREAD, get_Method());1049return CompilerOracle::has_option(mh, option);1050}10511052// ------------------------------------------------------------------1053// ciMethod::has_option_value1054//1055bool ciMethod::has_option_value(enum CompileCommand option, double& value) {1056check_is_loaded();1057VM_ENTRY_MARK;1058methodHandle mh(THREAD, get_Method());1059return CompilerOracle::has_option_value(mh, option, value);1060}1061// ------------------------------------------------------------------1062// ciMethod::can_be_compiled1063//1064// Have previous compilations of this method succeeded?1065bool ciMethod::can_be_compiled() {1066check_is_loaded();1067ciEnv* env = CURRENT_ENV;1068if (is_c1_compile(env->comp_level())) {1069return _is_c1_compilable;1070}1071return _is_c2_compilable;1072}10731074// ------------------------------------------------------------------1075// ciMethod::has_compiled_code1076bool ciMethod::has_compiled_code() {1077return instructions_size() > 0;1078}10791080int ciMethod::highest_osr_comp_level() {1081check_is_loaded();1082VM_ENTRY_MARK;1083return get_Method()->highest_osr_comp_level();1084}10851086// ------------------------------------------------------------------1087// ciMethod::code_size_for_inlining1088//1089// Code size for inlining decisions. This method returns a code1090// size of 1 for methods which has the ForceInline annotation.1091int ciMethod::code_size_for_inlining() {1092check_is_loaded();1093if (get_Method()->force_inline()) {1094return 1;1095}1096return code_size();1097}10981099// ------------------------------------------------------------------1100// ciMethod::instructions_size1101//1102// This is a rough metric for "fat" methods, compared before inlining1103// with InlineSmallCode. The CodeBlob::code_size accessor includes1104// junk like exception handler, stubs, and constant table, which are1105// not highly relevant to an inlined method. So we use the more1106// specific accessor nmethod::insts_size.1107int ciMethod::instructions_size() {1108if (_instructions_size == -1) {1109GUARDED_VM_ENTRY(1110CompiledMethod* code = get_Method()->code();1111if (code != NULL && (code->comp_level() == CompLevel_full_optimization)) {1112_instructions_size = code->insts_end() - code->verified_entry_point();1113} else {1114_instructions_size = 0;1115}1116);1117}1118return _instructions_size;1119}11201121// ------------------------------------------------------------------1122// ciMethod::log_nmethod_identity1123void ciMethod::log_nmethod_identity(xmlStream* log) {1124GUARDED_VM_ENTRY(1125CompiledMethod* code = get_Method()->code();1126if (code != NULL) {1127code->log_identity(log);1128}1129)1130}11311132// ------------------------------------------------------------------1133// ciMethod::is_not_reached1134bool ciMethod::is_not_reached(int bci) {1135check_is_loaded();1136VM_ENTRY_MARK;1137return Interpreter::is_not_reached(1138methodHandle(THREAD, get_Method()), bci);1139}11401141// ------------------------------------------------------------------1142// ciMethod::was_never_executed1143bool ciMethod::was_executed_more_than(int times) {1144VM_ENTRY_MARK;1145return get_Method()->was_executed_more_than(times);1146}11471148// ------------------------------------------------------------------1149// ciMethod::has_unloaded_classes_in_signature1150bool ciMethod::has_unloaded_classes_in_signature() {1151VM_ENTRY_MARK;1152{1153ExceptionMark em(THREAD);1154methodHandle m(THREAD, get_Method());1155bool has_unloaded = Method::has_unloaded_classes_in_signature(m, thread);1156if( HAS_PENDING_EXCEPTION ) {1157CLEAR_PENDING_EXCEPTION;1158return true; // Declare that we may have unloaded classes1159}1160return has_unloaded;1161}1162}11631164// ------------------------------------------------------------------1165// ciMethod::is_klass_loaded1166bool ciMethod::is_klass_loaded(int refinfo_index, bool must_be_resolved) const {1167VM_ENTRY_MARK;1168return get_Method()->is_klass_loaded(refinfo_index, must_be_resolved);1169}11701171// ------------------------------------------------------------------1172// ciMethod::check_call1173bool ciMethod::check_call(int refinfo_index, bool is_static) const {1174// This method is used only in C2 from InlineTree::ok_to_inline,1175// and is only used under -Xcomp.1176// It appears to fail when applied to an invokeinterface call site.1177// FIXME: Remove this method and resolve_method_statically; refactor to use the other LinkResolver entry points.1178VM_ENTRY_MARK;1179{1180ExceptionMark em(THREAD);1181HandleMark hm(THREAD);1182constantPoolHandle pool (THREAD, get_Method()->constants());1183Bytecodes::Code code = (is_static ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual);1184Method* spec_method = LinkResolver::resolve_method_statically(code, pool, refinfo_index, THREAD);1185if (HAS_PENDING_EXCEPTION) {1186CLEAR_PENDING_EXCEPTION;1187return false;1188} else {1189return (spec_method->is_static() == is_static);1190}1191}1192return false;1193}11941195// ------------------------------------------------------------------1196// ciMethod::profile_aging1197//1198// Should the method be compiled with an age counter?1199bool ciMethod::profile_aging() const {1200return UseCodeAging && (!MethodCounters::is_nmethod_hot(nmethod_age()) &&1201!MethodCounters::is_nmethod_age_unset(nmethod_age()));1202}1203// ------------------------------------------------------------------1204// ciMethod::print_codes1205//1206// Print the bytecodes for this method.1207void ciMethod::print_codes_on(outputStream* st) {1208check_is_loaded();1209GUARDED_VM_ENTRY(get_Method()->print_codes_on(st);)1210}121112121213#define FETCH_FLAG_FROM_VM(flag_accessor) { \1214check_is_loaded(); \1215VM_ENTRY_MARK; \1216return get_Method()->flag_accessor(); \1217}12181219bool ciMethod::has_loops () const { FETCH_FLAG_FROM_VM(has_loops); }1220bool ciMethod::has_jsrs () const { FETCH_FLAG_FROM_VM(has_jsrs); }1221bool ciMethod::is_getter () const { FETCH_FLAG_FROM_VM(is_getter); }1222bool ciMethod::is_setter () const { FETCH_FLAG_FROM_VM(is_setter); }1223bool ciMethod::is_accessor () const { FETCH_FLAG_FROM_VM(is_accessor); }1224bool ciMethod::is_initializer () const { FETCH_FLAG_FROM_VM(is_initializer); }1225bool ciMethod::is_empty () const { FETCH_FLAG_FROM_VM(is_empty_method); }12261227bool ciMethod::is_boxing_method() const {1228if (intrinsic_id() != vmIntrinsics::_none && holder()->is_box_klass()) {1229switch (intrinsic_id()) {1230case vmIntrinsics::_Boolean_valueOf:1231case vmIntrinsics::_Byte_valueOf:1232case vmIntrinsics::_Character_valueOf:1233case vmIntrinsics::_Short_valueOf:1234case vmIntrinsics::_Integer_valueOf:1235case vmIntrinsics::_Long_valueOf:1236case vmIntrinsics::_Float_valueOf:1237case vmIntrinsics::_Double_valueOf:1238return true;1239default:1240return false;1241}1242}1243return false;1244}12451246bool ciMethod::is_unboxing_method() const {1247if (intrinsic_id() != vmIntrinsics::_none && holder()->is_box_klass()) {1248switch (intrinsic_id()) {1249case vmIntrinsics::_booleanValue:1250case vmIntrinsics::_byteValue:1251case vmIntrinsics::_charValue:1252case vmIntrinsics::_shortValue:1253case vmIntrinsics::_intValue:1254case vmIntrinsics::_longValue:1255case vmIntrinsics::_floatValue:1256case vmIntrinsics::_doubleValue:1257return true;1258default:1259return false;1260}1261}1262return false;1263}12641265bool ciMethod::is_vector_method() const {1266return (holder() == ciEnv::current()->vector_VectorSupport_klass()) &&1267(intrinsic_id() != vmIntrinsics::_none);1268}12691270BCEscapeAnalyzer *ciMethod::get_bcea() {1271#ifdef COMPILER21272if (_bcea == NULL) {1273_bcea = new (CURRENT_ENV->arena()) BCEscapeAnalyzer(this, NULL);1274}1275return _bcea;1276#else // COMPILER21277ShouldNotReachHere();1278return NULL;1279#endif // COMPILER21280}12811282ciMethodBlocks *ciMethod::get_method_blocks() {1283if (_method_blocks == NULL) {1284Arena *arena = CURRENT_ENV->arena();1285_method_blocks = new (arena) ciMethodBlocks(arena, this);1286}1287return _method_blocks;1288}12891290#undef FETCH_FLAG_FROM_VM12911292void ciMethod::dump_name_as_ascii(outputStream* st) {1293Method* method = get_Method();1294st->print("%s %s %s",1295method->klass_name()->as_quoted_ascii(),1296method->name()->as_quoted_ascii(),1297method->signature()->as_quoted_ascii());1298}12991300void ciMethod::dump_replay_data(outputStream* st) {1301ResourceMark rm;1302Method* method = get_Method();1303MethodCounters* mcs = method->method_counters();1304st->print("ciMethod ");1305dump_name_as_ascii(st);1306st->print_cr(" %d %d %d %d %d",1307mcs == NULL ? 0 : mcs->invocation_counter()->raw_counter(),1308mcs == NULL ? 0 : mcs->backedge_counter()->raw_counter(),1309interpreter_invocation_count(),1310interpreter_throwout_count(),1311_instructions_size);1312}13131314// ------------------------------------------------------------------1315// ciMethod::print_codes1316//1317// Print a range of the bytecodes for this method.1318void ciMethod::print_codes_on(int from, int to, outputStream* st) {1319check_is_loaded();1320GUARDED_VM_ENTRY(get_Method()->print_codes_on(from, to, st);)1321}13221323// ------------------------------------------------------------------1324// ciMethod::print_name1325//1326// Print the name of this method, including signature and some flags.1327void ciMethod::print_name(outputStream* st) {1328check_is_loaded();1329GUARDED_VM_ENTRY(get_Method()->print_name(st);)1330}13311332// ------------------------------------------------------------------1333// ciMethod::print_short_name1334//1335// Print the name of this method, without signature.1336void ciMethod::print_short_name(outputStream* st) {1337if (is_loaded()) {1338GUARDED_VM_ENTRY(get_Method()->print_short_name(st););1339} else {1340// Fall back if method is not loaded.1341holder()->print_name_on(st);1342st->print("::");1343name()->print_symbol_on(st);1344if (WizardMode)1345signature()->as_symbol()->print_symbol_on(st);1346}1347}13481349// ------------------------------------------------------------------1350// ciMethod::print_impl1351//1352// Implementation of the print method.1353void ciMethod::print_impl(outputStream* st) {1354ciMetadata::print_impl(st);1355st->print(" name=");1356name()->print_symbol_on(st);1357st->print(" holder=");1358holder()->print_name_on(st);1359st->print(" signature=");1360signature()->as_symbol()->print_symbol_on(st);1361if (is_loaded()) {1362st->print(" loaded=true");1363st->print(" arg_size=%d", arg_size());1364st->print(" flags=");1365flags().print_member_flags(st);1366} else {1367st->print(" loaded=false");1368}1369}13701371// ------------------------------------------------------------------13721373static BasicType erase_to_word_type(BasicType bt) {1374if (is_subword_type(bt)) return T_INT;1375if (is_reference_type(bt)) return T_OBJECT;1376return bt;1377}13781379static bool basic_types_match(ciType* t1, ciType* t2) {1380if (t1 == t2) return true;1381return erase_to_word_type(t1->basic_type()) == erase_to_word_type(t2->basic_type());1382}13831384bool ciMethod::is_consistent_info(ciMethod* declared_method, ciMethod* resolved_method) {1385bool invoke_through_mh_intrinsic = declared_method->is_method_handle_intrinsic() &&1386!resolved_method->is_method_handle_intrinsic();13871388if (!invoke_through_mh_intrinsic) {1389// Method name & descriptor should stay the same.1390// Signatures may reference unloaded types and thus they may be not strictly equal.1391ciSymbol* declared_signature = declared_method->signature()->as_symbol();1392ciSymbol* resolved_signature = resolved_method->signature()->as_symbol();13931394return (declared_method->name()->equals(resolved_method->name())) &&1395(declared_signature->equals(resolved_signature));1396}13971398ciMethod* linker = declared_method;1399ciMethod* target = resolved_method;1400// Linkers have appendix argument which is not passed to callee.1401int has_appendix = MethodHandles::has_member_arg(linker->intrinsic_id()) ? 1 : 0;1402if (linker->arg_size() != (target->arg_size() + has_appendix)) {1403return false; // argument slot count mismatch1404}14051406ciSignature* linker_sig = linker->signature();1407ciSignature* target_sig = target->signature();14081409if (linker_sig->count() + (linker->is_static() ? 0 : 1) !=1410target_sig->count() + (target->is_static() ? 0 : 1) + has_appendix) {1411return false; // argument count mismatch1412}14131414int sbase = 0, rbase = 0;1415switch (linker->intrinsic_id()) {1416case vmIntrinsics::_linkToVirtual:1417case vmIntrinsics::_linkToInterface:1418case vmIntrinsics::_linkToSpecial: {1419if (target->is_static()) {1420return false;1421}1422if (linker_sig->type_at(0)->is_primitive_type()) {1423return false; // receiver should be an oop1424}1425sbase = 1; // skip receiver1426break;1427}1428case vmIntrinsics::_linkToStatic: {1429if (!target->is_static()) {1430return false;1431}1432break;1433}1434case vmIntrinsics::_invokeBasic: {1435if (target->is_static()) {1436if (target_sig->type_at(0)->is_primitive_type()) {1437return false; // receiver should be an oop1438}1439rbase = 1; // skip receiver1440}1441break;1442}1443default:1444break;1445}1446assert(target_sig->count() - rbase == linker_sig->count() - sbase - has_appendix, "argument count mismatch");1447int arg_count = target_sig->count() - rbase;1448for (int i = 0; i < arg_count; i++) {1449if (!basic_types_match(linker_sig->type_at(sbase + i), target_sig->type_at(rbase + i))) {1450return false;1451}1452}1453// Only check the return type if the symbolic info has non-void return type.1454// I.e. the return value of the resolved method can be dropped.1455if (!linker->return_type()->is_void() &&1456!basic_types_match(linker->return_type(), target->return_type())) {1457return false;1458}1459return true; // no mismatch found1460}14611462// ------------------------------------------------------------------146314641465