< prev index next >

src/hotspot/share/ci/ciMethod.cpp

Print this page




  55 #include "oops/method.hpp"
  56 #endif
  57 
  58 // ciMethod
  59 //
  60 // This class represents a Method* in the HotSpot virtual
  61 // machine.
  62 
  63 
  64 // ------------------------------------------------------------------
  65 // ciMethod::ciMethod
  66 //
  67 // Loaded method.
  68 ciMethod::ciMethod(const methodHandle& h_m, ciInstanceKlass* holder) :
  69   ciMetadata(h_m()),
  70   _holder(holder)
  71 {
  72   assert(h_m() != NULL, "no null method");
  73 
  74   if (LogTouchedMethods) {
  75     h_m()->log_touched(Thread::current());
  76   }
  77   // These fields are always filled in in loaded methods.
  78   _flags = ciFlags(h_m()->access_flags());
  79 
  80   // Easy to compute, so fill them in now.
  81   _max_stack          = h_m()->max_stack();
  82   _max_locals         = h_m()->max_locals();
  83   _code_size          = h_m()->code_size();
  84   _intrinsic_id       = h_m()->intrinsic_id();
  85   _handler_count      = h_m()->exception_table_length();
  86   _size_of_parameters = h_m()->size_of_parameters();
  87   _uses_monitors      = h_m()->access_flags().has_monitor_bytecodes();
  88   _balanced_monitors  = !_uses_monitors || h_m()->access_flags().is_monitor_matching();
  89   _is_c1_compilable   = !h_m()->is_not_c1_compilable();
  90   _is_c2_compilable   = !h_m()->is_not_c2_compilable();
  91   _can_be_parsed      = true;
  92   _has_reserved_stack_access = h_m()->has_reserved_stack_access();
  93   _is_overpass        = h_m()->is_overpass();
  94   // Lazy fields, filled in on demand.  Require allocation.
  95   _code               = NULL;
  96   _exception_handlers = NULL;
  97   _liveness           = NULL;
  98   _method_blocks = NULL;
  99 #if defined(COMPILER2)
 100   _flow               = NULL;
 101   _bcea               = NULL;
 102 #endif // COMPILER2
 103 
 104   ciEnv *env = CURRENT_ENV;
 105   if (env->jvmti_can_hotswap_or_post_breakpoint()) {
 106     // 6328518 check hotswap conditions under the right lock.
 107     MutexLocker locker(Compile_lock);
 108     if (Dependencies::check_evol_method(h_m()) != NULL) {
 109       _is_c1_compilable = false;
 110       _is_c2_compilable = false;
 111       _can_be_parsed = false;
 112     }
 113   } else {
 114     DEBUG_ONLY(CompilerThread::current()->check_possible_safepoint());
 115   }
 116 
 117   if (h_m()->method_holder()->is_linked()) {
 118     _can_be_statically_bound = h_m()->can_be_statically_bound();
 119   } else {
 120     // Have to use a conservative value in this case.
 121     _can_be_statically_bound = false;
 122   }
 123 
 124   // Adjust the definition of this condition to be more useful:
 125   // %%% take these conditions into account in vtable generation
 126   if (!_can_be_statically_bound && h_m()->is_private())
 127     _can_be_statically_bound = true;
 128   if (_can_be_statically_bound && h_m()->is_abstract())
 129     _can_be_statically_bound = false;
 130 
 131   // generating _signature may allow GC and therefore move m.
 132   // These fields are always filled in.
 133   _name = env->get_symbol(h_m()->name());
 134   ciSymbol* sig_symbol = env->get_symbol(h_m()->signature());
 135   constantPoolHandle cpool = h_m()->constants();
 136   _signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol);
 137   _method_data = NULL;
 138   _nmethod_age = h_m()->nmethod_age();
 139   // Take a snapshot of these values, so they will be commensurate with the MDO.
 140   if (ProfileInterpreter || TieredCompilation) {
 141     int invcnt = h_m()->interpreter_invocation_count();
 142     // if the value overflowed report it as max int
 143     _interpreter_invocation_count = invcnt < 0 ? max_jint : invcnt ;
 144     _interpreter_throwout_count   = h_m()->interpreter_throwout_count();
 145   } else {
 146     _interpreter_invocation_count = 0;
 147     _interpreter_throwout_count = 0;
 148   }
 149   if (_interpreter_invocation_count == 0)
 150     _interpreter_invocation_count = 1;
 151   _instructions_size = -1;
 152 #ifdef ASSERT
 153   if (ReplayCompiles) {
 154     ciReplay::initialize(this);
 155   }
 156 #endif
 157 }
 158 
 159 
 160 // ------------------------------------------------------------------
 161 // ciMethod::ciMethod
 162 //
 163 // Unloaded method.
 164 ciMethod::ciMethod(ciInstanceKlass* holder,


 414   return raw_liveness_at_bci(bci);
 415 }
 416 
 417 // ciMethod::live_local_oops_at_bci
 418 //
 419 // find all the live oops in the locals array for a particular bci
 420 // Compute what the interpreter believes by using the interpreter
 421 // oopmap generator. This is used as a double check during osr to
 422 // guard against conservative result from MethodLiveness making us
 423 // think a dead oop is live.  MethodLiveness is conservative in the
 424 // sense that it may consider locals to be live which cannot be live,
 425 // like in the case where a local could contain an oop or  a primitive
 426 // along different paths.  In that case the local must be dead when
 427 // those paths merge. Since the interpreter's viewpoint is used when
 428 // gc'ing an interpreter frame we need to use its viewpoint  during
 429 // OSR when loading the locals.
 430 
 431 ResourceBitMap ciMethod::live_local_oops_at_bci(int bci) {
 432   VM_ENTRY_MARK;
 433   InterpreterOopMap mask;
 434   OopMapCache::compute_one_oop_map(get_Method(), bci, &mask);
 435   int mask_size = max_locals();
 436   ResourceBitMap result(mask_size);
 437   int i;
 438   for (i = 0; i < mask_size ; i++ ) {
 439     if (mask.is_oop(i)) result.set_bit(i);
 440   }
 441   return result;
 442 }
 443 
 444 
 445 #ifdef COMPILER1
 446 // ------------------------------------------------------------------
 447 // ciMethod::bci_block_start
 448 //
 449 // Marks all bcis where a new basic block starts
 450 const BitMap& ciMethod::bci_block_start() {
 451   check_is_loaded();
 452   if (_liveness == NULL) {
 453     // Create the liveness analyzer.
 454     Arena* arena = CURRENT_ENV->arena();


 732 
 733   // Array methods (clone, hashCode, etc.) are always statically bound.
 734   // If we were to see an array type here, we'd return root_m.
 735   // However, this method processes only ciInstanceKlasses.  (See 4962591.)
 736   // The inline_native_clone intrinsic narrows Object to T[] properly,
 737   // so there is no need to do the same job here.
 738 
 739   if (!UseCHA)  return NULL;
 740 
 741   VM_ENTRY_MARK;
 742 
 743   // Disable CHA for default methods for now
 744   if (root_m->is_default_method()) {
 745     return NULL;
 746   }
 747 
 748   methodHandle target;
 749   {
 750     MutexLocker locker(Compile_lock);
 751     Klass* context = actual_recv->get_Klass();
 752     target = Dependencies::find_unique_concrete_method(context,
 753                                                        root_m->get_Method());
 754     // %%% Should upgrade this ciMethod API to look for 1 or 2 concrete methods.
 755   }
 756 
 757 #ifndef PRODUCT
 758   if (TraceDependencies && target() != NULL && target() != root_m->get_Method()) {
 759     tty->print("found a non-root unique target method");
 760     tty->print_cr("  context = %s", actual_recv->get_Klass()->external_name());
 761     tty->print("  method  = ");
 762     target->print_short_name(tty);
 763     tty->cr();
 764   }
 765 #endif //PRODUCT
 766 
 767   if (target() == NULL) {
 768     return NULL;
 769   }
 770   if (target() == root_m->get_Method()) {
 771     return root_m;
 772   }
 773   if (!root_m->is_public() &&


 793   return (holder() == context) && can_be_statically_bound();
 794 }
 795 
 796 // ------------------------------------------------------------------
 797 // ciMethod::resolve_invoke
 798 //
 799 // Given a known receiver klass, find the target for the call.
 800 // Return NULL if the call has no target or the target is abstract.
 801 ciMethod* ciMethod::resolve_invoke(ciKlass* caller, ciKlass* exact_receiver, bool check_access) {
 802    check_is_loaded();
 803    VM_ENTRY_MARK;
 804 
 805    Klass* caller_klass = caller->get_Klass();
 806    Klass* recv         = exact_receiver->get_Klass();
 807    Klass* resolved     = holder()->get_Klass();
 808    Symbol* h_name      = name()->get_symbol();
 809    Symbol* h_signature = signature()->get_symbol();
 810 
 811    LinkInfo link_info(resolved, h_name, h_signature, caller_klass,
 812                       check_access ? LinkInfo::needs_access_check : LinkInfo::skip_access_check);
 813    methodHandle m;
 814    // Only do exact lookup if receiver klass has been linked.  Otherwise,
 815    // the vtable has not been setup, and the LinkResolver will fail.
 816    if (recv->is_array_klass()
 817         ||
 818        (InstanceKlass::cast(recv)->is_linked() && !exact_receiver->is_interface())) {
 819      if (holder()->is_interface()) {
 820        m = LinkResolver::resolve_interface_call_or_null(recv, link_info);
 821      } else {
 822        m = LinkResolver::resolve_virtual_call_or_null(recv, link_info);
 823      }
 824    }
 825 
 826    if (m.is_null()) {
 827      // Return NULL only if there was a problem with lookup (uninitialized class, etc.)
 828      return NULL;
 829    }
 830 
 831    ciMethod* result = this;
 832    if (m() != get_Method()) {
 833      result = CURRENT_THREAD_ENV->get_method(m());
 834    }
 835 
 836    // Don't return abstract methods because they aren't
 837    // optimizable or interesting.
 838    if (result->is_abstract()) {
 839      return NULL;
 840    } else {
 841      return result;
 842    }
 843 }
 844 
 845 // ------------------------------------------------------------------
 846 // ciMethod::resolve_vtable_index
 847 //
 848 // Given a known receiver klass, find the vtable index for the call.
 849 // Return Method::invalid_vtable_index if the vtable_index is unknown.
 850 int ciMethod::resolve_vtable_index(ciKlass* caller, ciKlass* receiver) {
 851    check_is_loaded();
 852 
 853    int vtable_index = Method::invalid_vtable_index;


1018     Method::build_interpreter_method_data(h_m, THREAD);
1019     if (HAS_PENDING_EXCEPTION) {
1020       CLEAR_PENDING_EXCEPTION;
1021     }
1022   }
1023   if (h_m()->method_data() != NULL) {
1024     _method_data = CURRENT_ENV->get_method_data(h_m()->method_data());
1025     _method_data->load_data();
1026     return true;
1027   } else {
1028     _method_data = CURRENT_ENV->get_empty_methodData();
1029     return false;
1030   }
1031 }
1032 
1033 // public, retroactive version
1034 bool ciMethod::ensure_method_data() {
1035   bool result = true;
1036   if (_method_data == NULL || _method_data->is_empty()) {
1037     GUARDED_VM_ENTRY({
1038       result = ensure_method_data(get_Method());

1039     });
1040   }
1041   return result;
1042 }
1043 
1044 
1045 // ------------------------------------------------------------------
1046 // ciMethod::method_data
1047 //
1048 ciMethodData* ciMethod::method_data() {
1049   if (_method_data != NULL) {
1050     return _method_data;
1051   }
1052   VM_ENTRY_MARK;
1053   ciEnv* env = CURRENT_ENV;
1054   Thread* my_thread = JavaThread::current();
1055   methodHandle h_m(my_thread, get_Method());
1056 
1057   if (h_m()->method_data() != NULL) {
1058     _method_data = CURRENT_ENV->get_method_data(h_m()->method_data());


1251 // ------------------------------------------------------------------
1252 // ciMethod::is_klass_loaded
1253 bool ciMethod::is_klass_loaded(int refinfo_index, bool must_be_resolved) const {
1254   VM_ENTRY_MARK;
1255   return get_Method()->is_klass_loaded(refinfo_index, must_be_resolved);
1256 }
1257 
1258 // ------------------------------------------------------------------
1259 // ciMethod::check_call
1260 bool ciMethod::check_call(int refinfo_index, bool is_static) const {
1261   // This method is used only in C2 from InlineTree::ok_to_inline,
1262   // and is only used under -Xcomp.
1263   // It appears to fail when applied to an invokeinterface call site.
1264   // FIXME: Remove this method and resolve_method_statically; refactor to use the other LinkResolver entry points.
1265   VM_ENTRY_MARK;
1266   {
1267     EXCEPTION_MARK;
1268     HandleMark hm(THREAD);
1269     constantPoolHandle pool (THREAD, get_Method()->constants());
1270     Bytecodes::Code code = (is_static ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual);
1271     methodHandle spec_method = LinkResolver::resolve_method_statically(code, pool, refinfo_index, THREAD);
1272     if (HAS_PENDING_EXCEPTION) {
1273       CLEAR_PENDING_EXCEPTION;
1274       return false;
1275     } else {
1276       return (spec_method->is_static() == is_static);
1277     }
1278   }
1279   return false;
1280 }
1281 
1282 // ------------------------------------------------------------------
1283 // ciMethod::profile_aging
1284 //
1285 // Should the method be compiled with an age counter?
1286 bool ciMethod::profile_aging() const {
1287   return UseCodeAging && (!MethodCounters::is_nmethod_hot(nmethod_age()) &&
1288                           !MethodCounters::is_nmethod_age_unset(nmethod_age()));
1289 }
1290 // ------------------------------------------------------------------
1291 // ciMethod::print_codes




  55 #include "oops/method.hpp"
  56 #endif
  57 
  58 // ciMethod
  59 //
  60 // This class represents a Method* in the HotSpot virtual
  61 // machine.
  62 
  63 
  64 // ------------------------------------------------------------------
  65 // ciMethod::ciMethod
  66 //
  67 // Loaded method.
  68 ciMethod::ciMethod(const methodHandle& h_m, ciInstanceKlass* holder) :
  69   ciMetadata(h_m()),
  70   _holder(holder)
  71 {
  72   assert(h_m() != NULL, "no null method");
  73 
  74   if (LogTouchedMethods) {
  75     h_m->log_touched(Thread::current());
  76   }
  77   // These fields are always filled in in loaded methods.
  78   _flags = ciFlags(h_m->access_flags());
  79 
  80   // Easy to compute, so fill them in now.
  81   _max_stack          = h_m->max_stack();
  82   _max_locals         = h_m->max_locals();
  83   _code_size          = h_m->code_size();
  84   _intrinsic_id       = h_m->intrinsic_id();
  85   _handler_count      = h_m->exception_table_length();
  86   _size_of_parameters = h_m->size_of_parameters();
  87   _uses_monitors      = h_m->access_flags().has_monitor_bytecodes();
  88   _balanced_monitors  = !_uses_monitors || h_m->access_flags().is_monitor_matching();
  89   _is_c1_compilable   = !h_m->is_not_c1_compilable();
  90   _is_c2_compilable   = !h_m->is_not_c2_compilable();
  91   _can_be_parsed      = true;
  92   _has_reserved_stack_access = h_m->has_reserved_stack_access();
  93   _is_overpass        = h_m->is_overpass();
  94   // Lazy fields, filled in on demand.  Require allocation.
  95   _code               = NULL;
  96   _exception_handlers = NULL;
  97   _liveness           = NULL;
  98   _method_blocks = NULL;
  99 #if defined(COMPILER2)
 100   _flow               = NULL;
 101   _bcea               = NULL;
 102 #endif // COMPILER2
 103 
 104   ciEnv *env = CURRENT_ENV;
 105   if (env->jvmti_can_hotswap_or_post_breakpoint()) {
 106     // 6328518 check hotswap conditions under the right lock.
 107     MutexLocker locker(Compile_lock);
 108     if (Dependencies::check_evol_method(h_m()) != NULL) {
 109       _is_c1_compilable = false;
 110       _is_c2_compilable = false;
 111       _can_be_parsed = false;
 112     }
 113   } else {
 114     DEBUG_ONLY(CompilerThread::current()->check_possible_safepoint());
 115   }
 116 
 117   if (h_m->method_holder()->is_linked()) {
 118     _can_be_statically_bound = h_m->can_be_statically_bound();
 119   } else {
 120     // Have to use a conservative value in this case.
 121     _can_be_statically_bound = false;
 122   }
 123 
 124   // Adjust the definition of this condition to be more useful:
 125   // %%% take these conditions into account in vtable generation
 126   if (!_can_be_statically_bound && h_m->is_private())
 127     _can_be_statically_bound = true;
 128   if (_can_be_statically_bound && h_m->is_abstract())
 129     _can_be_statically_bound = false;
 130 
 131   // generating _signature may allow GC and therefore move m.
 132   // These fields are always filled in.
 133   _name = env->get_symbol(h_m->name());
 134   ciSymbol* sig_symbol = env->get_symbol(h_m->signature());
 135   constantPoolHandle cpool(Thread::current(), h_m->constants());
 136   _signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol);
 137   _method_data = NULL;
 138   _nmethod_age = h_m->nmethod_age();
 139   // Take a snapshot of these values, so they will be commensurate with the MDO.
 140   if (ProfileInterpreter || TieredCompilation) {
 141     int invcnt = h_m->interpreter_invocation_count();
 142     // if the value overflowed report it as max int
 143     _interpreter_invocation_count = invcnt < 0 ? max_jint : invcnt ;
 144     _interpreter_throwout_count   = h_m->interpreter_throwout_count();
 145   } else {
 146     _interpreter_invocation_count = 0;
 147     _interpreter_throwout_count = 0;
 148   }
 149   if (_interpreter_invocation_count == 0)
 150     _interpreter_invocation_count = 1;
 151   _instructions_size = -1;
 152 #ifdef ASSERT
 153   if (ReplayCompiles) {
 154     ciReplay::initialize(this);
 155   }
 156 #endif
 157 }
 158 
 159 
 160 // ------------------------------------------------------------------
 161 // ciMethod::ciMethod
 162 //
 163 // Unloaded method.
 164 ciMethod::ciMethod(ciInstanceKlass* holder,


 414   return raw_liveness_at_bci(bci);
 415 }
 416 
 417 // ciMethod::live_local_oops_at_bci
 418 //
 419 // find all the live oops in the locals array for a particular bci
 420 // Compute what the interpreter believes by using the interpreter
 421 // oopmap generator. This is used as a double check during osr to
 422 // guard against conservative result from MethodLiveness making us
 423 // think a dead oop is live.  MethodLiveness is conservative in the
 424 // sense that it may consider locals to be live which cannot be live,
 425 // like in the case where a local could contain an oop or  a primitive
 426 // along different paths.  In that case the local must be dead when
 427 // those paths merge. Since the interpreter's viewpoint is used when
 428 // gc'ing an interpreter frame we need to use its viewpoint  during
 429 // OSR when loading the locals.
 430 
 431 ResourceBitMap ciMethod::live_local_oops_at_bci(int bci) {
 432   VM_ENTRY_MARK;
 433   InterpreterOopMap mask;
 434   OopMapCache::compute_one_oop_map(methodHandle(THREAD, get_Method()), bci, &mask);
 435   int mask_size = max_locals();
 436   ResourceBitMap result(mask_size);
 437   int i;
 438   for (i = 0; i < mask_size ; i++ ) {
 439     if (mask.is_oop(i)) result.set_bit(i);
 440   }
 441   return result;
 442 }
 443 
 444 
 445 #ifdef COMPILER1
 446 // ------------------------------------------------------------------
 447 // ciMethod::bci_block_start
 448 //
 449 // Marks all bcis where a new basic block starts
 450 const BitMap& ciMethod::bci_block_start() {
 451   check_is_loaded();
 452   if (_liveness == NULL) {
 453     // Create the liveness analyzer.
 454     Arena* arena = CURRENT_ENV->arena();


 732 
 733   // Array methods (clone, hashCode, etc.) are always statically bound.
 734   // If we were to see an array type here, we'd return root_m.
 735   // However, this method processes only ciInstanceKlasses.  (See 4962591.)
 736   // The inline_native_clone intrinsic narrows Object to T[] properly,
 737   // so there is no need to do the same job here.
 738 
 739   if (!UseCHA)  return NULL;
 740 
 741   VM_ENTRY_MARK;
 742 
 743   // Disable CHA for default methods for now
 744   if (root_m->is_default_method()) {
 745     return NULL;
 746   }
 747 
 748   methodHandle target;
 749   {
 750     MutexLocker locker(Compile_lock);
 751     Klass* context = actual_recv->get_Klass();
 752     target = methodHandle(THREAD, Dependencies::find_unique_concrete_method(context,
 753                                                        root_m->get_Method()));
 754     // %%% Should upgrade this ciMethod API to look for 1 or 2 concrete methods.
 755   }
 756 
 757 #ifndef PRODUCT
 758   if (TraceDependencies && target() != NULL && target() != root_m->get_Method()) {
 759     tty->print("found a non-root unique target method");
 760     tty->print_cr("  context = %s", actual_recv->get_Klass()->external_name());
 761     tty->print("  method  = ");
 762     target->print_short_name(tty);
 763     tty->cr();
 764   }
 765 #endif //PRODUCT
 766 
 767   if (target() == NULL) {
 768     return NULL;
 769   }
 770   if (target() == root_m->get_Method()) {
 771     return root_m;
 772   }
 773   if (!root_m->is_public() &&


 793   return (holder() == context) && can_be_statically_bound();
 794 }
 795 
 796 // ------------------------------------------------------------------
 797 // ciMethod::resolve_invoke
 798 //
 799 // Given a known receiver klass, find the target for the call.
 800 // Return NULL if the call has no target or the target is abstract.
 801 ciMethod* ciMethod::resolve_invoke(ciKlass* caller, ciKlass* exact_receiver, bool check_access) {
 802    check_is_loaded();
 803    VM_ENTRY_MARK;
 804 
 805    Klass* caller_klass = caller->get_Klass();
 806    Klass* recv         = exact_receiver->get_Klass();
 807    Klass* resolved     = holder()->get_Klass();
 808    Symbol* h_name      = name()->get_symbol();
 809    Symbol* h_signature = signature()->get_symbol();
 810 
 811    LinkInfo link_info(resolved, h_name, h_signature, caller_klass,
 812                       check_access ? LinkInfo::needs_access_check : LinkInfo::skip_access_check);
 813    Method* m = NULL;
 814    // Only do exact lookup if receiver klass has been linked.  Otherwise,
 815    // the vtable has not been setup, and the LinkResolver will fail.
 816    if (recv->is_array_klass()
 817         ||
 818        (InstanceKlass::cast(recv)->is_linked() && !exact_receiver->is_interface())) {
 819      if (holder()->is_interface()) {
 820        m = LinkResolver::resolve_interface_call_or_null(recv, link_info);
 821      } else {
 822        m = LinkResolver::resolve_virtual_call_or_null(recv, link_info);
 823      }
 824    }
 825 
 826    if (m == NULL) {
 827      // Return NULL only if there was a problem with lookup (uninitialized class, etc.)
 828      return NULL;
 829    }
 830 
 831    ciMethod* result = this;
 832    if (m != get_Method()) {
 833      result = CURRENT_THREAD_ENV->get_method(m);
 834    }
 835 
 836    // Don't return abstract methods because they aren't
 837    // optimizable or interesting.
 838    if (result->is_abstract()) {
 839      return NULL;
 840    } else {
 841      return result;
 842    }
 843 }
 844 
 845 // ------------------------------------------------------------------
 846 // ciMethod::resolve_vtable_index
 847 //
 848 // Given a known receiver klass, find the vtable index for the call.
 849 // Return Method::invalid_vtable_index if the vtable_index is unknown.
 850 int ciMethod::resolve_vtable_index(ciKlass* caller, ciKlass* receiver) {
 851    check_is_loaded();
 852 
 853    int vtable_index = Method::invalid_vtable_index;


1018     Method::build_interpreter_method_data(h_m, THREAD);
1019     if (HAS_PENDING_EXCEPTION) {
1020       CLEAR_PENDING_EXCEPTION;
1021     }
1022   }
1023   if (h_m()->method_data() != NULL) {
1024     _method_data = CURRENT_ENV->get_method_data(h_m()->method_data());
1025     _method_data->load_data();
1026     return true;
1027   } else {
1028     _method_data = CURRENT_ENV->get_empty_methodData();
1029     return false;
1030   }
1031 }
1032 
1033 // public, retroactive version
1034 bool ciMethod::ensure_method_data() {
1035   bool result = true;
1036   if (_method_data == NULL || _method_data->is_empty()) {
1037     GUARDED_VM_ENTRY({
1038       methodHandle mh(Thread::current(), get_Method());
1039       result = ensure_method_data(mh);
1040     });
1041   }
1042   return result;
1043 }
1044 
1045 
1046 // ------------------------------------------------------------------
1047 // ciMethod::method_data
1048 //
1049 ciMethodData* ciMethod::method_data() {
1050   if (_method_data != NULL) {
1051     return _method_data;
1052   }
1053   VM_ENTRY_MARK;
1054   ciEnv* env = CURRENT_ENV;
1055   Thread* my_thread = JavaThread::current();
1056   methodHandle h_m(my_thread, get_Method());
1057 
1058   if (h_m()->method_data() != NULL) {
1059     _method_data = CURRENT_ENV->get_method_data(h_m()->method_data());


1252 // ------------------------------------------------------------------
1253 // ciMethod::is_klass_loaded
1254 bool ciMethod::is_klass_loaded(int refinfo_index, bool must_be_resolved) const {
1255   VM_ENTRY_MARK;
1256   return get_Method()->is_klass_loaded(refinfo_index, must_be_resolved);
1257 }
1258 
1259 // ------------------------------------------------------------------
1260 // ciMethod::check_call
1261 bool ciMethod::check_call(int refinfo_index, bool is_static) const {
1262   // This method is used only in C2 from InlineTree::ok_to_inline,
1263   // and is only used under -Xcomp.
1264   // It appears to fail when applied to an invokeinterface call site.
1265   // FIXME: Remove this method and resolve_method_statically; refactor to use the other LinkResolver entry points.
1266   VM_ENTRY_MARK;
1267   {
1268     EXCEPTION_MARK;
1269     HandleMark hm(THREAD);
1270     constantPoolHandle pool (THREAD, get_Method()->constants());
1271     Bytecodes::Code code = (is_static ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual);
1272     Method* spec_method = LinkResolver::resolve_method_statically(code, pool, refinfo_index, THREAD);
1273     if (HAS_PENDING_EXCEPTION) {
1274       CLEAR_PENDING_EXCEPTION;
1275       return false;
1276     } else {
1277       return (spec_method->is_static() == is_static);
1278     }
1279   }
1280   return false;
1281 }
1282 
1283 // ------------------------------------------------------------------
1284 // ciMethod::profile_aging
1285 //
1286 // Should the method be compiled with an age counter?
1287 bool ciMethod::profile_aging() const {
1288   return UseCodeAging && (!MethodCounters::is_nmethod_hot(nmethod_age()) &&
1289                           !MethodCounters::is_nmethod_age_unset(nmethod_age()));
1290 }
1291 // ------------------------------------------------------------------
1292 // ciMethod::print_codes


< prev index next >