1.1 --- a/src/share/vm/memory/allocation.cpp Fri Aug 31 16:39:35 2012 -0700 1.2 +++ b/src/share/vm/memory/allocation.cpp Sat Sep 01 13:25:18 2012 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -25,7 +25,10 @@ 1.11 #include "precompiled.hpp" 1.12 #include "memory/allocation.hpp" 1.13 #include "memory/allocation.inline.hpp" 1.14 +#include "memory/genCollectedHeap.hpp" 1.15 +#include "memory/metaspaceShared.hpp" 1.16 #include "memory/resourceArea.hpp" 1.17 +#include "memory/universe.hpp" 1.18 #include "runtime/atomic.hpp" 1.19 #include "runtime/os.hpp" 1.20 #include "runtime/task.hpp" 1.21 @@ -51,6 +54,27 @@ 1.22 void* _ValueObj::operator new(size_t size) { ShouldNotCallThis(); return 0; }; 1.23 void _ValueObj::operator delete(void* p) { ShouldNotCallThis(); }; 1.24 1.25 +void* MetaspaceObj::operator new(size_t size, ClassLoaderData* loader_data, 1.26 + size_t word_size, bool read_only, TRAPS) { 1.27 + // Klass has it's own operator new 1.28 + return Metaspace::allocate(loader_data, word_size, read_only, 1.29 + Metaspace::NonClassType, CHECK_NULL); 1.30 +} 1.31 + 1.32 +bool MetaspaceObj::is_shared() const { 1.33 + return MetaspaceShared::is_in_shared_space(this); 1.34 +} 1.35 + 1.36 +bool MetaspaceObj::is_metadata() const { 1.37 + // ClassLoaderDataGraph::contains((address)this); has lock inversion problems 1.38 + return !Universe::heap()->is_in_reserved(this); 1.39 +} 1.40 + 1.41 +void MetaspaceObj::print_address_on(outputStream* st) const { 1.42 + st->print(" {"INTPTR_FORMAT"}", this); 1.43 +} 1.44 + 1.45 + 1.46 void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) { 1.47 address res; 1.48 switch (type) {