Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/memory/metaspace/metaspaceSettings.hpp
40957 views
1
/*
2
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3
* Copyright (c) 2020 SAP SE. All rights reserved.
4
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
*
6
* This code is free software; you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License version 2 only, as
8
* published by the Free Software Foundation.
9
*
10
* This code is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13
* version 2 for more details (a copy is included in the LICENSE file that
14
* accompanied this code).
15
*
16
* You should have received a copy of the GNU General Public License version
17
* 2 along with this work; if not, write to the Free Software Foundation,
18
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
*
20
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21
* or visit www.oracle.com if you need additional information or have any
22
* questions.
23
*
24
*/
25
26
#ifndef SHARE_MEMORY_METASPACE_METASPACESETTINGS_HPP
27
#define SHARE_MEMORY_METASPACE_METASPACESETTINGS_HPP
28
29
#include "memory/allocation.hpp"
30
#include "memory/metaspace/chunklevel.hpp"
31
#include "utilities/globalDefinitions.hpp"
32
33
namespace metaspace {
34
35
class Settings : public AllStatic {
36
37
// Granularity, in bytes, metaspace is committed with.
38
static size_t _commit_granule_bytes;
39
40
// Granularity, in words, metaspace is committed with.
41
static size_t _commit_granule_words;
42
43
// The default size of a VirtualSpaceNode, unless created with an explicitly specified size.
44
// Must be a multiple of the root chunk size.
45
// Increasing this value decreases the number of mappings used for metadata,
46
// at the cost of increased virtual size used for Metaspace (or, at least,
47
// coarser growth steps). Matters mostly for 32bit platforms due to limited
48
// address space.
49
// The default of two root chunks has been chosen on a whim but seems to work out okay
50
// (coming to a mapping size of 8m per node).
51
static const size_t _virtual_space_node_default_word_size = chunklevel::MAX_CHUNK_WORD_SIZE * 2;
52
53
// Alignment of the base address of a virtual space node
54
static const size_t _virtual_space_node_reserve_alignment_words = chunklevel::MAX_CHUNK_WORD_SIZE;
55
56
// When allocating from a chunk, if the remaining area in the chunk is too small to hold
57
// the requested size, we attempt to double the chunk size in place...
58
static const bool _enlarge_chunks_in_place = true;
59
60
// Whether or not chunks handed out to an arena start out fully committed;
61
// if true, this deactivates committing-on-demand (regardless of whether
62
// we uncommit free chunks).
63
static bool _new_chunks_are_fully_committed;
64
65
// If true, chunks equal or larger than a commit granule are uncommitted
66
// after being returned to the freelist.
67
static bool _uncommit_free_chunks;
68
69
// If true, metablock allocations are guarded and periodically checked.
70
DEBUG_ONLY(static bool _use_allocation_guard;)
71
72
// This enables or disables premature deallocation of metaspace allocated blocks. Using
73
// Metaspace::deallocate(), blocks can be returned prematurely (before the associated
74
// Arena dies, e.g. after class unloading) and can be reused by the arena.
75
// If disabled, those blocks will not be reused until the Arena dies.
76
// Note that premature deallocation is rare under normal circumstances.
77
// By default deallocation handling is enabled.
78
DEBUG_ONLY(static bool _handle_deallocations;)
79
80
public:
81
82
static size_t commit_granule_bytes() { return _commit_granule_bytes; }
83
static size_t commit_granule_words() { return _commit_granule_words; }
84
static bool new_chunks_are_fully_committed() { return _new_chunks_are_fully_committed; }
85
static size_t virtual_space_node_default_word_size() { return _virtual_space_node_default_word_size; }
86
static size_t virtual_space_node_reserve_alignment_words() { return _virtual_space_node_reserve_alignment_words; }
87
static bool enlarge_chunks_in_place() { return _enlarge_chunks_in_place; }
88
static bool uncommit_free_chunks() { return _uncommit_free_chunks; }
89
static bool use_allocation_guard() { return DEBUG_ONLY(_use_allocation_guard) NOT_DEBUG(false); }
90
static bool handle_deallocations() { return DEBUG_ONLY(_handle_deallocations) NOT_DEBUG(true); }
91
92
static void ergo_initialize();
93
94
static void print_on(outputStream* st);
95
96
};
97
98
} // namespace metaspace
99
100
#endif // SHARE_MEMORY_METASPACE_METASPACESETTINGS_HPP
101
102