1 /*
2 * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
214
215 static const char* metadata_type_name(Metaspace::MetadataType mdtype);
216
217 static void print_compressed_class_space(outputStream* st, const char* requested_addr = 0) NOT_LP64({});
218
219 // Return TRUE only if UseCompressedClassPointers is True.
220 static bool using_class_space() {
221 return NOT_LP64(false) LP64_ONLY(UseCompressedClassPointers);
222 }
223
224 static bool is_class_space_allocation(MetadataType mdType) {
225 return mdType == ClassType && using_class_space();
226 }
227
228 };
229
230 // Manages the metaspace portion belonging to a class loader
231 class ClassLoaderMetaspace : public CHeapObj<mtClass> {
232 friend class CollectedHeap; // For expand_and_allocate()
233 friend class ZCollectedHeap; // For expand_and_allocate()
234 friend class Metaspace;
235 friend class MetaspaceUtils;
236 friend class metaspace::PrintCLDMetaspaceInfoClosure;
237 friend class VM_CollectForMetadataAllocation; // For expand_and_allocate()
238
239 private:
240
241 void initialize(Mutex* lock, Metaspace::MetaspaceType type);
242
243 // Initialize the first chunk for a Metaspace. Used for
244 // special cases such as the boot class loader, reflection
245 // class loader and anonymous class loader.
246 void initialize_first_chunk(Metaspace::MetaspaceType type, Metaspace::MetadataType mdtype);
247 metaspace::Metachunk* get_initialization_chunk(Metaspace::MetaspaceType type, Metaspace::MetadataType mdtype);
248
249 const Metaspace::MetaspaceType _space_type;
250 Mutex* const _lock;
251 metaspace::SpaceManager* _vsm;
252 metaspace::SpaceManager* _class_vsm;
253
|
1 /*
2 * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
214
215 static const char* metadata_type_name(Metaspace::MetadataType mdtype);
216
217 static void print_compressed_class_space(outputStream* st, const char* requested_addr = 0) NOT_LP64({});
218
219 // Return TRUE only if UseCompressedClassPointers is True.
220 static bool using_class_space() {
221 return NOT_LP64(false) LP64_ONLY(UseCompressedClassPointers);
222 }
223
224 static bool is_class_space_allocation(MetadataType mdType) {
225 return mdType == ClassType && using_class_space();
226 }
227
228 };
229
230 // Manages the metaspace portion belonging to a class loader
231 class ClassLoaderMetaspace : public CHeapObj<mtClass> {
232 friend class CollectedHeap; // For expand_and_allocate()
233 friend class ZCollectedHeap; // For expand_and_allocate()
234 friend class ShenandoahHeap; // For expand_and_allocate()
235 friend class Metaspace;
236 friend class MetaspaceUtils;
237 friend class metaspace::PrintCLDMetaspaceInfoClosure;
238 friend class VM_CollectForMetadataAllocation; // For expand_and_allocate()
239
240 private:
241
242 void initialize(Mutex* lock, Metaspace::MetaspaceType type);
243
244 // Initialize the first chunk for a Metaspace. Used for
245 // special cases such as the boot class loader, reflection
246 // class loader and anonymous class loader.
247 void initialize_first_chunk(Metaspace::MetaspaceType type, Metaspace::MetadataType mdtype);
248 metaspace::Metachunk* get_initialization_chunk(Metaspace::MetaspaceType type, Metaspace::MetadataType mdtype);
249
250 const Metaspace::MetaspaceType _space_type;
251 Mutex* const _lock;
252 metaspace::SpaceManager* _vsm;
253 metaspace::SpaceManager* _class_vsm;
254
|