1 /*
2 * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
58 // old objects.
59 OldGCAllocRegion _old_gc_alloc_region;
60
61 G1HeapRegion* _retained_old_gc_alloc_region;
62
63 bool survivor_is_full() const;
64 bool old_is_full() const;
65
66 void set_survivor_full();
67 void set_old_full();
68
69 void reuse_retained_old_region(G1EvacInfo* evacuation_info,
70 OldGCAllocRegion* old,
71 G1HeapRegion** retained);
72
73 // Accessors to the allocation regions.
74 inline MutatorAllocRegion* mutator_alloc_region(uint node_index);
75 inline SurvivorGCAllocRegion* survivor_gc_alloc_region(uint node_index);
76 inline OldGCAllocRegion* old_gc_alloc_region();
77
78 // Allocation attempt during GC for a survivor object / PLAB.
79 HeapWord* survivor_attempt_allocation(uint node_index,
80 size_t min_word_size,
81 size_t desired_word_size,
82 size_t* actual_word_size);
83
84 // Allocation attempt during GC for an old object / PLAB.
85 HeapWord* old_attempt_allocation(size_t min_word_size,
86 size_t desired_word_size,
87 size_t* actual_word_size);
88
89 public:
90 G1Allocator(G1CollectedHeap* heap);
91 ~G1Allocator();
92
93 uint num_nodes() { return (uint)_num_alloc_regions; }
94
95 #ifdef ASSERT
96 // Do we currently have an active mutator region to allocate into?
97 bool has_mutator_alloc_region();
|
1 /*
2 * Copyright (c) 2014, 2026, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
58 // old objects.
59 OldGCAllocRegion _old_gc_alloc_region;
60
61 G1HeapRegion* _retained_old_gc_alloc_region;
62
63 bool survivor_is_full() const;
64 bool old_is_full() const;
65
66 void set_survivor_full();
67 void set_old_full();
68
69 void reuse_retained_old_region(G1EvacInfo* evacuation_info,
70 OldGCAllocRegion* old,
71 G1HeapRegion** retained);
72
73 // Accessors to the allocation regions.
74 inline MutatorAllocRegion* mutator_alloc_region(uint node_index);
75 inline SurvivorGCAllocRegion* survivor_gc_alloc_region(uint node_index);
76 inline OldGCAllocRegion* old_gc_alloc_region();
77
78 void assert_not_humongous(size_t word_size) NOT_DEBUG_RETURN;
79
80 // Allocation attempt during GC for a survivor object / PLAB.
81 HeapWord* survivor_attempt_allocation(uint node_index,
82 size_t min_word_size,
83 size_t desired_word_size,
84 size_t* actual_word_size);
85
86 // Allocation attempt during GC for an old object / PLAB.
87 HeapWord* old_attempt_allocation(size_t min_word_size,
88 size_t desired_word_size,
89 size_t* actual_word_size);
90
91 public:
92 G1Allocator(G1CollectedHeap* heap);
93 ~G1Allocator();
94
95 uint num_nodes() { return (uint)_num_alloc_regions; }
96
97 #ifdef ASSERT
98 // Do we currently have an active mutator region to allocate into?
99 bool has_mutator_alloc_region();
|