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 *
218
219 static void print_compressed_class_space(outputStream* st, const char* requested_addr = 0) NOT_LP64({});
220
221 // Return TRUE only if UseCompressedClassPointers is True.
222 static bool using_class_space() {
223 return NOT_LP64(false) LP64_ONLY(UseCompressedClassPointers);
224 }
225
226 static bool is_class_space_allocation(MetadataType mdType) {
227 return mdType == ClassType && using_class_space();
228 }
229
230 static bool initialized() { return _initialized; }
231
232 };
233
234 // Manages the metaspace portion belonging to a class loader
235 class ClassLoaderMetaspace : public CHeapObj<mtClass> {
236 friend class CollectedHeap; // For expand_and_allocate()
237 friend class ZCollectedHeap; // For expand_and_allocate()
238 friend class Metaspace;
239 friend class MetaspaceUtils;
240 friend class metaspace::PrintCLDMetaspaceInfoClosure;
241 friend class VM_CollectForMetadataAllocation; // For expand_and_allocate()
242
243 private:
244
245 void initialize(Mutex* lock, Metaspace::MetaspaceType type);
246
247 // Initialize the first chunk for a Metaspace. Used for
248 // special cases such as the boot class loader, reflection
249 // class loader and anonymous class loader.
250 void initialize_first_chunk(Metaspace::MetaspaceType type, Metaspace::MetadataType mdtype);
251 metaspace::Metachunk* get_initialization_chunk(Metaspace::MetaspaceType type, Metaspace::MetadataType mdtype);
252
253 const Metaspace::MetaspaceType _space_type;
254 Mutex* const _lock;
255 metaspace::SpaceManager* _vsm;
256 metaspace::SpaceManager* _class_vsm;
257
|
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 *
218
219 static void print_compressed_class_space(outputStream* st, const char* requested_addr = 0) NOT_LP64({});
220
221 // Return TRUE only if UseCompressedClassPointers is True.
222 static bool using_class_space() {
223 return NOT_LP64(false) LP64_ONLY(UseCompressedClassPointers);
224 }
225
226 static bool is_class_space_allocation(MetadataType mdType) {
227 return mdType == ClassType && using_class_space();
228 }
229
230 static bool initialized() { return _initialized; }
231
232 };
233
234 // Manages the metaspace portion belonging to a class loader
235 class ClassLoaderMetaspace : public CHeapObj<mtClass> {
236 friend class CollectedHeap; // For expand_and_allocate()
237 friend class ZCollectedHeap; // For expand_and_allocate()
238 friend class ShenandoahHeap; // For expand_and_allocate()
239 friend class Metaspace;
240 friend class MetaspaceUtils;
241 friend class metaspace::PrintCLDMetaspaceInfoClosure;
242 friend class VM_CollectForMetadataAllocation; // For expand_and_allocate()
243
244 private:
245
246 void initialize(Mutex* lock, Metaspace::MetaspaceType type);
247
248 // Initialize the first chunk for a Metaspace. Used for
249 // special cases such as the boot class loader, reflection
250 // class loader and anonymous class loader.
251 void initialize_first_chunk(Metaspace::MetaspaceType type, Metaspace::MetadataType mdtype);
252 metaspace::Metachunk* get_initialization_chunk(Metaspace::MetaspaceType type, Metaspace::MetadataType mdtype);
253
254 const Metaspace::MetaspaceType _space_type;
255 Mutex* const _lock;
256 metaspace::SpaceManager* _vsm;
257 metaspace::SpaceManager* _class_vsm;
258
|