1 /* 2 * Copyright (c) 2018, 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 * 23 */ 24 25 #ifndef SHARE_GC_SHARED_VMSTRUCTS_GC_HPP 26 #define SHARE_GC_SHARED_VMSTRUCTS_GC_HPP 27 28 #include "gc/shared/cardGeneration.hpp" 29 #include "gc/shared/cardTableRS.hpp" 30 #include "gc/shared/collectedHeap.hpp" 31 #include "gc/shared/genCollectedHeap.hpp" 32 #include "gc/shared/generation.hpp" 33 #include "gc/shared/generationSpec.hpp" 34 #include "gc/shared/oopStorage.hpp" 35 #include "gc/shared/space.hpp" 36 #include "gc/serial/defNewGeneration.hpp" 37 #include "gc/serial/vmStructs_serial.hpp" 38 #if INCLUDE_ALL_GCS 39 #include "gc/cms/vmStructs_cms.hpp" 40 #include "gc/g1/vmStructs_g1.hpp" 41 #include "gc/parallel/vmStructs_parallelgc.hpp" 42 #endif 43 44 #define VM_STRUCTS_GC(nonstatic_field, \ 45 volatile_nonstatic_field, \ 46 static_field, \ 47 unchecked_nonstatic_field) \ 48 ALL_GCS_ONLY(VM_STRUCTS_CMSGC(nonstatic_field, \ 49 volatile_nonstatic_field, \ 50 static_field)) \ 51 ALL_GCS_ONLY(VM_STRUCTS_G1GC(nonstatic_field, \ 52 volatile_nonstatic_field, \ 53 static_field)) \ 54 ALL_GCS_ONLY(VM_STRUCTS_PARALLELGC(nonstatic_field, \ 55 volatile_nonstatic_field, \ 56 static_field)) \ 57 VM_STRUCTS_SERIALGC(nonstatic_field, \ 58 volatile_nonstatic_field, \ 59 static_field) \ 60 /**********************************************************************************/ \ 61 /* Generation and Space hierarchies */ \ 62 /**********************************************************************************/ \ 63 \ 64 unchecked_nonstatic_field(AgeTable, sizes, sizeof(AgeTable::sizes)) \ 65 \ 66 nonstatic_field(BarrierSet, _fake_rtti, BarrierSet::FakeRtti) \ 67 \ 68 nonstatic_field(BarrierSet::FakeRtti, _concrete_tag, BarrierSet::Name) \ 69 \ 70 nonstatic_field(BlockOffsetTable, _bottom, HeapWord*) \ 71 nonstatic_field(BlockOffsetTable, _end, HeapWord*) \ 72 \ 73 nonstatic_field(BlockOffsetSharedArray, _reserved, MemRegion) \ 74 nonstatic_field(BlockOffsetSharedArray, _end, HeapWord*) \ 75 nonstatic_field(BlockOffsetSharedArray, _vs, VirtualSpace) \ 76 nonstatic_field(BlockOffsetSharedArray, _offset_array, u_char*) \ 77 \ 78 nonstatic_field(BlockOffsetArray, _array, BlockOffsetSharedArray*) \ 79 nonstatic_field(BlockOffsetArray, _sp, Space*) \ 80 nonstatic_field(BlockOffsetArrayContigSpace, _next_offset_threshold, HeapWord*) \ 81 nonstatic_field(BlockOffsetArrayContigSpace, _next_offset_index, size_t) \ 82 \ 83 nonstatic_field(BlockOffsetArrayNonContigSpace, _unallocated_block, HeapWord*) \ 84 \ 85 nonstatic_field(CardGeneration, _rs, CardTableRS*) \ 86 nonstatic_field(CardGeneration, _bts, BlockOffsetSharedArray*) \ 87 nonstatic_field(CardGeneration, _shrink_factor, size_t) \ 88 nonstatic_field(CardGeneration, _capacity_at_prologue, size_t) \ 89 nonstatic_field(CardGeneration, _used_at_prologue, size_t) \ 90 \ 91 nonstatic_field(CardTable, _whole_heap, const MemRegion) \ 92 nonstatic_field(CardTable, _guard_index, const size_t) \ 93 nonstatic_field(CardTable, _last_valid_index, const size_t) \ 94 nonstatic_field(CardTable, _page_size, const size_t) \ 95 nonstatic_field(CardTable, _byte_map_size, const size_t) \ 96 nonstatic_field(CardTable, _byte_map, jbyte*) \ 97 nonstatic_field(CardTable, _cur_covered_regions, int) \ 98 nonstatic_field(CardTable, _covered, MemRegion*) \ 99 nonstatic_field(CardTable, _committed, MemRegion*) \ 100 nonstatic_field(CardTable, _guard_region, MemRegion) \ 101 nonstatic_field(CardTable, _byte_map_base, jbyte*) \ 102 nonstatic_field(CardTableBarrierSet, _defer_initial_card_mark, bool) \ 103 nonstatic_field(CardTableBarrierSet, _card_table, CardTable*) \ 104 \ 105 nonstatic_field(CollectedHeap, _reserved, MemRegion) \ 106 nonstatic_field(CollectedHeap, _is_gc_active, bool) \ 107 nonstatic_field(CollectedHeap, _total_collections, unsigned int) \ 108 \ 109 nonstatic_field(CompactibleSpace, _compaction_top, HeapWord*) \ 110 nonstatic_field(CompactibleSpace, _first_dead, HeapWord*) \ 111 nonstatic_field(CompactibleSpace, _end_of_live, HeapWord*) \ 112 \ 113 nonstatic_field(ContiguousSpace, _top, HeapWord*) \ 114 nonstatic_field(ContiguousSpace, _concurrent_iteration_safe_limit, HeapWord*) \ 115 nonstatic_field(ContiguousSpace, _saved_mark_word, HeapWord*) \ 116 \ 117 nonstatic_field(DefNewGeneration, _old_gen, Generation*) \ 118 nonstatic_field(DefNewGeneration, _tenuring_threshold, uint) \ 119 nonstatic_field(DefNewGeneration, _age_table, AgeTable) \ 120 nonstatic_field(DefNewGeneration, _eden_space, ContiguousSpace*) \ 121 nonstatic_field(DefNewGeneration, _from_space, ContiguousSpace*) \ 122 nonstatic_field(DefNewGeneration, _to_space, ContiguousSpace*) \ 123 \ 124 nonstatic_field(Generation, _reserved, MemRegion) \ 125 nonstatic_field(Generation, _virtual_space, VirtualSpace) \ 126 nonstatic_field(Generation, _stat_record, Generation::StatRecord) \ 127 \ 128 nonstatic_field(Generation::StatRecord, invocations, int) \ 129 nonstatic_field(Generation::StatRecord, accumulated_time, elapsedTimer) \ 130 \ 131 nonstatic_field(GenerationSpec, _name, Generation::Name) \ 132 nonstatic_field(GenerationSpec, _init_size, size_t) \ 133 nonstatic_field(GenerationSpec, _max_size, size_t) \ 134 \ 135 nonstatic_field(GenCollectedHeap, _young_gen, Generation*) \ 136 nonstatic_field(GenCollectedHeap, _old_gen, Generation*) \ 137 nonstatic_field(GenCollectedHeap, _young_gen_spec, GenerationSpec*) \ 138 nonstatic_field(GenCollectedHeap, _old_gen_spec, GenerationSpec*) \ 139 \ 140 nonstatic_field(HeapWord, i, char*) \ 141 \ 142 nonstatic_field(MemRegion, _start, HeapWord*) \ 143 nonstatic_field(MemRegion, _word_size, size_t) \ 144 \ 145 nonstatic_field(OffsetTableContigSpace, _offsets, BlockOffsetArray) \ 146 \ 147 nonstatic_field(Space, _bottom, HeapWord*) \ 148 nonstatic_field(Space, _end, HeapWord*) 149 150 #define VM_TYPES_GC(declare_type, \ 151 declare_toplevel_type, \ 152 declare_integer_type) \ 153 ALL_GCS_ONLY(VM_TYPES_CMSGC(declare_type, \ 154 declare_toplevel_type, \ 155 declare_integer_type)) \ 156 ALL_GCS_ONLY(VM_TYPES_G1GC(declare_type, \ 157 declare_toplevel_type, \ 158 declare_integer_type)) \ 159 ALL_GCS_ONLY(VM_TYPES_PARALLELGC(declare_type, \ 160 declare_toplevel_type, \ 161 declare_integer_type)) \ 162 VM_TYPES_SERIALGC(declare_type, \ 163 declare_toplevel_type, \ 164 declare_integer_type) \ 165 /******************************************/ \ 166 /* Generation and space hierarchies */ \ 167 /* (needed for run-time type information) */ \ 168 /******************************************/ \ 169 \ 170 declare_toplevel_type(CollectedHeap) \ 171 declare_type(GenCollectedHeap, CollectedHeap) \ 172 declare_toplevel_type(Generation) \ 173 declare_type(DefNewGeneration, Generation) \ 174 declare_type(CardGeneration, Generation) \ 175 declare_toplevel_type(Space) \ 176 declare_type(CompactibleSpace, Space) \ 177 declare_type(ContiguousSpace, CompactibleSpace) \ 178 declare_type(OffsetTableContigSpace, ContiguousSpace) \ 179 declare_toplevel_type(BarrierSet) \ 180 declare_type(ModRefBarrierSet, BarrierSet) \ 181 declare_type(CardTableBarrierSet, ModRefBarrierSet) \ 182 declare_toplevel_type(CardTable) \ 183 declare_type(CardTableRS, CardTable) \ 184 declare_toplevel_type(BarrierSet::Name) \ 185 declare_toplevel_type(BlockOffsetSharedArray) \ 186 declare_toplevel_type(BlockOffsetTable) \ 187 declare_type(BlockOffsetArray, BlockOffsetTable) \ 188 declare_type(BlockOffsetArrayContigSpace, BlockOffsetArray) \ 189 declare_type(BlockOffsetArrayNonContigSpace, BlockOffsetArray) \ 190 \ 191 /* Miscellaneous other GC types */ \ 192 \ 193 declare_toplevel_type(AgeTable) \ 194 declare_toplevel_type(Generation::StatRecord) \ 195 declare_toplevel_type(GenerationSpec) \ 196 declare_toplevel_type(HeapWord) \ 197 declare_toplevel_type(MemRegion) \ 198 declare_toplevel_type(ThreadLocalAllocBuffer) \ 199 declare_toplevel_type(VirtualSpace) \ 200 \ 201 /* Pointers to Garbage Collection types */ \ 202 \ 203 declare_toplevel_type(BarrierSet*) \ 204 declare_toplevel_type(BlockOffsetSharedArray*) \ 205 declare_toplevel_type(CardTable*) \ 206 declare_toplevel_type(CardTable*const) \ 207 declare_toplevel_type(CardTableRS*) \ 208 declare_toplevel_type(CardTableBarrierSet*) \ 209 declare_toplevel_type(CardTableBarrierSet**) \ 210 declare_toplevel_type(CollectedHeap*) \ 211 declare_toplevel_type(ContiguousSpace*) \ 212 declare_toplevel_type(DefNewGeneration*) \ 213 declare_toplevel_type(GenCollectedHeap*) \ 214 declare_toplevel_type(Generation*) \ 215 declare_toplevel_type(GenerationSpec**) \ 216 declare_toplevel_type(HeapWord*) \ 217 declare_toplevel_type(HeapWord* volatile) \ 218 declare_toplevel_type(MemRegion*) \ 219 declare_toplevel_type(OffsetTableContigSpace*) \ 220 declare_toplevel_type(Space*) \ 221 declare_toplevel_type(ThreadLocalAllocBuffer*) \ 222 \ 223 declare_toplevel_type(BarrierSet::FakeRtti) 224 225 #define VM_INT_CONSTANTS_GC(declare_constant, \ 226 declare_constant_with_value) \ 227 ALL_GCS_ONLY(VM_INT_CONSTANTS_CMSGC(declare_constant, \ 228 declare_constant_with_value)) \ 229 ALL_GCS_ONLY(VM_INT_CONSTANTS_G1GC(declare_constant, \ 230 declare_constant_with_value)) \ 231 ALL_GCS_ONLY(VM_INT_CONSTANTS_PARALLELGC(declare_constant, \ 232 declare_constant_with_value)) \ 233 VM_INT_CONSTANTS_SERIALGC(declare_constant, \ 234 declare_constant_with_value) \ 235 \ 236 /********************************************/ \ 237 /* Generation and Space Hierarchy Constants */ \ 238 /********************************************/ \ 239 \ 240 declare_constant(AgeTable::table_size) \ 241 \ 242 declare_constant(BarrierSet::ModRef) \ 243 declare_constant(BarrierSet::CardTableBarrierSet) \ 244 \ 245 declare_constant(BOTConstants::LogN) \ 246 declare_constant(BOTConstants::LogN_words) \ 247 declare_constant(BOTConstants::N_bytes) \ 248 declare_constant(BOTConstants::N_words) \ 249 declare_constant(BOTConstants::LogBase) \ 250 declare_constant(BOTConstants::Base) \ 251 declare_constant(BOTConstants::N_powers) \ 252 \ 253 declare_constant(CardTable::clean_card) \ 254 declare_constant(CardTable::last_card) \ 255 declare_constant(CardTable::dirty_card) \ 256 declare_constant(CardTable::Precise) \ 257 declare_constant(CardTable::ObjHeadPreciseArray) \ 258 declare_constant(CardTable::card_shift) \ 259 declare_constant(CardTable::card_size) \ 260 declare_constant(CardTable::card_size_in_words) \ 261 \ 262 declare_constant(CardTableRS::youngergen_card) \ 263 \ 264 declare_constant(CollectedHeap::Serial) \ 265 declare_constant(CollectedHeap::Parallel) \ 266 declare_constant(CollectedHeap::CMS) \ 267 declare_constant(CollectedHeap::G1) \ 268 \ 269 /* constants from Generation::Name enum */ \ 270 \ 271 declare_constant(Generation::DefNew) \ 272 declare_constant(Generation::MarkSweepCompact) \ 273 declare_constant(Generation::Other) \ 274 \ 275 declare_constant(Generation::LogOfGenGrain) \ 276 declare_constant(Generation::GenGrain) \ 277 278 279 #endif // SHARE_GC_SHARED_VMSTRUCTS_GC_HPP