8062116: JVMTI GetClassMethods is Slow

Allocate enough space for all jmethodids; make adding a jmethodid O(1)

Reviewed-by: coleenp, rasbold, sspitsyn
This commit is contained in:
Jeremy Manson 2014-11-05 16:47:37 -08:00
parent 75778598e2
commit 54e9fee4d2
5 changed files with 166 additions and 44 deletions

View file

@ -729,6 +729,11 @@ class Method : public Metadata {
static jmethodID make_jmethod_id(ClassLoaderData* loader_data, Method* mh);
static void destroy_jmethod_id(ClassLoaderData* loader_data, jmethodID mid);
// Ensure there is enough capacity in the internal tracking data
// structures to hold the number of jmethodIDs you plan to generate.
// This saves substantial time doing allocations.
static void ensure_jmethod_ids(ClassLoaderData* loader_data, int capacity);
// Use resolve_jmethod_id() in situations where the caller is expected
// to provide a valid jmethodID; the only sanity checks are in asserts;
// result guaranteed not to be NULL.