src/hotspot/share/oops/method.cpp
changeset 59070 22ee476cc664
parent 59056 15936b142f86
child 59247 56bf71d64d51
equal deleted inserted replaced
59069:e0d59f0c2b7d 59070:22ee476cc664
   330   int extra_bytes = (is_native) ? 2*sizeof(address*) : 0;
   330   int extra_bytes = (is_native) ? 2*sizeof(address*) : 0;
   331   int extra_words = align_up(extra_bytes, BytesPerWord) / BytesPerWord;
   331   int extra_words = align_up(extra_bytes, BytesPerWord) / BytesPerWord;
   332   return align_metadata_size(header_size() + extra_words);
   332   return align_metadata_size(header_size() + extra_words);
   333 }
   333 }
   334 
   334 
   335 
       
   336 Symbol* Method::klass_name() const {
   335 Symbol* Method::klass_name() const {
   337   return method_holder()->name();
   336   return method_holder()->name();
   338 }
   337 }
   339 
       
   340 
   338 
   341 void Method::metaspace_pointers_do(MetaspaceClosure* it) {
   339 void Method::metaspace_pointers_do(MetaspaceClosure* it) {
   342   log_trace(cds)("Iter(Method): %p", this);
   340   log_trace(cds)("Iter(Method): %p", this);
   343 
   341 
   344   it->push(&_constMethod);
   342   it->push(&_constMethod);
   345   it->push(&_method_data);
   343   it->push(&_method_data);
   346   it->push(&_method_counters);
   344   it->push(&_method_counters);
       
   345 
       
   346   Method* this_ptr = this;
       
   347   it->push_method_entry(&this_ptr, (intptr_t*)&_i2i_entry);
       
   348   it->push_method_entry(&this_ptr, (intptr_t*)&_from_compiled_entry);
       
   349   it->push_method_entry(&this_ptr, (intptr_t*)&_from_interpreted_entry);
   347 }
   350 }
   348 
   351 
   349 // Attempt to return method oop to original state.  Clear any pointers
   352 // Attempt to return method oop to original state.  Clear any pointers
   350 // (to objects outside the shared spaces).  We won't be able to predict
   353 // (to objects outside the shared spaces).  We won't be able to predict
   351 // where they should point in a new JVM.  Further initialize some
   354 // where they should point in a new JVM.  Further initialize some
  1739   return a->name()->fast_compare(b->name());
  1742   return a->name()->fast_compare(b->name());
  1740 }
  1743 }
  1741 
  1744 
  1742 // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array
  1745 // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array
  1743 // default_methods also uses this without the ordering for fast find_method
  1746 // default_methods also uses this without the ordering for fast find_method
  1744 void Method::sort_methods(Array<Method*>* methods, bool set_idnums) {
  1747 void Method::sort_methods(Array<Method*>* methods, bool set_idnums, method_comparator_func func) {
  1745   int length = methods->length();
  1748   int length = methods->length();
  1746   if (length > 1) {
  1749   if (length > 1) {
       
  1750     if (func == NULL) {
       
  1751       func = method_comparator;
       
  1752     }
  1747     {
  1753     {
  1748       NoSafepointVerifier nsv;
  1754       NoSafepointVerifier nsv;
  1749       QuickSort::sort(methods->data(), length, method_comparator, /*idempotent=*/false);
  1755       QuickSort::sort(methods->data(), length, func, /*idempotent=*/false);
  1750     }
  1756     }
  1751     // Reset method ordering
  1757     // Reset method ordering
  1752     if (set_idnums) {
  1758     if (set_idnums) {
  1753       for (int i = 0; i < length; i++) {
  1759       for (int i = 0; i < length; i++) {
  1754         Method* m = methods->at(i);
  1760         Method* m = methods->at(i);