Path: blob/master/runtime/gc_api/GuaranteedNurseryRange.cpp
5985 views
/*******************************************************************************1* Copyright (c) 2001, 2019 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception20*******************************************************************************/21#include "j9.h"22#include "j9cfg.h"23#include "modron.h"24#include "ModronAssertions.h"2526#include "GCExtensions.hpp"2728extern "C" {2930/**31* Answer the region of address space which is guaranteed to only ever contain objects in the nursery.32* The GC will attempt to answer the largest range it can. The range may extend beyond the end of the33* heap (to the end of the address range) if the GC can guarantee that no other heap objects will appear34* in that area. Note that stack allocated objects may appear in the nursery range.35*36* If there is no nursery, or no part of its range can be guaranteed, start and end are both set to NULL.37*38* If the guaranteed nursery range extends to the bottom of the address range, start will be NULL and end39* will be the highest nursery address.40*41* If the guaranteed nursery range extends to the top of the address range, start will be the lowest nursery42* address and end will be (void*)UDATA_MAX.43*44* Since the nursery may grow and contract during the JVM's lifetime, this range might cover only a very45* small portion of the heap (typically about 4MB).46*47* Various features may cause the nursery range to be bounded on both ends. These include:48* - shared objects in Zero49* - non-flat memory model (e.g. some Vich configurations)50* - RTJ scopes51* - resman regions52*53* @param[in] javaVM the J9JavaVM* instance54* @param[out] start the start address is returned in this pointer55* @param[out] end the end address is returned in this pointer56*57* @note this function is used by the JIT for barrier omission optimizations58*/59void60j9mm_get_guaranteed_nursery_range(J9JavaVM* javaVM, void** start, void** end)61{62#if defined (J9VM_GC_GENERATIONAL)63MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(javaVM->omrVM);64extensions->getGuaranteedNurseryRange(start, end);65#else /* J9VM_GC_GENERATIONAL */66*start = NULL;67*end = NULL;68#endif /* J9VM_GC_GENERATIONAL */69}7071}727374