--- /dev/null 2019-07-25 13:07:35.456009699 +0200 +++ new/src/hotspot/share/memory/metaspace/constants.hpp 2019-07-25 15:30:08.853509816 +0200 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_MEMORY_METASPACE_CONSTANTS_HPP +#define SHARE_MEMORY_METASPACE_CONSTANTS_HPP + +#include "utilities/globalDefinitions.hpp" +#include "memory/metaspace/chunkLevel.hpp" + +namespace metaspace { + +// Constants to be used throughout metaspace + +namespace constants { + +// Granularity, in bytes, metaspace is committed with. +static const size_t commit_granule_bytes = K * 64; +static const size_t commit_granule_words = commit_granule_bytes * BytesPerWord; + + +// Whether or not commit new-born chunks thru after creation. +static const bool newborn_chunks_are_fully_committed = true; + +// When a chunk is handed out by the ChunkManager to a class loader, how much +// of a chunk should be committed up-front? +// Size in words. Must be a multiple of commit_granule_words. +// (Note: 0 is possible but inefficient, since it will cause the ClassLoaderMetaspace +// to commit the first granule right away anyway, so nothing is saved. +// chklvl::MAX_CHUNK_WORD_SIZE pretty much means every chunk is committed thru +// from the start. +static const size_t committed_words_on_fresh_chunks = commit_granule_bytes * 2; + +// The default size of a non-class VirtualSpaceNode (unless created differently). +// Must be a multiple of the root chunk size. +static const size_t virtual_space_node_default_size = chklvl::MAX_CHUNK_BYTE_SIZE * 4; + +static const size_t allocation_from_dictionary_limit = 4 * K; + +} // namespace constants + +} // namespace metaspace + +#endif // SHARE_MEMORY_METASPACE_BLOCKFREELIST_HPP