author | stuefe |
Tue, 26 Nov 2019 16:21:29 +0100 | |
branch | stuefe-new-metaspace-branch |
changeset 59272 | 54750b448264 |
parent 58839 | d888a9d9f9a5 |
permissions | -rw-r--r-- |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
1 |
/* |
53547 | 2 |
* Copyright (c) 2011, 2019, 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 |
*/ |
50193 | 24 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
26 |
|
42650 | 27 |
#include "aot/aotLoader.hpp" |
50380
bec342339138
8204195: Clean up macroAssembler.inline.hpp and other inline.hpp files included in .hpp files
coleenp
parents:
50372
diff
changeset
|
28 |
#include "gc/shared/collectedHeap.hpp" |
35061 | 29 |
#include "logging/log.hpp" |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46674
diff
changeset
|
30 |
#include "logging/logStream.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
31 |
#include "memory/filemap.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
32 |
#include "memory/metaspace.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
33 |
#include "memory/metaspaceShared.hpp" |
23465
14790e4d53ec
8036698: Add trace event for updates to metaspace gc threshold
ehelin
parents:
22884
diff
changeset
|
34 |
#include "memory/metaspaceTracer.hpp" |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
35 |
#include "memory/metaspace/chunkManager.hpp" |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
36 |
#include "memory/metaspace/classLoaderMetaspace.hpp" |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
37 |
#include "memory/metaspace/commitLimiter.hpp" |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
38 |
#include "memory/metaspace/metaspaceCommon.hpp" |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
39 |
#include "memory/metaspace/metaspaceEnums.hpp" |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
40 |
#include "memory/metaspace/metaspaceReport.hpp" |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
41 |
#include "memory/metaspace/metaspaceSizesSnapshot.hpp" |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
42 |
#include "memory/metaspace/runningCounters.hpp" |
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
43 |
#include "memory/metaspace/settings.hpp" |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
44 |
#include "memory/metaspace/virtualSpaceList.hpp" |
50380
bec342339138
8204195: Clean up macroAssembler.inline.hpp and other inline.hpp files included in .hpp files
coleenp
parents:
50372
diff
changeset
|
45 |
#include "memory/universe.hpp" |
54780
f8d182aedc92
8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
54623
diff
changeset
|
46 |
#include "oops/compressedOops.hpp" |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
47 |
#include "runtime/init.hpp" |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
48 |
#include "runtime/java.hpp" |
50429
83aec1d357d4
8204301: Make OrderAccess functions available to hpp rather than inline.hpp files
coleenp
parents:
50380
diff
changeset
|
49 |
#include "runtime/orderAccess.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
50 |
#include "services/memTracker.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
51 |
#include "utilities/copy.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
52 |
#include "utilities/debug.hpp" |
50380
bec342339138
8204195: Clean up macroAssembler.inline.hpp and other inline.hpp files included in .hpp files
coleenp
parents:
50372
diff
changeset
|
53 |
#include "utilities/formatBuffer.hpp" |
49980 | 54 |
#include "utilities/globalDefinitions.hpp" |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
55 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
56 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
57 |
using metaspace::ChunkManager; |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
58 |
using metaspace::ClassLoaderMetaspace; |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
59 |
using metaspace::CommitLimiter; |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
60 |
using metaspace::MetaspaceType; |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
61 |
using metaspace::MetaspaceReporter; |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
62 |
using metaspace::RunningCounters; |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
63 |
using metaspace::VirtualSpaceList; |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
64 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
65 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
66 |
// Used by MetaspaceCounters |
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
67 |
size_t MetaspaceUtils::free_chunks_total_words(Metaspace::MetadataType mdtype) { |
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
68 |
return metaspace::is_class(mdtype) ? RunningCounters::free_chunks_words_class() : RunningCounters::free_chunks_words_nonclass(); |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
69 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
70 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
71 |
size_t MetaspaceUtils::used_words() { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
72 |
return RunningCounters::used_words(); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
73 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
74 |
|
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
75 |
size_t MetaspaceUtils::used_words(Metaspace::MetadataType mdtype) { |
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
76 |
return metaspace::is_class(mdtype) ? RunningCounters::used_words_class() : RunningCounters::used_words_nonclass(); |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
77 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
78 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
79 |
size_t MetaspaceUtils::reserved_words() { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
80 |
return RunningCounters::reserved_words(); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
81 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
82 |
|
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
83 |
size_t MetaspaceUtils::reserved_words(Metaspace::MetadataType mdtype) { |
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
84 |
return metaspace::is_class(mdtype) ? RunningCounters::reserved_words_class() : RunningCounters::reserved_words_nonclass(); |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
85 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
86 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
87 |
size_t MetaspaceUtils::committed_words() { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
88 |
return RunningCounters::committed_words(); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
89 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
90 |
|
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
91 |
size_t MetaspaceUtils::committed_words(Metaspace::MetadataType mdtype) { |
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
92 |
return metaspace::is_class(mdtype) ? RunningCounters::committed_words_class() : RunningCounters::committed_words_nonclass(); |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
93 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
94 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
95 |
|
20729 | 96 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
97 |
void MetaspaceUtils::print_metaspace_change(const metaspace::MetaspaceSizesSnapshot& pre_meta_values) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
98 |
const metaspace::MetaspaceSizesSnapshot meta_values; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
99 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
100 |
// We print used and committed since these are the most useful at-a-glance vitals for Metaspace: |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
101 |
// - used tells you how much memory is actually used for metadata |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
102 |
// - committed tells you how much memory is committed for the purpose of metadata |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
103 |
// The difference between those two would be waste, which can have various forms (freelists, |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
104 |
// unused parts of committed chunks etc) |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
105 |
// |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
106 |
// Left out is reserved, since this is not as exciting as the first two values: for class space, |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
107 |
// it is a constant (to uninformed users, often confusingly large). For non-class space, it would |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
108 |
// be interesting since free chunks can be uncommitted, but for now it is left out. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
109 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
110 |
if (Metaspace::using_class_space()) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
111 |
log_info(gc, metaspace)(HEAP_CHANGE_FORMAT" " |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
112 |
HEAP_CHANGE_FORMAT" " |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
113 |
HEAP_CHANGE_FORMAT, |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
114 |
HEAP_CHANGE_FORMAT_ARGS("Metaspace", |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
115 |
pre_meta_values.used(), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
116 |
pre_meta_values.committed(), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
117 |
meta_values.used(), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
118 |
meta_values.committed()), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
119 |
HEAP_CHANGE_FORMAT_ARGS("NonClass", |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
120 |
pre_meta_values.non_class_used(), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
121 |
pre_meta_values.non_class_committed(), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
122 |
meta_values.non_class_used(), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
123 |
meta_values.non_class_committed()), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
124 |
HEAP_CHANGE_FORMAT_ARGS("Class", |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
125 |
pre_meta_values.class_used(), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
126 |
pre_meta_values.class_committed(), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
127 |
meta_values.class_used(), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
128 |
meta_values.class_committed())); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
129 |
} else { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
130 |
log_info(gc, metaspace)(HEAP_CHANGE_FORMAT, |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
131 |
HEAP_CHANGE_FORMAT_ARGS("Metaspace", |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
132 |
pre_meta_values.used(), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
133 |
pre_meta_values.committed(), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
134 |
meta_values.used(), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
135 |
meta_values.committed())); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
136 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
137 |
} |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
138 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
139 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
140 |
// Prints an ASCII representation of the given space. |
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
141 |
void MetaspaceUtils::print_metaspace_map(outputStream* out, Metaspace::MetadataType mdtype) { |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
142 |
out->print_cr("-- not yet implemented ---"); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
143 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
144 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
145 |
// This will print out a basic metaspace usage report but |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
146 |
// unlike print_report() is guaranteed not to lock or to walk the CLDG. |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
147 |
void MetaspaceUtils::print_basic_report(outputStream* out, size_t scale) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
148 |
MetaspaceReporter::print_basic_report(out, scale); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
149 |
} |
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46723
diff
changeset
|
150 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
151 |
// Prints a report about the current metaspace state. |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
152 |
// Optional parts can be enabled via flags. |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
153 |
// Function will walk the CLDG and will lock the expand lock; if that is not |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
154 |
// convenient, use print_basic_report() instead. |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
155 |
void MetaspaceUtils::print_full_report(outputStream* out, size_t scale) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
156 |
const int flags = |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
157 |
MetaspaceReporter::rf_show_loaders | |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
158 |
MetaspaceReporter::rf_break_down_by_chunktype | |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
159 |
MetaspaceReporter::rf_show_classes; |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
160 |
MetaspaceReporter::print_report(out, scale, flags); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
161 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
162 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
163 |
void MetaspaceUtils::print_on(outputStream* out) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
164 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
165 |
// Used from all GCs. It first prints out totals, then, separately, the class space portion. |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
166 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
167 |
out->print_cr(" Metaspace " |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
168 |
"used " SIZE_FORMAT "K, " |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
169 |
"committed " SIZE_FORMAT "K, " |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
170 |
"reserved " SIZE_FORMAT "K", |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
171 |
used_bytes()/K, |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
172 |
committed_bytes()/K, |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
173 |
reserved_bytes()/K); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
174 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
175 |
if (Metaspace::using_class_space()) { |
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
176 |
const Metaspace::MetadataType ct = Metaspace::ClassType; |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
177 |
out->print_cr(" class space " |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
178 |
"used " SIZE_FORMAT "K, " |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
179 |
"committed " SIZE_FORMAT "K, " |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
180 |
"reserved " SIZE_FORMAT "K", |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
181 |
used_bytes(ct)/K, |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
182 |
committed_bytes(ct)/K, |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
183 |
reserved_bytes(ct)/K); |
49980 | 184 |
} |
47802
18dccdc438d7
8189688: NMT: Report per-class load metadata information
zgu
parents:
47654
diff
changeset
|
185 |
} |
18dccdc438d7
8189688: NMT: Report per-class load metadata information
zgu
parents:
47654
diff
changeset
|
186 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
187 |
#ifdef ASSERT |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
188 |
void MetaspaceUtils::verify(bool slow) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
189 |
if (Metaspace::initialized()) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
190 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
191 |
// Verify non-class chunkmanager... |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
192 |
ChunkManager* cm = ChunkManager::chunkmanager_nonclass(); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
193 |
cm->verify(slow); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
194 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
195 |
// ... and space list. |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
196 |
VirtualSpaceList* vsl = VirtualSpaceList::vslist_nonclass(); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
197 |
vsl->verify(slow); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
198 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
199 |
if (Metaspace::using_class_space()) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
200 |
// If we use compressed class pointers, verify class chunkmanager... |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
201 |
cm = ChunkManager::chunkmanager_class(); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
202 |
assert(cm != NULL, "Sanity"); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
203 |
cm->verify(slow); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
204 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
205 |
// ... and class spacelist. |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
206 |
VirtualSpaceList* vsl = VirtualSpaceList::vslist_nonclass(); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
207 |
assert(vsl != NULL, "Sanity"); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
208 |
vsl->verify(slow); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
209 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
210 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
211 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
212 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
213 |
#endif |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
214 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
215 |
////////////////////////////////7 |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
216 |
// MetaspaceGC methods |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
217 |
|
50119
bf9177eac58d
8189271: Metaspace::_capacity_until_GC should be size_t
aharlap
parents:
50066
diff
changeset
|
218 |
volatile size_t MetaspaceGC::_capacity_until_GC = 0; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
219 |
uint MetaspaceGC::_shrink_factor = 0; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
220 |
bool MetaspaceGC::_should_concurrent_collect = false; |
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 |
// VM_CollectForMetadataAllocation is the vm operation used to GC. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
223 |
// Within the VM operation after the GC the attempt to allocate the metadata |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
224 |
// should succeed. If the GC did not free enough space for the metaspace |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
225 |
// allocation, the HWM is increased so that another virtualspace will be |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
226 |
// allocated for the metadata. With perm gen the increase in the perm |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
227 |
// gen had bounds, MinMetaspaceExpansion and MaxMetaspaceExpansion. The |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
228 |
// metaspace policy uses those as the small and large steps for the HWM. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
229 |
// |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
230 |
// After the GC the compute_new_size() for MetaspaceGC is called to |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
231 |
// resize the capacity of the metaspaces. The current implementation |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
232 |
// is based on the flags MinMetaspaceFreeRatio and MaxMetaspaceFreeRatio used |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
233 |
// to resize the Java heap by some GC's. New flags can be implemented |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
234 |
// if really needed. MinMetaspaceFreeRatio is used to calculate how much |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
235 |
// free space is desirable in the metaspace capacity to decide how much |
15610
528d799702c7
8005452: NPG: Create new flags for Metaspace resizing policy
jmasa
parents:
15488
diff
changeset
|
236 |
// to increase the HWM. MaxMetaspaceFreeRatio is used to decide how much |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
237 |
// free space is desirable in the metaspace capacity before decreasing |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
238 |
// the HWM. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
239 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
240 |
// Calculate the amount to increase the high water mark (HWM). |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
241 |
// Increase by a minimum amount (MinMetaspaceExpansion) so that |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
242 |
// another expansion is not requested too soon. If that is not |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
243 |
// enough to satisfy the allocation, increase by MaxMetaspaceExpansion. |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
244 |
// If that is still not enough, expand by the size of the allocation |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
245 |
// plus some. |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
246 |
size_t MetaspaceGC::delta_capacity_until_GC(size_t bytes) { |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
247 |
size_t min_delta = MinMetaspaceExpansion; |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
248 |
size_t max_delta = MaxMetaspaceExpansion; |
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
249 |
size_t delta = align_up(bytes, Metaspace::commit_alignment()); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
250 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
251 |
if (delta <= min_delta) { |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
252 |
delta = min_delta; |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
253 |
} else if (delta <= max_delta) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
254 |
// Don't want to hit the high water mark on the next |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
255 |
// allocation so make the delta greater than just enough |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
256 |
// for this allocation. |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
257 |
delta = max_delta; |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
258 |
} else { |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
259 |
// This allocation is large but the next ones are probably not |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
260 |
// so increase by the minimum. |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
261 |
delta = delta + min_delta; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
262 |
} |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
263 |
|
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
264 |
assert_is_aligned(delta, Metaspace::commit_alignment()); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
265 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
266 |
return delta; |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
267 |
} |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
268 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
269 |
size_t MetaspaceGC::capacity_until_GC() { |
47634
6a0c42c40cd1
8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents:
47599
diff
changeset
|
270 |
size_t value = OrderAccess::load_acquire(&_capacity_until_GC); |
27693
3eee985a97e7
8059492: Wrong spelling in assert: "Not initialied properly?"
aharlap
parents:
27683
diff
changeset
|
271 |
assert(value >= MetaspaceSize, "Not initialized properly?"); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
272 |
return value; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
273 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
274 |
|
53602
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
275 |
// Try to increase the _capacity_until_GC limit counter by v bytes. |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
276 |
// Returns true if it succeeded. It may fail if either another thread |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
277 |
// concurrently increased the limit or the new limit would be larger |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
278 |
// than MaxMetaspaceSize. |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
279 |
// On success, optionally returns new and old metaspace capacity in |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
280 |
// new_cap_until_GC and old_cap_until_GC respectively. |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
281 |
// On error, optionally sets can_retry to indicate whether if there is |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
282 |
// actually enough space remaining to satisfy the request. |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
283 |
bool MetaspaceGC::inc_capacity_until_GC(size_t v, size_t* new_cap_until_GC, size_t* old_cap_until_GC, bool* can_retry) { |
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
284 |
assert_is_aligned(v, Metaspace::commit_alignment()); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
285 |
|
50283
2f9811d99ba8
8203262: Incorrect cmpxchg usage in MetaspaceGC::inc_capacity_until_GC
tschatzl
parents:
50193
diff
changeset
|
286 |
size_t old_capacity_until_GC = _capacity_until_GC; |
2f9811d99ba8
8203262: Incorrect cmpxchg usage in MetaspaceGC::inc_capacity_until_GC
tschatzl
parents:
50193
diff
changeset
|
287 |
size_t new_value = old_capacity_until_GC + v; |
26938
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
288 |
|
50283
2f9811d99ba8
8203262: Incorrect cmpxchg usage in MetaspaceGC::inc_capacity_until_GC
tschatzl
parents:
50193
diff
changeset
|
289 |
if (new_value < old_capacity_until_GC) { |
26938
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
290 |
// The addition wrapped around, set new_value to aligned max value. |
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
291 |
new_value = align_down(max_uintx, Metaspace::commit_alignment()); |
26938
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
292 |
} |
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
293 |
|
53602
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
294 |
if (new_value > MaxMetaspaceSize) { |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
295 |
if (can_retry != NULL) { |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
296 |
*can_retry = false; |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
297 |
} |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
298 |
return false; |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
299 |
} |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
300 |
|
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
301 |
if (can_retry != NULL) { |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
302 |
*can_retry = true; |
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
303 |
} |
50283
2f9811d99ba8
8203262: Incorrect cmpxchg usage in MetaspaceGC::inc_capacity_until_GC
tschatzl
parents:
50193
diff
changeset
|
304 |
size_t prev_value = Atomic::cmpxchg(new_value, &_capacity_until_GC, old_capacity_until_GC); |
26938
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
305 |
|
50283
2f9811d99ba8
8203262: Incorrect cmpxchg usage in MetaspaceGC::inc_capacity_until_GC
tschatzl
parents:
50193
diff
changeset
|
306 |
if (old_capacity_until_GC != prev_value) { |
26938
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
307 |
return false; |
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
308 |
} |
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
309 |
|
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
310 |
if (new_cap_until_GC != NULL) { |
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
311 |
*new_cap_until_GC = new_value; |
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
312 |
} |
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
313 |
if (old_cap_until_GC != NULL) { |
50283
2f9811d99ba8
8203262: Incorrect cmpxchg usage in MetaspaceGC::inc_capacity_until_GC
tschatzl
parents:
50193
diff
changeset
|
314 |
*old_cap_until_GC = old_capacity_until_GC; |
26938
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
315 |
} |
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
316 |
return true; |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
317 |
} |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
318 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
319 |
size_t MetaspaceGC::dec_capacity_until_GC(size_t v) { |
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
320 |
assert_is_aligned(v, Metaspace::commit_alignment()); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
321 |
|
50119
bf9177eac58d
8189271: Metaspace::_capacity_until_GC should be size_t
aharlap
parents:
50066
diff
changeset
|
322 |
return Atomic::sub(v, &_capacity_until_GC); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
323 |
} |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
324 |
|
24847
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
325 |
void MetaspaceGC::initialize() { |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
326 |
// Set the high-water mark to MaxMetapaceSize during VM initializaton since |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
327 |
// we can't do a GC during initialization. |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
328 |
_capacity_until_GC = MaxMetaspaceSize; |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
329 |
} |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
330 |
|
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
331 |
void MetaspaceGC::post_initialize() { |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
332 |
// Reset the high-water mark once the VM initialization is done. |
49389
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49386
diff
changeset
|
333 |
_capacity_until_GC = MAX2(MetaspaceUtils::committed_bytes(), MetaspaceSize); |
24847
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
334 |
} |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
335 |
|
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
336 |
bool MetaspaceGC::can_expand(size_t word_size, bool is_class) { |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
337 |
// Check if the compressed class space is full. |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
338 |
if (is_class && Metaspace::using_class_space()) { |
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
339 |
size_t class_committed = MetaspaceUtils::committed_bytes(Metaspace::ClassType); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
340 |
if (class_committed + word_size * BytesPerWord > CompressedClassSpaceSize) { |
49365 | 341 |
log_trace(gc, metaspace, freelist)("Cannot expand %s metaspace by " SIZE_FORMAT " words (CompressedClassSpaceSize = " SIZE_FORMAT " words)", |
342 |
(is_class ? "class" : "non-class"), word_size, CompressedClassSpaceSize / sizeof(MetaWord)); |
|
18491
dd63ba6b0ee4
8015391: NPG: With -XX:+UseCompressedKlassPointers OOME due to exhausted metadata space could occur when metaspace is almost empty
coleenp
parents:
17858
diff
changeset
|
343 |
return false; |
dd63ba6b0ee4
8015391: NPG: With -XX:+UseCompressedKlassPointers OOME due to exhausted metadata space could occur when metaspace is almost empty
coleenp
parents:
17858
diff
changeset
|
344 |
} |
16391
7bf8a7699f5f
8004241: NPG: Metaspace occupies more memory than specified by -XX:MaxMetaspaceSize option
mgerdin
parents:
16387
diff
changeset
|
345 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
346 |
|
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
347 |
// Check if the user has imposed a limit on the metaspace memory. |
49389
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49386
diff
changeset
|
348 |
size_t committed_bytes = MetaspaceUtils::committed_bytes(); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
349 |
if (committed_bytes + word_size * BytesPerWord > MaxMetaspaceSize) { |
49365 | 350 |
log_trace(gc, metaspace, freelist)("Cannot expand %s metaspace by " SIZE_FORMAT " words (MaxMetaspaceSize = " SIZE_FORMAT " words)", |
351 |
(is_class ? "class" : "non-class"), word_size, MaxMetaspaceSize / sizeof(MetaWord)); |
|
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
352 |
return false; |
13728
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 |
|
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
355 |
return true; |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
356 |
} |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
357 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
358 |
size_t MetaspaceGC::allowed_expansion() { |
49389
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49386
diff
changeset
|
359 |
size_t committed_bytes = MetaspaceUtils::committed_bytes(); |
24847
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
360 |
size_t capacity_until_gc = capacity_until_GC(); |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
361 |
|
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
362 |
assert(capacity_until_gc >= committed_bytes, |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31374
diff
changeset
|
363 |
"capacity_until_gc: " SIZE_FORMAT " < committed_bytes: " SIZE_FORMAT, |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31374
diff
changeset
|
364 |
capacity_until_gc, committed_bytes); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
365 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
366 |
size_t left_until_max = MaxMetaspaceSize - committed_bytes; |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
367 |
size_t left_until_GC = capacity_until_gc - committed_bytes; |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
368 |
size_t left_to_commit = MIN2(left_until_GC, left_until_max); |
49365 | 369 |
log_trace(gc, metaspace, freelist)("allowed expansion words: " SIZE_FORMAT |
370 |
" (left_until_max: " SIZE_FORMAT ", left_until_GC: " SIZE_FORMAT ".", |
|
371 |
left_to_commit / BytesPerWord, left_until_max / BytesPerWord, left_until_GC / BytesPerWord); |
|
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
372 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
373 |
return left_to_commit / BytesPerWord; |
13728
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 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
376 |
void MetaspaceGC::compute_new_size() { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
377 |
assert(_shrink_factor <= 100, "invalid shrink factor"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
378 |
uint current_shrink_factor = _shrink_factor; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
379 |
_shrink_factor = 0; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
380 |
|
24847
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
381 |
// Using committed_bytes() for used_after_gc is an overestimation, since the |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
382 |
// chunk free lists are included in committed_bytes() and the memory in an |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
383 |
// un-fragmented chunk free list is available for future allocations. |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
384 |
// However, if the chunk free lists becomes fragmented, then the memory may |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
385 |
// not be available for future allocations and the memory is therefore "in use". |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
386 |
// Including the chunk free lists in the definition of "in use" is therefore |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
387 |
// necessary. Not including the chunk free lists can cause capacity_until_GC to |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
388 |
// shrink below committed_bytes() and this has caused serious bugs in the past. |
49389
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49386
diff
changeset
|
389 |
const size_t used_after_gc = MetaspaceUtils::committed_bytes(); |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
390 |
const size_t capacity_until_GC = MetaspaceGC::capacity_until_GC(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
391 |
|
15610
528d799702c7
8005452: NPG: Create new flags for Metaspace resizing policy
jmasa
parents:
15488
diff
changeset
|
392 |
const double minimum_free_percentage = MinMetaspaceFreeRatio / 100.0; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
393 |
const double maximum_used_percentage = 1.0 - minimum_free_percentage; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
394 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
395 |
const double min_tmp = used_after_gc / maximum_used_percentage; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
396 |
size_t minimum_desired_capacity = |
53602
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
397 |
(size_t)MIN2(min_tmp, double(MaxMetaspaceSize)); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
398 |
// Don't shrink less than the initial generation size |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
399 |
minimum_desired_capacity = MAX2(minimum_desired_capacity, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
400 |
MetaspaceSize); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
401 |
|
35061 | 402 |
log_trace(gc, metaspace)("MetaspaceGC::compute_new_size: "); |
403 |
log_trace(gc, metaspace)(" minimum_free_percentage: %6.2f maximum_used_percentage: %6.2f", |
|
404 |
minimum_free_percentage, maximum_used_percentage); |
|
405 |
log_trace(gc, metaspace)(" used_after_gc : %6.1fKB", used_after_gc / (double) K); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
406 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
407 |
|
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
408 |
size_t shrink_bytes = 0; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
409 |
if (capacity_until_GC < minimum_desired_capacity) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
410 |
// If we have less capacity below the metaspace HWM, then |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
411 |
// increment the HWM. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
412 |
size_t expand_bytes = minimum_desired_capacity - capacity_until_GC; |
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
413 |
expand_bytes = align_up(expand_bytes, Metaspace::commit_alignment()); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
414 |
// Don't expand unless it's significant |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
415 |
if (expand_bytes >= MinMetaspaceExpansion) { |
26938
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
416 |
size_t new_capacity_until_GC = 0; |
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
417 |
bool succeeded = MetaspaceGC::inc_capacity_until_GC(expand_bytes, &new_capacity_until_GC); |
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
418 |
assert(succeeded, "Should always succesfully increment HWM when at safepoint"); |
e0b35f8104a7
8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
26304
diff
changeset
|
419 |
|
23465
14790e4d53ec
8036698: Add trace event for updates to metaspace gc threshold
ehelin
parents:
22884
diff
changeset
|
420 |
Metaspace::tracer()->report_gc_threshold(capacity_until_GC, |
14790e4d53ec
8036698: Add trace event for updates to metaspace gc threshold
ehelin
parents:
22884
diff
changeset
|
421 |
new_capacity_until_GC, |
14790e4d53ec
8036698: Add trace event for updates to metaspace gc threshold
ehelin
parents:
22884
diff
changeset
|
422 |
MetaspaceGCThresholdUpdater::ComputeNewSize); |
35061 | 423 |
log_trace(gc, metaspace)(" expanding: minimum_desired_capacity: %6.1fKB expand_bytes: %6.1fKB MinMetaspaceExpansion: %6.1fKB new metaspace HWM: %6.1fKB", |
424 |
minimum_desired_capacity / (double) K, |
|
425 |
expand_bytes / (double) K, |
|
426 |
MinMetaspaceExpansion / (double) K, |
|
427 |
new_capacity_until_GC / (double) K); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
428 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
429 |
return; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
430 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
431 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
432 |
// No expansion, now see if we want to shrink |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
433 |
// We would never want to shrink more than this |
22499 | 434 |
assert(capacity_until_GC >= minimum_desired_capacity, |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31374
diff
changeset
|
435 |
SIZE_FORMAT " >= " SIZE_FORMAT, |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31374
diff
changeset
|
436 |
capacity_until_GC, minimum_desired_capacity); |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
437 |
size_t max_shrink_bytes = capacity_until_GC - minimum_desired_capacity; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
438 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
439 |
// Should shrinking be considered? |
15610
528d799702c7
8005452: NPG: Create new flags for Metaspace resizing policy
jmasa
parents:
15488
diff
changeset
|
440 |
if (MaxMetaspaceFreeRatio < 100) { |
528d799702c7
8005452: NPG: Create new flags for Metaspace resizing policy
jmasa
parents:
15488
diff
changeset
|
441 |
const double maximum_free_percentage = MaxMetaspaceFreeRatio / 100.0; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
442 |
const double minimum_used_percentage = 1.0 - maximum_free_percentage; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
443 |
const double max_tmp = used_after_gc / minimum_used_percentage; |
53602
d1282cd2c1fc
8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize
ysuenaga
parents:
53598
diff
changeset
|
444 |
size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(MaxMetaspaceSize)); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
445 |
maximum_desired_capacity = MAX2(maximum_desired_capacity, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
446 |
MetaspaceSize); |
35061 | 447 |
log_trace(gc, metaspace)(" maximum_free_percentage: %6.2f minimum_used_percentage: %6.2f", |
448 |
maximum_free_percentage, minimum_used_percentage); |
|
449 |
log_trace(gc, metaspace)(" minimum_desired_capacity: %6.1fKB maximum_desired_capacity: %6.1fKB", |
|
450 |
minimum_desired_capacity / (double) K, maximum_desired_capacity / (double) K); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
451 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
452 |
assert(minimum_desired_capacity <= maximum_desired_capacity, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
453 |
"sanity check"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
454 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
455 |
if (capacity_until_GC > maximum_desired_capacity) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
456 |
// Capacity too large, compute shrinking size |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
457 |
shrink_bytes = capacity_until_GC - maximum_desired_capacity; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
458 |
// We don't want shrink all the way back to initSize if people call |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
459 |
// System.gc(), because some programs do that between "phases" and then |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
460 |
// we'd just have to grow the heap up again for the next phase. So we |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
461 |
// damp the shrinking: 0% on the first call, 10% on the second call, 40% |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
462 |
// on the third call, and 100% by the fourth call. But if we recompute |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
463 |
// size without shrinking, it goes back to 0%. |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
464 |
shrink_bytes = shrink_bytes / 100 * current_shrink_factor; |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
465 |
|
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
466 |
shrink_bytes = align_down(shrink_bytes, Metaspace::commit_alignment()); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
467 |
|
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
468 |
assert(shrink_bytes <= max_shrink_bytes, |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31374
diff
changeset
|
469 |
"invalid shrink size " SIZE_FORMAT " not <= " SIZE_FORMAT, |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31374
diff
changeset
|
470 |
shrink_bytes, max_shrink_bytes); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
471 |
if (current_shrink_factor == 0) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
472 |
_shrink_factor = 10; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
473 |
} else { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
474 |
_shrink_factor = MIN2(current_shrink_factor * 4, (uint) 100); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
475 |
} |
37151
bcda1fb89431
8151845: Comment in globals.hpp for MetaspaceSize is incorrect.
jmasa
parents:
37139
diff
changeset
|
476 |
log_trace(gc, metaspace)(" shrinking: initThreshold: %.1fK maximum_desired_capacity: %.1fK", |
35061 | 477 |
MetaspaceSize / (double) K, maximum_desired_capacity / (double) K); |
478 |
log_trace(gc, metaspace)(" shrink_bytes: %.1fK current_shrink_factor: %d new shrink factor: %d MinMetaspaceExpansion: %.1fK", |
|
479 |
shrink_bytes / (double) K, current_shrink_factor, _shrink_factor, MinMetaspaceExpansion / (double) K); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
480 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
481 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
482 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
483 |
// Don't shrink unless it's significant |
17109
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
484 |
if (shrink_bytes >= MinMetaspaceExpansion && |
90e6c31bbbe4
8008966: NPG: Inefficient Metaspace counter functions cause large young GC regressions
jmasa
parents:
17101
diff
changeset
|
485 |
((capacity_until_GC - shrink_bytes) >= MetaspaceSize)) { |
23465
14790e4d53ec
8036698: Add trace event for updates to metaspace gc threshold
ehelin
parents:
22884
diff
changeset
|
486 |
size_t new_capacity_until_GC = MetaspaceGC::dec_capacity_until_GC(shrink_bytes); |
14790e4d53ec
8036698: Add trace event for updates to metaspace gc threshold
ehelin
parents:
22884
diff
changeset
|
487 |
Metaspace::tracer()->report_gc_threshold(capacity_until_GC, |
14790e4d53ec
8036698: Add trace event for updates to metaspace gc threshold
ehelin
parents:
22884
diff
changeset
|
488 |
new_capacity_until_GC, |
14790e4d53ec
8036698: Add trace event for updates to metaspace gc threshold
ehelin
parents:
22884
diff
changeset
|
489 |
MetaspaceGCThresholdUpdater::ComputeNewSize); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
490 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
491 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
492 |
|
49980 | 493 |
|
49389
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49386
diff
changeset
|
494 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
495 |
////// Metaspace methods ///// |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
496 |
|
47802
18dccdc438d7
8189688: NMT: Report per-class load metadata information
zgu
parents:
47654
diff
changeset
|
497 |
|
49980 | 498 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
499 |
MetaWord* Metaspace::_compressed_class_space_base = NULL; |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
500 |
size_t Metaspace::_compressed_class_space_size = 0; |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
501 |
const MetaspaceTracer* Metaspace::_tracer = NULL; |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
502 |
bool Metaspace::_initialized = false; |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
503 |
size_t Metaspace::_commit_alignment = 0; |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
504 |
size_t Metaspace::_reserve_alignment = 0; |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
505 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
506 |
DEBUG_ONLY(bool Metaspace::_frozen = false;) |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
507 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
508 |
|
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
509 |
#ifdef _LP64 |
21188
d053e4e8f901
8024927: Nashorn performance regression with CompressedOops
coleenp
parents:
21186
diff
changeset
|
510 |
static const uint64_t UnscaledClassSpaceMax = (uint64_t(max_juint) + 1); |
d053e4e8f901
8024927: Nashorn performance regression with CompressedOops
coleenp
parents:
21186
diff
changeset
|
511 |
|
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
512 |
void Metaspace::set_narrow_klass_base_and_shift(address metaspace_base, address cds_base) { |
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46723
diff
changeset
|
513 |
assert(!DumpSharedSpaces, "narrow_klass is set by MetaspaceShared class."); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
514 |
// Figure out the narrow_klass_base and the narrow_klass_shift. The |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
515 |
// narrow_klass_base is the lower of the metaspace base and the cds base |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
516 |
// (if cds is enabled). The narrow_klass_shift depends on the distance |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
517 |
// between the lower base and higher address. |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
518 |
address lower_base; |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
519 |
address higher_address; |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25055
diff
changeset
|
520 |
#if INCLUDE_CDS |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
521 |
if (UseSharedSpaces) { |
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46723
diff
changeset
|
522 |
higher_address = MAX2((address)(cds_base + MetaspaceShared::core_spaces_size()), |
21188
d053e4e8f901
8024927: Nashorn performance regression with CompressedOops
coleenp
parents:
21186
diff
changeset
|
523 |
(address)(metaspace_base + compressed_class_space_size())); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
524 |
lower_base = MIN2(metaspace_base, cds_base); |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25055
diff
changeset
|
525 |
} else |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25055
diff
changeset
|
526 |
#endif |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25055
diff
changeset
|
527 |
{ |
21188
d053e4e8f901
8024927: Nashorn performance regression with CompressedOops
coleenp
parents:
21186
diff
changeset
|
528 |
higher_address = metaspace_base + compressed_class_space_size(); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
529 |
lower_base = metaspace_base; |
21188
d053e4e8f901
8024927: Nashorn performance regression with CompressedOops
coleenp
parents:
21186
diff
changeset
|
530 |
|
d053e4e8f901
8024927: Nashorn performance regression with CompressedOops
coleenp
parents:
21186
diff
changeset
|
531 |
uint64_t klass_encoding_max = UnscaledClassSpaceMax << LogKlassAlignmentInBytes; |
d053e4e8f901
8024927: Nashorn performance regression with CompressedOops
coleenp
parents:
21186
diff
changeset
|
532 |
// If compressed class space fits in lower 32G, we don't need a base. |
d053e4e8f901
8024927: Nashorn performance regression with CompressedOops
coleenp
parents:
21186
diff
changeset
|
533 |
if (higher_address <= (address)klass_encoding_max) { |
22551 | 534 |
lower_base = 0; // Effectively lower base is zero. |
21188
d053e4e8f901
8024927: Nashorn performance regression with CompressedOops
coleenp
parents:
21186
diff
changeset
|
535 |
} |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
536 |
} |
21188
d053e4e8f901
8024927: Nashorn performance regression with CompressedOops
coleenp
parents:
21186
diff
changeset
|
537 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
538 |
// We must prevent any metaspace object from being allocated directly at |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
539 |
// CompressedKlassPointers::base() - that would translate to a narrow Klass |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
540 |
// pointer of 0, which has a special meaning (invalid) (Note: that was |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
541 |
// never a problem in old metaspace, since every chunk was prefixed by its |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
542 |
// header, so allocation at position 0 in a chunk was never possible). |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
543 |
if (lower_base == metaspace_base) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
544 |
lower_base -= os::vm_page_size(); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
545 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
546 |
|
54780
f8d182aedc92
8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
54623
diff
changeset
|
547 |
CompressedKlassPointers::set_base(lower_base); |
21188
d053e4e8f901
8024927: Nashorn performance regression with CompressedOops
coleenp
parents:
21186
diff
changeset
|
548 |
|
47599
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
549 |
// CDS uses LogKlassAlignmentInBytes for narrow_klass_shift. See |
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
550 |
// MetaspaceShared::initialize_dumptime_shared_and_meta_spaces() for |
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
551 |
// how dump time narrow_klass_shift is set. Although, CDS can work |
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
552 |
// with zero-shift mode also, to be consistent with AOT it uses |
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
553 |
// LogKlassAlignmentInBytes for klass shift so archived java heap objects |
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
554 |
// can be used at same time as AOT code. |
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
555 |
if (!UseSharedSpaces |
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
556 |
&& (uint64_t)(higher_address - lower_base) <= UnscaledClassSpaceMax) { |
54780
f8d182aedc92
8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
54623
diff
changeset
|
557 |
CompressedKlassPointers::set_shift(0); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
558 |
} else { |
54780
f8d182aedc92
8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
54623
diff
changeset
|
559 |
CompressedKlassPointers::set_shift(LogKlassAlignmentInBytes); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
560 |
} |
42650 | 561 |
AOTLoader::set_narrow_klass_shift(); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
562 |
} |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
563 |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25055
diff
changeset
|
564 |
#if INCLUDE_CDS |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
565 |
// Return TRUE if the specified metaspace_base and cds_base are close enough |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
566 |
// to work with compressed klass pointers. |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
567 |
bool Metaspace::can_use_cds_with_metaspace_addr(char* metaspace_base, address cds_base) { |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
568 |
assert(cds_base != 0 && UseSharedSpaces, "Only use with CDS"); |
19979
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
19546
diff
changeset
|
569 |
assert(UseCompressedClassPointers, "Only use with CompressedKlassPtrs"); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
570 |
address lower_base = MIN2((address)metaspace_base, cds_base); |
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46723
diff
changeset
|
571 |
address higher_address = MAX2((address)(cds_base + MetaspaceShared::core_spaces_size()), |
21188
d053e4e8f901
8024927: Nashorn performance regression with CompressedOops
coleenp
parents:
21186
diff
changeset
|
572 |
(address)(metaspace_base + compressed_class_space_size())); |
21518
067dd7967128
8027616: Off by one error in putback for compressed oops nashorn performance improvement
coleenp
parents:
21189
diff
changeset
|
573 |
return ((uint64_t)(higher_address - lower_base) <= UnscaledClassSpaceMax); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
574 |
} |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25055
diff
changeset
|
575 |
#endif |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
576 |
|
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
577 |
// Try to allocate the metaspace at the requested addr. |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
578 |
void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, address cds_base) { |
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46723
diff
changeset
|
579 |
assert(!DumpSharedSpaces, "compress klass space is allocated by MetaspaceShared class."); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
580 |
assert(using_class_space(), "called improperly"); |
19979
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
19546
diff
changeset
|
581 |
assert(UseCompressedClassPointers, "Only use with CompressedKlassPtrs"); |
21188
d053e4e8f901
8024927: Nashorn performance regression with CompressedOops
coleenp
parents:
21186
diff
changeset
|
582 |
assert(compressed_class_space_size() < KlassEncodingMetaspaceMax, |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
583 |
"Metaspace size is too big"); |
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
584 |
assert_is_aligned(requested_addr, _reserve_alignment); |
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
585 |
assert_is_aligned(cds_base, _reserve_alignment); |
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
586 |
assert_is_aligned(compressed_class_space_size(), _reserve_alignment); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
587 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
588 |
// Don't use large pages for the class space. |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
589 |
bool large_pages = false; |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
590 |
|
39229
8bfc00dd44b6
8159056: [aix] Compressed class space not allocated in lower regions
goetz
parents:
37267
diff
changeset
|
591 |
#if !(defined(AARCH64) || defined(AIX)) |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
592 |
ReservedSpace rs = ReservedSpace(compressed_class_space_size(), |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
593 |
_reserve_alignment, |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
594 |
large_pages, |
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28163
diff
changeset
|
595 |
requested_addr); |
29180 | 596 |
#else // AARCH64 |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
597 |
ReservedSpace rs; |
29180 | 598 |
|
599 |
// Our compressed klass pointers may fit nicely into the lower 32 |
|
600 |
// bits. |
|
601 |
if ((uint64_t)requested_addr + compressed_class_space_size() < 4*G) { |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
602 |
rs = ReservedSpace(compressed_class_space_size(), |
39229
8bfc00dd44b6
8159056: [aix] Compressed class space not allocated in lower regions
goetz
parents:
37267
diff
changeset
|
603 |
_reserve_alignment, |
8bfc00dd44b6
8159056: [aix] Compressed class space not allocated in lower regions
goetz
parents:
37267
diff
changeset
|
604 |
large_pages, |
8bfc00dd44b6
8159056: [aix] Compressed class space not allocated in lower regions
goetz
parents:
37267
diff
changeset
|
605 |
requested_addr); |
29180 | 606 |
} |
607 |
||
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
608 |
if (! rs.is_reserved()) { |
39229
8bfc00dd44b6
8159056: [aix] Compressed class space not allocated in lower regions
goetz
parents:
37267
diff
changeset
|
609 |
// Aarch64: Try to align metaspace so that we can decode a compressed |
8bfc00dd44b6
8159056: [aix] Compressed class space not allocated in lower regions
goetz
parents:
37267
diff
changeset
|
610 |
// klass with a single MOVK instruction. We can do this iff the |
29180 | 611 |
// compressed class base is a multiple of 4G. |
39229
8bfc00dd44b6
8159056: [aix] Compressed class space not allocated in lower regions
goetz
parents:
37267
diff
changeset
|
612 |
// Aix: Search for a place where we can find memory. If we need to load |
8bfc00dd44b6
8159056: [aix] Compressed class space not allocated in lower regions
goetz
parents:
37267
diff
changeset
|
613 |
// the base, 4G alignment is helpful, too. |
8bfc00dd44b6
8159056: [aix] Compressed class space not allocated in lower regions
goetz
parents:
37267
diff
changeset
|
614 |
size_t increment = AARCH64_ONLY(4*)G; |
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
615 |
for (char *a = align_up(requested_addr, increment); |
29180 | 616 |
a < (char*)(1024*G); |
39229
8bfc00dd44b6
8159056: [aix] Compressed class space not allocated in lower regions
goetz
parents:
37267
diff
changeset
|
617 |
a += increment) { |
8bfc00dd44b6
8159056: [aix] Compressed class space not allocated in lower regions
goetz
parents:
37267
diff
changeset
|
618 |
if (a == (char *)(32*G)) { |
8bfc00dd44b6
8159056: [aix] Compressed class space not allocated in lower regions
goetz
parents:
37267
diff
changeset
|
619 |
// Go faster from here on. Zero-based is no longer possible. |
8bfc00dd44b6
8159056: [aix] Compressed class space not allocated in lower regions
goetz
parents:
37267
diff
changeset
|
620 |
increment = 4*G; |
8bfc00dd44b6
8159056: [aix] Compressed class space not allocated in lower regions
goetz
parents:
37267
diff
changeset
|
621 |
} |
29180 | 622 |
|
623 |
#if INCLUDE_CDS |
|
624 |
if (UseSharedSpaces |
|
625 |
&& ! can_use_cds_with_metaspace_addr(a, cds_base)) { |
|
626 |
// We failed to find an aligned base that will reach. Fall |
|
627 |
// back to using our requested addr. |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
628 |
rs = ReservedSpace(compressed_class_space_size(), |
29180 | 629 |
_reserve_alignment, |
630 |
large_pages, |
|
29187 | 631 |
requested_addr); |
29180 | 632 |
break; |
633 |
} |
|
634 |
#endif |
|
635 |
||
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
636 |
rs = ReservedSpace(compressed_class_space_size(), |
29180 | 637 |
_reserve_alignment, |
638 |
large_pages, |
|
29187 | 639 |
a); |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
640 |
if (rs.is_reserved()) |
29180 | 641 |
break; |
642 |
} |
|
643 |
} |
|
644 |
||
645 |
#endif // AARCH64 |
|
646 |
||
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
647 |
if (!rs.is_reserved()) { |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25055
diff
changeset
|
648 |
#if INCLUDE_CDS |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
649 |
if (UseSharedSpaces) { |
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
650 |
size_t increment = align_up(1*G, _reserve_alignment); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
651 |
|
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
652 |
// Keep trying to allocate the metaspace, increasing the requested_addr |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
653 |
// by 1GB each time, until we reach an address that will no longer allow |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
654 |
// use of CDS with compressed klass pointers. |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
655 |
char *addr = requested_addr; |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
656 |
while (!rs.is_reserved() && (addr + increment > addr) && |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
657 |
can_use_cds_with_metaspace_addr(addr + increment, cds_base)) { |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
658 |
addr = addr + increment; |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
659 |
rs = ReservedSpace(compressed_class_space_size(), |
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28163
diff
changeset
|
660 |
_reserve_alignment, large_pages, addr); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
661 |
} |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
662 |
} |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25055
diff
changeset
|
663 |
#endif |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
664 |
// If no successful allocation then try to allocate the space anywhere. If |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
665 |
// that fails then OOM doom. At this point we cannot try allocating the |
19979
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
19546
diff
changeset
|
666 |
// metaspace as if UseCompressedClassPointers is off because too much |
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
19546
diff
changeset
|
667 |
// initialization has happened that depends on UseCompressedClassPointers. |
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
19546
diff
changeset
|
668 |
// So, UseCompressedClassPointers cannot be turned off at this point. |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
669 |
if (!rs.is_reserved()) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
670 |
rs = ReservedSpace(compressed_class_space_size(), |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
671 |
_reserve_alignment, large_pages); |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
672 |
if (!rs.is_reserved()) { |
29800
fa5f7a2bf717
8076073: shared: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
29697
diff
changeset
|
673 |
vm_exit_during_initialization(err_msg("Could not allocate metaspace: " SIZE_FORMAT " bytes", |
21188
d053e4e8f901
8024927: Nashorn performance regression with CompressedOops
coleenp
parents:
21186
diff
changeset
|
674 |
compressed_class_space_size())); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
675 |
} |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
676 |
} |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
677 |
} |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
678 |
|
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
679 |
// If we got here then the metaspace got allocated. |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
680 |
MemTracker::record_virtual_memory_type((address)rs.base(), mtClass); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
681 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
682 |
_compressed_class_space_base = (MetaWord*)rs.base(); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
683 |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25055
diff
changeset
|
684 |
#if INCLUDE_CDS |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
685 |
// Verify that we can use shared spaces. Otherwise, turn off CDS. |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
686 |
if (UseSharedSpaces && !can_use_cds_with_metaspace_addr(rs.base(), cds_base)) { |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
687 |
FileMapInfo::stop_sharing_and_unmap( |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
688 |
"Could not allocate metaspace at a compatible address"); |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
689 |
} |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25055
diff
changeset
|
690 |
#endif |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
691 |
set_narrow_klass_base_and_shift((address)rs.base(), |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
692 |
UseSharedSpaces ? (address)cds_base : 0); |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
693 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
694 |
initialize_class_space(rs); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
695 |
|
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46674
diff
changeset
|
696 |
LogTarget(Trace, gc, metaspace) lt; |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46674
diff
changeset
|
697 |
if (lt.is_enabled()) { |
35061 | 698 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46674
diff
changeset
|
699 |
LogStream ls(lt); |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46674
diff
changeset
|
700 |
print_compressed_class_space(&ls, requested_addr); |
31335
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
31028
diff
changeset
|
701 |
} |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
31028
diff
changeset
|
702 |
} |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
31028
diff
changeset
|
703 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
704 |
// For UseCompressedClassPointers the class space is reserved above the top of |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
705 |
// the Java heap. The argument passed in is at the base of the compressed space. |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
706 |
void Metaspace::initialize_class_space(ReservedSpace rs) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
707 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
708 |
// The reserved space size may be bigger because of alignment, esp with UseLargePages |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
709 |
assert(rs.size() >= CompressedClassSpaceSize, |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
710 |
SIZE_FORMAT " != " SIZE_FORMAT, rs.size(), CompressedClassSpaceSize); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
711 |
assert(using_class_space(), "Must be using class space"); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
712 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
713 |
VirtualSpaceList* vsl = new VirtualSpaceList("class space list", rs, CommitLimiter::globalLimiter()); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
714 |
VirtualSpaceList::set_vslist_class(vsl); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
715 |
ChunkManager* cm = new ChunkManager("class space chunk manager", vsl); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
716 |
ChunkManager::set_chunkmanager_class(cm); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
717 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
718 |
} |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
719 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
720 |
|
31335
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
31028
diff
changeset
|
721 |
void Metaspace::print_compressed_class_space(outputStream* st, const char* requested_addr) { |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
31028
diff
changeset
|
722 |
st->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: %d", |
54780
f8d182aedc92
8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
54623
diff
changeset
|
723 |
p2i(CompressedKlassPointers::base()), CompressedKlassPointers::shift()); |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
724 |
if (Metaspace::using_class_space()) { |
31335
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
31028
diff
changeset
|
725 |
st->print("Compressed class space size: " SIZE_FORMAT " Address: " PTR_FORMAT, |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
726 |
compressed_class_space_size(), p2i(compressed_class_space_base())); |
31335
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
31028
diff
changeset
|
727 |
if (requested_addr != 0) { |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
31028
diff
changeset
|
728 |
st->print(" Req Addr: " PTR_FORMAT, p2i(requested_addr)); |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
31028
diff
changeset
|
729 |
} |
60081f497e75
8035074: hs_err improvement: Add time zone information in the hs_err file
coleenp
parents:
31028
diff
changeset
|
730 |
st->cr(); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
731 |
} |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
732 |
} |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
733 |
|
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
734 |
#endif |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
735 |
|
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
736 |
void Metaspace::ergo_initialize() { |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
737 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
738 |
// Must happen before using any setting from Settings::--- |
58333 | 739 |
metaspace::Settings::ergo_initialize(); |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
740 |
|
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
741 |
if (DumpSharedSpaces) { |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
742 |
// Using large pages when dumping the shared archive is currently not implemented. |
54983
81becad91321
8224203: Remove need to specify type when using FLAG_SET macros
stefank
parents:
54927
diff
changeset
|
743 |
FLAG_SET_ERGO(UseLargePagesInMetaspace, false); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
744 |
} |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
745 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
746 |
size_t page_size = os::vm_page_size(); |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
747 |
if (UseLargePages && UseLargePagesInMetaspace) { |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
748 |
page_size = os::large_page_size(); |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
749 |
} |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
750 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
751 |
// Commit alignment: (I would rather hide this since this is an implementation detail but we need it |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
752 |
// when calculating the gc threshold). |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
753 |
_commit_alignment = metaspace::Settings::commit_granule_bytes(); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
754 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
755 |
// Reserve alignment: all Metaspace memory mappings are to be aligned to the size of a root chunk. |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
756 |
_reserve_alignment = MAX2(page_size, (size_t)metaspace::chklvl::MAX_CHUNK_BYTE_SIZE); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
757 |
|
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
758 |
assert(is_aligned(_reserve_alignment, os::vm_allocation_granularity()), |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
759 |
"root chunk size must be a multiple of alloc granularity"); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
760 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
761 |
// Do not use FLAG_SET_ERGO to update MaxMetaspaceSize, since this will |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
762 |
// override if MaxMetaspaceSize was set on the command line or not. |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
763 |
// This information is needed later to conform to the specification of the |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
764 |
// java.lang.management.MemoryUsage API. |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
765 |
// |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
766 |
// Ideally, we would be able to set the default value of MaxMetaspaceSize in |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
767 |
// globals.hpp to the aligned value, but this is not possible, since the |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
768 |
// alignment depends on other flags being parsed. |
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
769 |
MaxMetaspaceSize = align_down_bounded(MaxMetaspaceSize, _reserve_alignment); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
770 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
771 |
if (MetaspaceSize > MaxMetaspaceSize) { |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
772 |
MetaspaceSize = MaxMetaspaceSize; |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
773 |
} |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
774 |
|
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
775 |
MetaspaceSize = align_down_bounded(MetaspaceSize, _commit_alignment); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
776 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
777 |
assert(MetaspaceSize <= MaxMetaspaceSize, "MetaspaceSize should be limited by MaxMetaspaceSize"); |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
778 |
|
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
779 |
MinMetaspaceExpansion = align_down_bounded(MinMetaspaceExpansion, _commit_alignment); |
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
780 |
MaxMetaspaceExpansion = align_down_bounded(MaxMetaspaceExpansion, _commit_alignment); |
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
781 |
|
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
782 |
CompressedClassSpaceSize = align_down_bounded(CompressedClassSpaceSize, _reserve_alignment); |
47654
dbd1f4f276ba
8087291: InitialBootClassLoaderMetaspaceSize and CompressedClassSpaceSize should be checked consistent from MaxMetaspaceSize
ysuenaga
parents:
47634
diff
changeset
|
783 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
784 |
// Note: InitialBootClassLoaderMetaspaceSize is an old parameter which is used to determine the chunk size |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
785 |
// of the first non-class chunk handed to the boot class loader. See metaspace/chunkAllocSequence.hpp. |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
786 |
size_t min_metaspace_sz = align_up(InitialBootClassLoaderMetaspaceSize, _reserve_alignment); |
47654
dbd1f4f276ba
8087291: InitialBootClassLoaderMetaspaceSize and CompressedClassSpaceSize should be checked consistent from MaxMetaspaceSize
ysuenaga
parents:
47634
diff
changeset
|
787 |
if (UseCompressedClassPointers) { |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
788 |
if (min_metaspace_sz >= MaxMetaspaceSize) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
789 |
vm_exit_during_initialization("MaxMetaspaceSize is too small."); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
790 |
} else if ((min_metaspace_sz + CompressedClassSpaceSize) > MaxMetaspaceSize) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
791 |
FLAG_SET_ERGO(CompressedClassSpaceSize, MaxMetaspaceSize - min_metaspace_sz); |
47654
dbd1f4f276ba
8087291: InitialBootClassLoaderMetaspaceSize and CompressedClassSpaceSize should be checked consistent from MaxMetaspaceSize
ysuenaga
parents:
47634
diff
changeset
|
792 |
} |
dbd1f4f276ba
8087291: InitialBootClassLoaderMetaspaceSize and CompressedClassSpaceSize should be checked consistent from MaxMetaspaceSize
ysuenaga
parents:
47634
diff
changeset
|
793 |
} else if (min_metaspace_sz >= MaxMetaspaceSize) { |
54983
81becad91321
8224203: Remove need to specify type when using FLAG_SET macros
stefank
parents:
54927
diff
changeset
|
794 |
FLAG_SET_ERGO(InitialBootClassLoaderMetaspaceSize, |
47654
dbd1f4f276ba
8087291: InitialBootClassLoaderMetaspaceSize and CompressedClassSpaceSize should be checked consistent from MaxMetaspaceSize
ysuenaga
parents:
47634
diff
changeset
|
795 |
min_metaspace_sz); |
dbd1f4f276ba
8087291: InitialBootClassLoaderMetaspaceSize and CompressedClassSpaceSize should be checked consistent from MaxMetaspaceSize
ysuenaga
parents:
47634
diff
changeset
|
796 |
} |
dbd1f4f276ba
8087291: InitialBootClassLoaderMetaspaceSize and CompressedClassSpaceSize should be checked consistent from MaxMetaspaceSize
ysuenaga
parents:
47634
diff
changeset
|
797 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
798 |
_compressed_class_space_size = CompressedClassSpaceSize; |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
799 |
|
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
800 |
} |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
801 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
802 |
void Metaspace::global_initialize() { |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
803 |
MetaspaceGC::initialize(); // <- since we do not prealloc init chunks anymore is this still needed? |
24847
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
804 |
|
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46723
diff
changeset
|
805 |
#if INCLUDE_CDS |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
806 |
if (DumpSharedSpaces) { |
47599
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
807 |
MetaspaceShared::initialize_dumptime_shared_and_meta_spaces(); |
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46723
diff
changeset
|
808 |
} else if (UseSharedSpaces) { |
47599
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
809 |
// If any of the archived space fails to map, UseSharedSpaces |
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
810 |
// is reset to false. Fall through to the |
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
811 |
// (!DumpSharedSpaces && !UseSharedSpaces) case to set up class |
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
812 |
// metaspace. |
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
813 |
MetaspaceShared::initialize_runtime_shared_and_meta_spaces(); |
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
814 |
} |
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
815 |
|
54927 | 816 |
if (DynamicDumpSharedSpaces && !UseSharedSpaces) { |
55348
d109188f6480
8224710: [TESTBUG] dynamicArchive/ExcludedClasses.java test failed in tier6 testing on Windows
ccheung
parents:
54983
diff
changeset
|
817 |
vm_exit_during_initialization("DynamicDumpSharedSpaces is unsupported when base CDS archive is not loaded", NULL); |
54927 | 818 |
} |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
819 |
#endif // INCLUDE_CDS |
54927 | 820 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
821 |
// Initialize class space: |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
822 |
if (CDS_ONLY(!DumpSharedSpaces && !UseSharedSpaces) NOT_CDS(true)) { |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
823 |
#ifdef _LP64 |
47599
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
824 |
if (using_class_space()) { |
58015
dd84de796f2c
8224815: Remove non-GC uses of CollectedHeap::is_in_reserved()
eosterlund
parents:
55586
diff
changeset
|
825 |
char* base = (char*)align_up(CompressedOops::end(), _reserve_alignment); |
58839
d888a9d9f9a5
Add experimental switch to force ccs to a specific address
stuefe
parents:
58646
diff
changeset
|
826 |
if (ForceCompressedClassSpaceStartAddress != 0) { |
d888a9d9f9a5
Add experimental switch to force ccs to a specific address
stuefe
parents:
58646
diff
changeset
|
827 |
base = (char*)ForceCompressedClassSpaceStartAddress; |
d888a9d9f9a5
Add experimental switch to force ccs to a specific address
stuefe
parents:
58646
diff
changeset
|
828 |
log_debug(gc, metaspace)("Forcing class space start address to " PTR_FORMAT ".", p2i(base)); |
d888a9d9f9a5
Add experimental switch to force ccs to a specific address
stuefe
parents:
58646
diff
changeset
|
829 |
} |
31362
8957ccbb5821
8098821: Crash in system dictionary initialization with shared strings
coleenp
parents:
31345
diff
changeset
|
830 |
allocate_metaspace_compressed_klass_ptrs(base, 0); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
831 |
} |
47599
0fb1d501c408
8174986: CDS archived java heap region may not compatible with AOT
jiangli
parents:
47553
diff
changeset
|
832 |
#endif // _LP64 |
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46723
diff
changeset
|
833 |
} |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
834 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
835 |
// Initialize non-class virtual space list, and its chunk manager: |
58333 | 836 |
VirtualSpaceList* vsl = new VirtualSpaceList("non-class virtualspacelist", CommitLimiter::globalLimiter()); |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
837 |
VirtualSpaceList::set_vslist_nonclass(vsl); |
58333 | 838 |
ChunkManager* cm = new ChunkManager("non-class chunkmanager", vsl); |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
839 |
ChunkManager::set_chunkmanager_nonclass(cm); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
840 |
|
23465
14790e4d53ec
8036698: Add trace event for updates to metaspace gc threshold
ehelin
parents:
22884
diff
changeset
|
841 |
_tracer = new MetaspaceTracer(); |
55586
014c8cd323af
8227032: MetaspaceUtils::print_report crashes when called before initialization
stuefe
parents:
55576
diff
changeset
|
842 |
|
014c8cd323af
8227032: MetaspaceUtils::print_report crashes when called before initialization
stuefe
parents:
55576
diff
changeset
|
843 |
_initialized = true; |
014c8cd323af
8227032: MetaspaceUtils::print_report crashes when called before initialization
stuefe
parents:
55576
diff
changeset
|
844 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
845 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
846 |
|
24847
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
847 |
void Metaspace::post_initialize() { |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
848 |
MetaspaceGC::post_initialize(); |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
849 |
} |
37c354b113fe
8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
24665
diff
changeset
|
850 |
|
20729 | 851 |
MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size, |
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46723
diff
changeset
|
852 |
MetaspaceObj::Type type, TRAPS) { |
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46723
diff
changeset
|
853 |
assert(!_frozen, "sanity"); |
52468
e0fd97beab7e
8213250: CDS archive creation aborts due to metaspace object allocation failure
iklam
parents:
52363
diff
changeset
|
854 |
assert(!(DumpSharedSpaces && THREAD->is_VM_thread()), "sanity"); |
e0fd97beab7e
8213250: CDS archive creation aborts due to metaspace object allocation failure
iklam
parents:
52363
diff
changeset
|
855 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
856 |
if (HAS_PENDING_EXCEPTION) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
857 |
assert(false, "Should not allocate with exception pending"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
858 |
return NULL; // caller does a CHECK_NULL too |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
859 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
860 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
861 |
assert(loader_data != NULL, "Should never pass around a NULL loader_data. " |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
862 |
"ClassLoaderData::the_null_class_loader_data() should have been used."); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
863 |
|
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
864 |
Metaspace::MetadataType mdtype = (type == MetaspaceObj::ClassType) ? Metaspace::ClassType : Metaspace::NonClassType; |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
865 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
866 |
// Try to allocate metadata. |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
867 |
MetaWord* result = loader_data->metaspace_non_null()->allocate(word_size, mdtype); |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
868 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
869 |
if (result == NULL) { |
23468
6bb416a59349
8036699: Add trace event when a metaspace allocation fails
ehelin
parents:
23465
diff
changeset
|
870 |
tracer()->report_metaspace_allocation_failure(loader_data, word_size, type, mdtype); |
6bb416a59349
8036699: Add trace event when a metaspace allocation fails
ehelin
parents:
23465
diff
changeset
|
871 |
|
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
872 |
// Allocation failed. |
52468
e0fd97beab7e
8213250: CDS archive creation aborts due to metaspace object allocation failure
iklam
parents:
52363
diff
changeset
|
873 |
if (is_init_completed()) { |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
874 |
// Only start a GC if the bootstrapping has completed. |
52468
e0fd97beab7e
8213250: CDS archive creation aborts due to metaspace object allocation failure
iklam
parents:
52363
diff
changeset
|
875 |
// Try to clean out some heap memory and retry. This can prevent premature |
e0fd97beab7e
8213250: CDS archive creation aborts due to metaspace object allocation failure
iklam
parents:
52363
diff
changeset
|
876 |
// expansion of the metaspace. |
49045
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48971
diff
changeset
|
877 |
result = Universe::heap()->satisfy_failed_metadata_allocation(loader_data, word_size, mdtype); |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
878 |
} |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
879 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
880 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
881 |
if (result == NULL) { |
49652
a74836b05c28
8200078: [Graal] runtime/appcds/GraalWithLimitedMetaspace.java crashes in visit_all_interfaces
ccheung
parents:
49601
diff
changeset
|
882 |
if (DumpSharedSpaces) { |
a74836b05c28
8200078: [Graal] runtime/appcds/GraalWithLimitedMetaspace.java crashes in visit_all_interfaces
ccheung
parents:
49601
diff
changeset
|
883 |
// CDS dumping keeps loading classes, so if we hit an OOM we probably will keep hitting OOM. |
a74836b05c28
8200078: [Graal] runtime/appcds/GraalWithLimitedMetaspace.java crashes in visit_all_interfaces
ccheung
parents:
49601
diff
changeset
|
884 |
// We should abort to avoid generating a potentially bad archive. |
52300
9e29d8388514
8209598: Clean up how messages are printed when CDS aborts start-up
ccheung
parents:
52014
diff
changeset
|
885 |
vm_exit_during_cds_dumping(err_msg("Failed allocating metaspace object type %s of size " SIZE_FORMAT ". CDS dump aborted.", |
9e29d8388514
8209598: Clean up how messages are printed when CDS aborts start-up
ccheung
parents:
52014
diff
changeset
|
886 |
MetaspaceObj::type_name(type), word_size * BytesPerWord), |
9e29d8388514
8209598: Clean up how messages are printed when CDS aborts start-up
ccheung
parents:
52014
diff
changeset
|
887 |
err_msg("Please increase MaxMetaspaceSize (currently " SIZE_FORMAT " bytes).", MaxMetaspaceSize)); |
49652
a74836b05c28
8200078: [Graal] runtime/appcds/GraalWithLimitedMetaspace.java crashes in visit_all_interfaces
ccheung
parents:
49601
diff
changeset
|
888 |
} |
51070 | 889 |
report_metadata_oome(loader_data, word_size, type, mdtype, THREAD); |
890 |
assert(HAS_PENDING_EXCEPTION, "sanity"); |
|
891 |
return NULL; |
|
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
892 |
} |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
893 |
|
20729 | 894 |
// Zero initialize. |
35898
ddc274f0052f
8145628: hotspot metadata classes shouldn't use HeapWordSize or heap related macros like align_object_size
coleenp
parents:
35231
diff
changeset
|
895 |
Copy::fill_to_words((HeapWord*)result, word_size, 0); |
20729 | 896 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
897 |
log_trace(metaspace)("Metaspace::allocate: type %d return " PTR_FORMAT ".", (int)type, p2i(result)); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
898 |
|
20729 | 899 |
return result; |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
900 |
} |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
901 |
|
23469
0a4d02776968
8036701: Add trace event when a metaspace throws out of memory error
ehelin
parents:
23468
diff
changeset
|
902 |
void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_size, MetaspaceObj::Type type, MetadataType mdtype, TRAPS) { |
0a4d02776968
8036701: Add trace event when a metaspace throws out of memory error
ehelin
parents:
23468
diff
changeset
|
903 |
tracer()->report_metadata_oom(loader_data, word_size, type, mdtype); |
0a4d02776968
8036701: Add trace event when a metaspace throws out of memory error
ehelin
parents:
23468
diff
changeset
|
904 |
|
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
905 |
// If result is still null, we are out of memory. |
50372 | 906 |
Log(gc, metaspace, freelist, oom) log; |
41727
f1658e76a682
8164921: Memory leaked when instrumentation.retransformClasses() is called repeatedly
coleenp
parents:
41182
diff
changeset
|
907 |
if (log.is_info()) { |
f1658e76a682
8164921: Memory leaked when instrumentation.retransformClasses() is called repeatedly
coleenp
parents:
41182
diff
changeset
|
908 |
log.info("Metaspace (%s) allocation failed for size " SIZE_FORMAT, |
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
909 |
metaspace::is_class(mdtype) ? "class" : "data", word_size); |
35061 | 910 |
ResourceMark rm; |
46723
5c418c5fcade
8185262: Keep default logging for Metaspace OOM short and concise
stuefe
parents:
46709
diff
changeset
|
911 |
if (log.is_debug()) { |
5c418c5fcade
8185262: Keep default logging for Metaspace OOM short and concise
stuefe
parents:
46709
diff
changeset
|
912 |
if (loader_data->metaspace_or_null() != NULL) { |
5c418c5fcade
8185262: Keep default logging for Metaspace OOM short and concise
stuefe
parents:
46709
diff
changeset
|
913 |
LogStream ls(log.debug()); |
49348
fde3feaaa4ed
8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents:
49045
diff
changeset
|
914 |
loader_data->print_value_on(&ls); |
46723
5c418c5fcade
8185262: Keep default logging for Metaspace OOM short and concise
stuefe
parents:
46709
diff
changeset
|
915 |
} |
5c418c5fcade
8185262: Keep default logging for Metaspace OOM short and concise
stuefe
parents:
46709
diff
changeset
|
916 |
} |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46674
diff
changeset
|
917 |
LogStream ls(log.info()); |
49980 | 918 |
// In case of an OOM, log out a short but still useful report. |
919 |
MetaspaceUtils::print_basic_report(&ls, 0); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
920 |
} |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
921 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
922 |
// Which limit did we hit? CompressedClassSpaceSize or MaxMetaspaceSize? |
21186
db851068711f
8026822: metaspace/flags/maxMetaspaceSize throws OOM of unexpected type.java.lang.OutOfMemoryError: Compressed class space
hseigel
parents:
20733
diff
changeset
|
923 |
bool out_of_compressed_class_space = false; |
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
924 |
if (metaspace::is_class(mdtype)) { |
49401
0c71baee49a7
8199431: Split up class Metaspace into a static and a non-static part
stuefe
parents:
49395
diff
changeset
|
925 |
ClassLoaderMetaspace* metaspace = loader_data->metaspace_non_null(); |
21186
db851068711f
8026822: metaspace/flags/maxMetaspaceSize throws OOM of unexpected type.java.lang.OutOfMemoryError: Compressed class space
hseigel
parents:
20733
diff
changeset
|
926 |
out_of_compressed_class_space = |
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58839
diff
changeset
|
927 |
MetaspaceUtils::committed_bytes(Metaspace::ClassType) + |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
928 |
// TODO: Okay this is just cheesy. |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
929 |
// Of course this may fail and return incorrect results. |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
930 |
// Think this over - we need some clean way to remember which limit |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
931 |
// exactly we hit during an allocation. Some sort of allocation context structure? |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
932 |
align_up(word_size * BytesPerWord, 4 * M) > |
21186
db851068711f
8026822: metaspace/flags/maxMetaspaceSize throws OOM of unexpected type.java.lang.OutOfMemoryError: Compressed class space
hseigel
parents:
20733
diff
changeset
|
933 |
CompressedClassSpaceSize; |
db851068711f
8026822: metaspace/flags/maxMetaspaceSize throws OOM of unexpected type.java.lang.OutOfMemoryError: Compressed class space
hseigel
parents:
20733
diff
changeset
|
934 |
} |
db851068711f
8026822: metaspace/flags/maxMetaspaceSize throws OOM of unexpected type.java.lang.OutOfMemoryError: Compressed class space
hseigel
parents:
20733
diff
changeset
|
935 |
|
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
936 |
// -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support |
21186
db851068711f
8026822: metaspace/flags/maxMetaspaceSize throws OOM of unexpected type.java.lang.OutOfMemoryError: Compressed class space
hseigel
parents:
20733
diff
changeset
|
937 |
const char* space_string = out_of_compressed_class_space ? |
db851068711f
8026822: metaspace/flags/maxMetaspaceSize throws OOM of unexpected type.java.lang.OutOfMemoryError: Compressed class space
hseigel
parents:
20733
diff
changeset
|
938 |
"Compressed class space" : "Metaspace"; |
db851068711f
8026822: metaspace/flags/maxMetaspaceSize throws OOM of unexpected type.java.lang.OutOfMemoryError: Compressed class space
hseigel
parents:
20733
diff
changeset
|
939 |
|
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
940 |
report_java_out_of_memory(space_string); |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
941 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
942 |
if (JvmtiExport::should_post_resource_exhausted()) { |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
943 |
JvmtiExport::post_resource_exhausted( |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
944 |
JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR, |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
945 |
space_string); |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
946 |
} |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
947 |
|
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
948 |
if (!is_init_completed()) { |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
949 |
vm_exit_during_initialization("OutOfMemoryError", space_string); |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
950 |
} |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
951 |
|
21186
db851068711f
8026822: metaspace/flags/maxMetaspaceSize throws OOM of unexpected type.java.lang.OutOfMemoryError: Compressed class space
hseigel
parents:
20733
diff
changeset
|
952 |
if (out_of_compressed_class_space) { |
20406
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
953 |
THROW_OOP(Universe::out_of_memory_error_class_metaspace()); |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
954 |
} else { |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
955 |
THROW_OOP(Universe::out_of_memory_error_metaspace()); |
934f0b12daa9
8024547: MaxMetaspaceSize should limit the committed memory used by the metaspaces
stefank
parents:
20306
diff
changeset
|
956 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
957 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
958 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
959 |
void Metaspace::purge() { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
960 |
ChunkManager* cm = ChunkManager::chunkmanager_nonclass(); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
961 |
if (cm != NULL) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
962 |
cm->wholesale_reclaim(); |
23468
6bb416a59349
8036699: Add trace event when a metaspace allocation fails
ehelin
parents:
23465
diff
changeset
|
963 |
} |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
964 |
if (using_class_space()) { |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
965 |
cm = ChunkManager::chunkmanager_class(); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
966 |
if (cm != NULL) { |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
967 |
cm->wholesale_reclaim(); |
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
968 |
} |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18987
diff
changeset
|
969 |
} |
17101 | 970 |
} |
971 |
||
22201
9c2ccfa3a5fe
8029178: Parallel class loading test anonymous-simple gets SIGSEGV in Metaspace::contains
coleenp
parents:
21569
diff
changeset
|
972 |
bool Metaspace::contains(const void* ptr) { |
48794
ea0d0781c63c
8178351: Simplify MetaspaceShared::is_in_shared_space and MetaspaceObj::is_shared
iklam
parents:
48387
diff
changeset
|
973 |
if (MetaspaceShared::is_in_shared_metaspace(ptr)) { |
24457
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
24424
diff
changeset
|
974 |
return true; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
975 |
} |
46324
8764956ec928
8005165: Remove CPU-dependent code in self-patching vtables
iklam
parents:
42650
diff
changeset
|
976 |
return contains_non_shared(ptr); |
8764956ec928
8005165: Remove CPU-dependent code in self-patching vtables
iklam
parents:
42650
diff
changeset
|
977 |
} |
8764956ec928
8005165: Remove CPU-dependent code in self-patching vtables
iklam
parents:
42650
diff
changeset
|
978 |
|
8764956ec928
8005165: Remove CPU-dependent code in self-patching vtables
iklam
parents:
42650
diff
changeset
|
979 |
bool Metaspace::contains_non_shared(const void* ptr) { |
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
980 |
if (using_class_space() && VirtualSpaceList::vslist_class()->contains((MetaWord*)ptr)) { |
24457
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
24424
diff
changeset
|
981 |
return true; |
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
24424
diff
changeset
|
982 |
} |
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
24424
diff
changeset
|
983 |
|
58063
bdf136b8ae0e
Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
58015
diff
changeset
|
984 |
return VirtualSpaceList::vslist_nonclass()->contains((MetaWord*)ptr); |
49401
0c71baee49a7
8199431: Split up class Metaspace into a static and a non-static part
stuefe
parents:
49395
diff
changeset
|
985 |
} |