author | iklam |
Mon, 23 Sep 2013 08:56:19 -0700 | |
changeset 20070 | 90ee74be2445 |
parent 19989 | 0fc247fb59bc |
child 20081 | e26536e86a5c |
permissions | -rw-r--r-- |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
1 |
/* |
17858
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
2 |
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
4 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
8 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
13 |
* accompanied this code). |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
14 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
18 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
21 |
* questions. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
22 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
23 |
*/ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
24 |
#ifndef SHARE_VM_MEMORY_METASPACE_HPP |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
25 |
#define SHARE_VM_MEMORY_METASPACE_HPP |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
26 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
27 |
#include "memory/allocation.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
28 |
#include "memory/memRegion.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
29 |
#include "runtime/virtualspace.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
30 |
#include "utilities/exceptions.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
31 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
32 |
// Metaspace |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
33 |
// |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
34 |
// Metaspaces are Arenas for the VM's metadata. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
35 |
// They are allocated one per class loader object, and one for the null |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
36 |
// bootstrap class loader |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
37 |
// Eventually for bootstrap loader we'll have a read-only section and read-write |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
38 |
// to write for DumpSharedSpaces and read for UseSharedSpaces |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
39 |
// |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
40 |
// block X ---+ +-------------------+ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
41 |
// | | Virtualspace | |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
42 |
// | | | |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
43 |
// | | | |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
44 |
// | |-------------------| |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
45 |
// | || Chunk | |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
46 |
// | || | |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
47 |
// | ||---------- | |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
48 |
// +------>||| block 0 | | |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
49 |
// ||---------- | |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
50 |
// ||| block 1 | | |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
51 |
// ||---------- | |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
52 |
// || | |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
53 |
// |-------------------| |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
54 |
// | | |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
55 |
// | | |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
56 |
// +-------------------+ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
57 |
// |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
58 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
59 |
class ClassLoaderData; |
14123
944e56f74fba
7045397: NPG: Add freelists to class loader arenas.
jmasa
parents:
13969
diff
changeset
|
60 |
class Metablock; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
61 |
class MetaWord; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
62 |
class Mutex; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
63 |
class outputStream; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
64 |
class SpaceManager; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
65 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
66 |
// Metaspaces each have a SpaceManager and allocations |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
67 |
// are done by the SpaceManager. Allocations are done |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
68 |
// out of the current Metachunk. When the current Metachunk |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
69 |
// is exhausted, the SpaceManager gets a new one from |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
70 |
// the current VirtualSpace. When the VirtualSpace is exhausted |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
71 |
// the SpaceManager gets a new one. The SpaceManager |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
72 |
// also manages freelists of available Chunks. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
73 |
// |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
74 |
// Currently the space manager maintains the list of |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
75 |
// virtual spaces and the list of chunks in use. Its |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
76 |
// allocate() method returns a block for use as a |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
77 |
// quantum of metadata. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
78 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
79 |
class VirtualSpaceList; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
80 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
81 |
class Metaspace : public CHeapObj<mtClass> { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
82 |
friend class VMStructs; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
83 |
friend class SpaceManager; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
84 |
friend class VM_CollectForMetadataAllocation; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
85 |
friend class MetaspaceGC; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
86 |
friend class MetaspaceAux; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
87 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
88 |
public: |
17628
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
89 |
enum MetadataType {ClassType = 0, |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
90 |
NonClassType = ClassType + 1, |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
91 |
MetadataTypeCount = ClassType + 2 |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
92 |
}; |
15086
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
93 |
enum MetaspaceType { |
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
94 |
StandardMetaspaceType, |
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
95 |
BootMetaspaceType, |
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
96 |
ROMetaspaceType, |
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
97 |
ReadWriteMetaspaceType, |
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
98 |
AnonymousMetaspaceType, |
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
99 |
ReflectionMetaspaceType |
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
100 |
}; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
101 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
102 |
private: |
15086
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
103 |
void initialize(Mutex* lock, MetaspaceType type); |
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
104 |
|
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
105 |
// Align up the word size to the allocation word size |
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
106 |
static size_t align_word_size_up(size_t); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
107 |
|
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
108 |
// Aligned size of the metaspace. |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
109 |
static size_t _class_metaspace_size; |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
110 |
|
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
111 |
static size_t class_metaspace_size() { |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
112 |
return _class_metaspace_size; |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
113 |
} |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
114 |
static void set_class_metaspace_size(size_t metaspace_size) { |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
115 |
_class_metaspace_size = metaspace_size; |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
116 |
} |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
117 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
118 |
static size_t _first_chunk_word_size; |
15086
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
119 |
static size_t _first_class_chunk_word_size; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
120 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
121 |
SpaceManager* _vsm; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
122 |
SpaceManager* vsm() const { return _vsm; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
123 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
124 |
SpaceManager* _class_vsm; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
125 |
SpaceManager* class_vsm() const { return _class_vsm; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
126 |
|
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
127 |
// Allocate space for metadata of type mdtype. This is space |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
128 |
// within a Metachunk and is used by |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
129 |
// allocate(ClassLoaderData*, size_t, bool, MetadataType, TRAPS) |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
130 |
// which returns a Metablock. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
131 |
MetaWord* allocate(size_t word_size, MetadataType mdtype); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
132 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
133 |
// Virtual Space lists for both classes and other metadata |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
134 |
static VirtualSpaceList* _space_list; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
135 |
static VirtualSpaceList* _class_space_list; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
136 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
137 |
static VirtualSpaceList* space_list() { return _space_list; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
138 |
static VirtualSpaceList* class_space_list() { return _class_space_list; } |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
19319
diff
changeset
|
139 |
static VirtualSpaceList* get_space_list(MetadataType mdtype) { |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
19319
diff
changeset
|
140 |
assert(mdtype != MetadataTypeCount, "MetadaTypeCount can't be used as mdtype"); |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
19319
diff
changeset
|
141 |
return mdtype == ClassType ? class_space_list() : space_list(); |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
19319
diff
changeset
|
142 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
143 |
|
17858
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
144 |
// This is used by DumpSharedSpaces only, where only _vsm is used. So we will |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
145 |
// maintain a single list for now. |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
146 |
void record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size); |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
147 |
|
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
148 |
#ifdef _LP64 |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
149 |
static void set_narrow_klass_base_and_shift(address metaspace_base, address cds_base); |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
150 |
|
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
151 |
// Returns true if can use CDS with metaspace allocated as specified address. |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
152 |
static bool can_use_cds_with_metaspace_addr(char* metaspace_base, address cds_base); |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
153 |
|
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
154 |
static void allocate_metaspace_compressed_klass_ptrs(char* requested_addr, address cds_base); |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
155 |
|
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
156 |
static void initialize_class_space(ReservedSpace rs); |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
157 |
#endif |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
158 |
|
17858
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
159 |
class AllocRecord : public CHeapObj<mtClass> { |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
160 |
public: |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
161 |
AllocRecord(address ptr, MetaspaceObj::Type type, int byte_size) |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
162 |
: _next(NULL), _ptr(ptr), _type(type), _byte_size(byte_size) {} |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
163 |
AllocRecord *_next; |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
164 |
address _ptr; |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
165 |
MetaspaceObj::Type _type; |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
166 |
int _byte_size; |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
167 |
}; |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
168 |
|
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
169 |
AllocRecord * _alloc_record_head; |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
170 |
AllocRecord * _alloc_record_tail; |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
171 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
172 |
public: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
173 |
|
15086
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
174 |
Metaspace(Mutex* lock, MetaspaceType type); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
175 |
~Metaspace(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
176 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
177 |
// Initialize globals for Metaspace |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
178 |
static void global_initialize(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
179 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
180 |
static size_t first_chunk_word_size() { return _first_chunk_word_size; } |
15086
2bfd799e9147
8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents:
14842
diff
changeset
|
181 |
static size_t first_class_chunk_word_size() { return _first_class_chunk_word_size; } |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
182 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
183 |
char* bottom() const; |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
184 |
size_t used_words_slow(MetadataType mdtype) const; |
19988 | 185 |
size_t free_words_slow(MetadataType mdtype) const; |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
186 |
size_t capacity_words_slow(MetadataType mdtype) const; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
187 |
|
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
188 |
size_t used_bytes_slow(MetadataType mdtype) const; |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
189 |
size_t capacity_bytes_slow(MetadataType mdtype) const; |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
190 |
|
17858
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
191 |
static Metablock* allocate(ClassLoaderData* loader_data, size_t word_size, |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
192 |
bool read_only, MetaspaceObj::Type type, TRAPS); |
13755
a00f5de57d30
7197557: NPG: nsk/sysdict/vm/stress/chain/chain004 hangs intermittently
jmasa
parents:
13737
diff
changeset
|
193 |
void deallocate(MetaWord* ptr, size_t byte_size, bool is_class); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
194 |
|
13755
a00f5de57d30
7197557: NPG: nsk/sysdict/vm/stress/chain/chain004 hangs intermittently
jmasa
parents:
13737
diff
changeset
|
195 |
MetaWord* expand_and_allocate(size_t size, |
a00f5de57d30
7197557: NPG: nsk/sysdict/vm/stress/chain/chain004 hangs intermittently
jmasa
parents:
13737
diff
changeset
|
196 |
MetadataType mdtype); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
197 |
|
14579
7f6ce6e3dd80
8003635: NPG: AsynchGetCallTrace broken by Method* virtual call
coleenp
parents:
14474
diff
changeset
|
198 |
static bool contains(const void *ptr); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
199 |
void dump(outputStream* const out) const; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
200 |
|
17101 | 201 |
// Free empty virtualspaces |
202 |
static void purge(); |
|
203 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
204 |
void print_on(outputStream* st) const; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
205 |
// Debugging support |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
206 |
void verify(); |
17858
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
207 |
|
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
208 |
class AllocRecordClosure : public StackObj { |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
209 |
public: |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
210 |
virtual void doit(address ptr, MetaspaceObj::Type type, int byte_size) = 0; |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
211 |
}; |
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
212 |
|
c292f8791cca
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
17628
diff
changeset
|
213 |
void iterate(AllocRecordClosure *closure); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
214 |
|
19979
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
19322
diff
changeset
|
215 |
// Return TRUE only if UseCompressedClassPointers is True and DumpSharedSpaces is False. |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
216 |
static bool using_class_space() { |
19979
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
19322
diff
changeset
|
217 |
return NOT_LP64(false) LP64_ONLY(UseCompressedClassPointers && !DumpSharedSpaces); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
218 |
} |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
219 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
220 |
}; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
221 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
222 |
class MetaspaceAux : AllStatic { |
19988 | 223 |
static size_t free_chunks_total_words(Metaspace::MetadataType mdtype); |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
224 |
|
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
225 |
// These methods iterate over the classloader data graph |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
226 |
// for the given Metaspace type. These are slow. |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
227 |
static size_t used_bytes_slow(Metaspace::MetadataType mdtype); |
19988 | 228 |
static size_t free_bytes_slow(Metaspace::MetadataType mdtype); |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
229 |
static size_t capacity_bytes_slow(Metaspace::MetadataType mdtype); |
19988 | 230 |
static size_t capacity_bytes_slow(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
231 |
|
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
232 |
// Running sum of space in all Metachunks that has been |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
233 |
// allocated to a Metaspace. This is used instead of |
17628
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
234 |
// iterating over all the classloaders. One for each |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
235 |
// type of Metadata |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
236 |
static size_t _allocated_capacity_words[Metaspace:: MetadataTypeCount]; |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
237 |
// Running sum of space in all Metachunks that have |
17628
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
238 |
// are being used for metadata. One for each |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
239 |
// type of Metadata. |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
240 |
static size_t _allocated_used_words[Metaspace:: MetadataTypeCount]; |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
241 |
|
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
242 |
public: |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
243 |
// Decrement and increment _allocated_capacity_words |
17628
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
244 |
static void dec_capacity(Metaspace::MetadataType type, size_t words); |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
245 |
static void inc_capacity(Metaspace::MetadataType type, size_t words); |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
246 |
|
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
247 |
// Decrement and increment _allocated_used_words |
17628
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
248 |
static void dec_used(Metaspace::MetadataType type, size_t words); |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
249 |
static void inc_used(Metaspace::MetadataType type, size_t words); |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
250 |
|
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
251 |
// Total of space allocated to metadata in all Metaspaces. |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
252 |
// This sums the space used in each Metachunk by |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
253 |
// iterating over the classloader data graph |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
254 |
static size_t used_bytes_slow() { |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
255 |
return used_bytes_slow(Metaspace::ClassType) + |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
256 |
used_bytes_slow(Metaspace::NonClassType); |
14842
4cdc5a61a7c2
8005108: NPG: MetaspaceAux::used_in_bytes(), capacity_in_bytes() and reserved_in_bytes() return inconsistent numbers
stefank
parents:
14590
diff
changeset
|
257 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
258 |
|
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
259 |
// Used by MetaspaceCounters |
19988 | 260 |
static size_t free_chunks_total_words(); |
261 |
static size_t free_chunks_total_bytes(); |
|
262 |
static size_t free_chunks_total_bytes(Metaspace::MetadataType mdtype); |
|
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
263 |
|
17628
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
264 |
static size_t allocated_capacity_words(Metaspace::MetadataType mdtype) { |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
265 |
return _allocated_capacity_words[mdtype]; |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
266 |
} |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
267 |
static size_t allocated_capacity_words() { |
19988 | 268 |
return allocated_capacity_words(Metaspace::NonClassType) + |
269 |
allocated_capacity_words(Metaspace::ClassType); |
|
17628
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
270 |
} |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
271 |
static size_t allocated_capacity_bytes(Metaspace::MetadataType mdtype) { |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
272 |
return allocated_capacity_words(mdtype) * BytesPerWord; |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
273 |
} |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
274 |
static size_t allocated_capacity_bytes() { |
17628
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
275 |
return allocated_capacity_words() * BytesPerWord; |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
276 |
} |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
277 |
|
17628
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
278 |
static size_t allocated_used_words(Metaspace::MetadataType mdtype) { |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
279 |
return _allocated_used_words[mdtype]; |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
280 |
} |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
281 |
static size_t allocated_used_words() { |
19988 | 282 |
return allocated_used_words(Metaspace::NonClassType) + |
283 |
allocated_used_words(Metaspace::ClassType); |
|
17628
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
284 |
} |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
285 |
static size_t allocated_used_bytes(Metaspace::MetadataType mdtype) { |
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
286 |
return allocated_used_words(mdtype) * BytesPerWord; |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
287 |
} |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
288 |
static size_t allocated_used_bytes() { |
17628
481e0280aed3
8014862: Add fast Metasapce capacity and used per MetadataType
jmasa
parents:
17109
diff
changeset
|
289 |
return allocated_used_words() * BytesPerWord; |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
290 |
} |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
291 |
|
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
292 |
static size_t free_bytes(); |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
19319
diff
changeset
|
293 |
static size_t free_bytes(Metaspace::MetadataType mdtype); |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
294 |
|
19988 | 295 |
static size_t reserved_bytes(Metaspace::MetadataType mdtype); |
296 |
static size_t reserved_bytes() { |
|
297 |
return reserved_bytes(Metaspace::ClassType) + |
|
298 |
reserved_bytes(Metaspace::NonClassType); |
|
14842
4cdc5a61a7c2
8005108: NPG: MetaspaceAux::used_in_bytes(), capacity_in_bytes() and reserved_in_bytes() return inconsistent numbers
stefank
parents:
14590
diff
changeset
|
299 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
300 |
|
19989
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19988
diff
changeset
|
301 |
static size_t committed_bytes(Metaspace::MetadataType mdtype); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19988
diff
changeset
|
302 |
static size_t committed_bytes() { |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19988
diff
changeset
|
303 |
return committed_bytes(Metaspace::ClassType) + |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19988
diff
changeset
|
304 |
committed_bytes(Metaspace::NonClassType); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19988
diff
changeset
|
305 |
} |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19988
diff
changeset
|
306 |
|
19988 | 307 |
static size_t min_chunk_size_words(); |
308 |
static size_t min_chunk_size_bytes() { |
|
309 |
return min_chunk_size_words() * BytesPerWord; |
|
14842
4cdc5a61a7c2
8005108: NPG: MetaspaceAux::used_in_bytes(), capacity_in_bytes() and reserved_in_bytes() return inconsistent numbers
stefank
parents:
14590
diff
changeset
|
310 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
311 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
312 |
// Print change in used metadata. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
313 |
static void print_metaspace_change(size_t prev_metadata_used); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
314 |
static void print_on(outputStream * out); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
315 |
static void print_on(outputStream * out, Metaspace::MetadataType mdtype); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
316 |
|
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18025
diff
changeset
|
317 |
static void print_class_waste(outputStream* out); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
318 |
static void print_waste(outputStream* out); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
319 |
static void dump(outputStream* out); |
14474
4154f1817a75
7200229: NPG: possible performance issue exposed by closed/runtime/6559877/Test6559877.java
mgerdin
parents:
14123
diff
changeset
|
320 |
static void verify_free_chunks(); |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
321 |
// Checks that the values returned by allocated_capacity_bytes() and |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
322 |
// capacity_bytes_slow() are the same. |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
323 |
static void verify_capacity(); |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
324 |
static void verify_used(); |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
325 |
static void verify_metrics(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
326 |
}; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
327 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
328 |
// Metaspace are deallocated when their class loader are GC'ed. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
329 |
// This class implements a policy for inducing GC's to recover |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
330 |
// Metaspaces. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
331 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
332 |
class MetaspaceGC : AllStatic { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
333 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
334 |
// The current high-water-mark for inducing a GC. When |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
335 |
// the capacity of all space in the virtual lists reaches this value, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
336 |
// a GC is induced and the value is increased. This should be changed |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
337 |
// to the space actually used for allocations to avoid affects of |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
338 |
// fragmentation losses to partially used chunks. Size is in words. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
339 |
static size_t _capacity_until_GC; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
340 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
341 |
// After a GC is done any allocation that fails should try to expand |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
342 |
// the capacity of the Metaspaces. This flag is set during attempts |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
343 |
// to allocate in the VMGCOperation that does the GC. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
344 |
static bool _expand_after_GC; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
345 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
346 |
// For a CMS collection, signal that a concurrent collection should |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
347 |
// be started. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
348 |
static bool _should_concurrent_collect; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
349 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
350 |
static uint _shrink_factor; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
351 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
352 |
static void set_capacity_until_GC(size_t v) { _capacity_until_GC = v; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
353 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
354 |
static size_t shrink_factor() { return _shrink_factor; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
355 |
void set_shrink_factor(uint v) { _shrink_factor = v; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
356 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
357 |
public: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
358 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
359 |
static size_t capacity_until_GC() { return _capacity_until_GC; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
360 |
static void inc_capacity_until_GC(size_t v) { _capacity_until_GC += v; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
361 |
static void dec_capacity_until_GC(size_t v) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
362 |
_capacity_until_GC = _capacity_until_GC > v ? _capacity_until_GC - v : 0; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
363 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
364 |
static bool expand_after_GC() { return _expand_after_GC; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
365 |
static void set_expand_after_GC(bool v) { _expand_after_GC = v; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
366 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
367 |
static bool should_concurrent_collect() { return _should_concurrent_collect; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
368 |
static void set_should_concurrent_collect(bool v) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
369 |
_should_concurrent_collect = v; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
370 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
371 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
372 |
// The amount to increase the high-water-mark (_capacity_until_GC) |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
373 |
static size_t delta_capacity_until_GC(size_t word_size); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
374 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
375 |
// It is expected that this will be called when the current capacity |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
376 |
// has been used and a GC should be considered. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
377 |
static bool should_expand(VirtualSpaceList* vsl, size_t word_size); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
378 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
379 |
// Calculate the new high-water mark at which to induce |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
380 |
// a GC. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
381 |
static void compute_new_size(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
382 |
}; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
383 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
384 |
#endif // SHARE_VM_MEMORY_METASPACE_HPP |