8232650: ZGC: Add initialization hooks for OS specific code

Reviewed-by: pliden, eosterlund
This commit is contained in:
Stefan Karlsson 2019-10-28 11:26:53 +01:00
parent cc72a06c3b
commit ecb66d2c55
6 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 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.
*/
#include "precompiled.hpp"
#include "gc/z/zInitialize.hpp"
void ZInitialize::initialize_os() {
// Does nothing
}

View File

@ -29,6 +29,10 @@
#include <sys/mman.h>
#include <sys/types.h>
void ZVirtualMemoryManager::initialize_os() {
// Does nothing
}
static void unmap(uintptr_t start, size_t size) {
const int res = munmap((void*)start, size);
assert(res == 0, "Failed to unmap memory");

View File

@ -50,4 +50,6 @@ ZInitialize::ZInitialize(ZBarrierSet* barrier_set) {
ZTracer::initialize();
ZLargePages::initialize();
ZBarrierSet::set_barrier_set(barrier_set);
initialize_os();
}

View File

@ -29,6 +29,9 @@
class ZBarrierSet;
class ZInitialize {
private:
void initialize_os();
public:
ZInitialize(ZBarrierSet* barrier_set);
};

View File

@ -47,6 +47,9 @@ ZVirtualMemoryManager::ZVirtualMemoryManager(size_t max_capacity) :
return;
}
// Initialize OS specific parts
initialize_os();
// Successfully initialized
_initialized = true;
}

View File

@ -50,6 +50,8 @@ private:
ZMemoryManager _manager;
bool _initialized;
void initialize_os();
bool reserve_contiguous_platform(uintptr_t start, size_t size);
bool reserve_contiguous(size_t size);
size_t reserve_discontiguous(uintptr_t start, size_t size, size_t min_range);