hotspot/src/share/vm/oops/instanceKlass.cpp
changeset 27478 0eedae0228ac
parent 27471 6e56277909f1
child 27674 00cabfc45357
child 27685 26a697375de3
equal deleted inserted replaced
27474:2b061fd571eb 27478:0eedae0228ac
  1728     }
  1728     }
  1729   }
  1729   }
  1730   return id;
  1730   return id;
  1731 }
  1731 }
  1732 
  1732 
       
  1733 // Figure out how many jmethodIDs haven't been allocated, and make
       
  1734 // sure space for them is pre-allocated.  This makes getting all
       
  1735 // method ids much, much faster with classes with more than 8
       
  1736 // methods, and has a *substantial* effect on performance with jvmti
       
  1737 // code that loads all jmethodIDs for all classes.
       
  1738 void InstanceKlass::ensure_space_for_methodids(int start_offset) {
       
  1739   int new_jmeths = 0;
       
  1740   int length = methods()->length();
       
  1741   for (int index = start_offset; index < length; index++) {
       
  1742     Method* m = methods()->at(index);
       
  1743     jmethodID id = m->find_jmethod_id_or_null();
       
  1744     if (id == NULL) {
       
  1745       new_jmeths++;
       
  1746     }
       
  1747   }
       
  1748   if (new_jmeths != 0) {
       
  1749     Method::ensure_jmethod_ids(class_loader_data(), new_jmeths);
       
  1750   }
       
  1751 }
  1733 
  1752 
  1734 // Common code to fetch the jmethodID from the cache or update the
  1753 // Common code to fetch the jmethodID from the cache or update the
  1735 // cache with the new jmethodID. This function should never do anything
  1754 // cache with the new jmethodID. This function should never do anything
  1736 // that causes the caller to go to a safepoint or we can deadlock with
  1755 // that causes the caller to go to a safepoint or we can deadlock with
  1737 // the VMThread or have cache consistency issues.
  1756 // the VMThread or have cache consistency issues.