--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp Mon Sep 29 09:59:23 2014 +0200
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp Mon Sep 29 12:05:44 2014 +0000
@@ -817,7 +817,11 @@
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
--- a/hotspot/src/share/vm/memory/metaspace.hpp Mon Sep 29 09:59:23 2014 +0200
+++ b/hotspot/src/share/vm/memory/metaspace.hpp Mon Sep 29 12:05:44 2014 +0000
@@ -87,6 +87,7 @@
friend class VM_CollectForMetadataAllocation;
friend class MetaspaceGC;
friend class MetaspaceAux;
+ friend class CollectorPolicy;
public:
enum MetadataType {
@@ -144,6 +145,8 @@
// 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 @@
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;