8058963: CollectorPolicy::satisfy_failed_metadata_allocation can avoid some safepoints

Reviewed-by: brutisso, mgerdin
This commit is contained in:
Erik Helin 2014-09-29 10:38:50 +02:00
parent 261735f6fa
commit d072dfaf9d
2 changed files with 8 additions and 4 deletions

View File

@ -817,7 +817,11 @@ MetaWord* CollectorPolicy::satisfy_failed_metadata_allocation(
assert(!Heap_lock->owned_by_self(), "Should not be holding the Heap_lock");
do {
MetaWord* result = NULL;
MetaWord* result = loader_data->metaspace_non_null()->allocate(word_size, mdtype);
if (result != NULL) {
return result;
}
if (GC_locker::is_active_and_needs_gc()) {
// If the GC_locker is active, just expand and allocate.
// If that does not succeed, wait if this thread is not

View File

@ -87,6 +87,7 @@ class Metaspace : public CHeapObj<mtClass> {
friend class VM_CollectForMetadataAllocation;
friend class MetaspaceGC;
friend class MetaspaceAux;
friend class CollectorPolicy;
public:
enum MetadataType {
@ -144,6 +145,8 @@ class Metaspace : public CHeapObj<mtClass> {
// allocate(ClassLoaderData*, size_t, bool, MetadataType, TRAPS)
MetaWord* allocate(size_t word_size, MetadataType mdtype);
MetaWord* expand_and_allocate(size_t size, MetadataType mdtype);
// Virtual Space lists for both classes and other metadata
static VirtualSpaceList* _space_list;
static VirtualSpaceList* _class_space_list;
@ -234,9 +237,6 @@ class Metaspace : public CHeapObj<mtClass> {
bool read_only, MetaspaceObj::Type type, TRAPS);
void deallocate(MetaWord* ptr, size_t byte_size, bool is_class);
MetaWord* expand_and_allocate(size_t size,
MetadataType mdtype);
static bool contains(const void* ptr);
void dump(outputStream* const out) const;