Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_api/GuaranteedNurseryRange.cpp
5985 views
1
/*******************************************************************************
2
* Copyright (c) 2001, 2019 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* 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-exception
21
*******************************************************************************/
22
#include "j9.h"
23
#include "j9cfg.h"
24
#include "modron.h"
25
#include "ModronAssertions.h"
26
27
#include "GCExtensions.hpp"
28
29
extern "C" {
30
31
/**
32
* Answer the region of address space which is guaranteed to only ever contain objects in the nursery.
33
* The GC will attempt to answer the largest range it can. The range may extend beyond the end of the
34
* heap (to the end of the address range) if the GC can guarantee that no other heap objects will appear
35
* in that area. Note that stack allocated objects may appear in the nursery range.
36
*
37
* If there is no nursery, or no part of its range can be guaranteed, start and end are both set to NULL.
38
*
39
* If the guaranteed nursery range extends to the bottom of the address range, start will be NULL and end
40
* will be the highest nursery address.
41
*
42
* If the guaranteed nursery range extends to the top of the address range, start will be the lowest nursery
43
* address and end will be (void*)UDATA_MAX.
44
*
45
* Since the nursery may grow and contract during the JVM's lifetime, this range might cover only a very
46
* small portion of the heap (typically about 4MB).
47
*
48
* Various features may cause the nursery range to be bounded on both ends. These include:
49
* - shared objects in Zero
50
* - non-flat memory model (e.g. some Vich configurations)
51
* - RTJ scopes
52
* - resman regions
53
*
54
* @param[in] javaVM the J9JavaVM* instance
55
* @param[out] start the start address is returned in this pointer
56
* @param[out] end the end address is returned in this pointer
57
*
58
* @note this function is used by the JIT for barrier omission optimizations
59
*/
60
void
61
j9mm_get_guaranteed_nursery_range(J9JavaVM* javaVM, void** start, void** end)
62
{
63
#if defined (J9VM_GC_GENERATIONAL)
64
MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(javaVM->omrVM);
65
extensions->getGuaranteedNurseryRange(start, end);
66
#else /* J9VM_GC_GENERATIONAL */
67
*start = NULL;
68
*end = NULL;
69
#endif /* J9VM_GC_GENERATIONAL */
70
}
71
72
}
73
74