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