< prev index next >

src/share/vm/memory/metadataFactory.hpp

Print this page
rev 6864 : 8061651: Interface to the Lookup Index Cache to improve URLClassPath search time
Summary: Implemented the interface in sun.misc.URLClassPath and corresponding JVM_XXX APIs
Reviewed-by: mchung, acorn, jiangli, dholmes


  47     }
  48     return array;
  49   }
  50 
  51   template <typename T>
  52   static Array<T>* new_writeable_array(ClassLoaderData* loader_data, int length, TRAPS) {
  53     return new (loader_data, length, /*read_only*/false, THREAD) Array<T>(length);
  54   }
  55 
  56   template <typename T>
  57   static Array<T>* new_writeable_array(ClassLoaderData* loader_data, int length, T value, TRAPS) {
  58     Array<T>* array = new_writeable_array<T>(loader_data, length, CHECK_NULL);
  59     for (int i = 0; i < length; i++) {
  60       array->at_put(i, value);
  61     }
  62     return array;
  63   }
  64 
  65   template <typename T>
  66   static void free_array(ClassLoaderData* loader_data, Array<T>* data) {






  67     if (data != NULL) {
  68       assert(loader_data != NULL, "shouldn't pass null");
  69       assert(!data->is_shared(), "cannot deallocate array in shared spaces");
  70       int size = data->size();
  71       if (DumpSharedSpaces) {
  72         loader_data->ro_metaspace()->deallocate((MetaWord*)data, size, false);
  73       } else {
  74         loader_data->metaspace_non_null()->deallocate((MetaWord*)data, size, false);
  75       }
  76     }
  77   }
  78 
  79   // Deallocation method for metadata
  80   template <class T>
  81   static void free_metadata(ClassLoaderData* loader_data, T md) {
  82     if (DumpSharedSpaces) {
  83       // FIXME: the freeing code is buggy, especially when PrintSharedSpaces is enabled.
  84       // Disable for now -- this means if you specify bad classes in your classlist you
  85       // may have wasted space inside the archive.
  86       return;


  47     }
  48     return array;
  49   }
  50 
  51   template <typename T>
  52   static Array<T>* new_writeable_array(ClassLoaderData* loader_data, int length, TRAPS) {
  53     return new (loader_data, length, /*read_only*/false, THREAD) Array<T>(length);
  54   }
  55 
  56   template <typename T>
  57   static Array<T>* new_writeable_array(ClassLoaderData* loader_data, int length, T value, TRAPS) {
  58     Array<T>* array = new_writeable_array<T>(loader_data, length, CHECK_NULL);
  59     for (int i = 0; i < length; i++) {
  60       array->at_put(i, value);
  61     }
  62     return array;
  63   }
  64 
  65   template <typename T>
  66   static void free_array(ClassLoaderData* loader_data, Array<T>* data) {
  67     if (DumpSharedSpaces) {
  68       // FIXME: the freeing code is buggy, especially when PrintSharedSpaces is enabled.
  69       // Disable for now -- this means if you specify bad classes in your classlist you
  70       // may have wasted space inside the archive.
  71       return;
  72     }
  73     if (data != NULL) {
  74       assert(loader_data != NULL, "shouldn't pass null");
  75       assert(!data->is_shared(), "cannot deallocate array in shared spaces");
  76       int size = data->size();
  77       if (DumpSharedSpaces) {
  78         loader_data->ro_metaspace()->deallocate((MetaWord*)data, size, false);
  79       } else {
  80         loader_data->metaspace_non_null()->deallocate((MetaWord*)data, size, false);
  81       }
  82     }
  83   }
  84 
  85   // Deallocation method for metadata
  86   template <class T>
  87   static void free_metadata(ClassLoaderData* loader_data, T md) {
  88     if (DumpSharedSpaces) {
  89       // FIXME: the freeing code is buggy, especially when PrintSharedSpaces is enabled.
  90       // Disable for now -- this means if you specify bad classes in your classlist you
  91       // may have wasted space inside the archive.
  92       return;
< prev index next >