comparison src/share/vm/memory/allocation.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents d2a62e0f25eb
children 7b5885dadbdc
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
23 */ 23 */
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "memory/allocation.hpp" 26 #include "memory/allocation.hpp"
27 #include "memory/allocation.inline.hpp" 27 #include "memory/allocation.inline.hpp"
28 #include "memory/genCollectedHeap.hpp"
29 #include "memory/metaspaceShared.hpp"
28 #include "memory/resourceArea.hpp" 30 #include "memory/resourceArea.hpp"
31 #include "memory/universe.hpp"
29 #include "runtime/atomic.hpp" 32 #include "runtime/atomic.hpp"
30 #include "runtime/os.hpp" 33 #include "runtime/os.hpp"
31 #include "runtime/task.hpp" 34 #include "runtime/task.hpp"
32 #include "runtime/threadCritical.hpp" 35 #include "runtime/threadCritical.hpp"
33 #include "services/memTracker.hpp" 36 #include "services/memTracker.hpp"
48 51
49 void* StackObj::operator new(size_t size) { ShouldNotCallThis(); return 0; }; 52 void* StackObj::operator new(size_t size) { ShouldNotCallThis(); return 0; };
50 void StackObj::operator delete(void* p) { ShouldNotCallThis(); }; 53 void StackObj::operator delete(void* p) { ShouldNotCallThis(); };
51 void* _ValueObj::operator new(size_t size) { ShouldNotCallThis(); return 0; }; 54 void* _ValueObj::operator new(size_t size) { ShouldNotCallThis(); return 0; };
52 void _ValueObj::operator delete(void* p) { ShouldNotCallThis(); }; 55 void _ValueObj::operator delete(void* p) { ShouldNotCallThis(); };
56
57 void* MetaspaceObj::operator new(size_t size, ClassLoaderData* loader_data,
58 size_t word_size, bool read_only, TRAPS) {
59 // Klass has it's own operator new
60 return Metaspace::allocate(loader_data, word_size, read_only,
61 Metaspace::NonClassType, CHECK_NULL);
62 }
63
64 bool MetaspaceObj::is_shared() const {
65 return MetaspaceShared::is_in_shared_space(this);
66 }
67
68 bool MetaspaceObj::is_metadata() const {
69 // ClassLoaderDataGraph::contains((address)this); has lock inversion problems
70 return !Universe::heap()->is_in_reserved(this);
71 }
72
73 void MetaspaceObj::print_address_on(outputStream* st) const {
74 st->print(" {"INTPTR_FORMAT"}", this);
75 }
76
53 77
54 void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) { 78 void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) {
55 address res; 79 address res;
56 switch (type) { 80 switch (type) {
57 case C_HEAP: 81 case C_HEAP: