1 /* 2 * Copyright (c) 2017, 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_VM_GC_Z_VMSTRUCTS_Z_HPP 26 #define SHARE_VM_GC_Z_VMSTRUCTS_Z_HPP 27 28 #include "gc/z/zCollectedHeap.hpp" 29 #include "gc/z/zHeap.hpp" 30 #include "gc/z/zPageAllocator.hpp" 31 #include "gc/z/zPhysicalMemory.hpp" 32 #include "gc/z/zAddressRangeMap.hpp" 33 #include "utilities/macros.hpp" 34 35 // Expose some ZGC globals to the SA agent. 36 class ZGlobalsForVMStructs { 37 static ZGlobalsForVMStructs _instance; 38 39 public: 40 static ZGlobalsForVMStructs* _instance_p; 41 42 ZGlobalsForVMStructs(); 43 44 uint32_t* _ZGlobalPhase; 45 46 uintptr_t* _ZAddressGoodMask; 47 uintptr_t* _ZAddressBadMask; 48 uintptr_t* _ZAddressWeakBadMask; 49 }; 50 51 52 typedef ZAddressRangeMap<ZPageTableEntry, ZPageSizeMinShift> ZAddressRangeMapForPageTable; 53 54 #define VM_STRUCTS_Z(nonstatic_field, static_field) \ 55 \ 56 static_field(ZGlobalsForVMStructs, _instance_p, ZGlobalsForVMStructs*) \ 57 nonstatic_field(ZGlobalsForVMStructs, _ZGlobalPhase, uint32_t*) \ 58 nonstatic_field(ZGlobalsForVMStructs, _ZAddressGoodMask, uintptr_t*) \ 59 nonstatic_field(ZGlobalsForVMStructs, _ZAddressBadMask, uintptr_t*) \ 60 nonstatic_field(ZGlobalsForVMStructs, _ZAddressWeakBadMask, uintptr_t*) \ 61 \ 62 nonstatic_field(ZCollectedHeap, _heap, ZHeap) \ 63 \ 64 nonstatic_field(ZHeap, _page_allocator, ZPageAllocator) \ 65 nonstatic_field(ZHeap, _pagetable, ZPageTable) \ 66 \ 67 nonstatic_field(ZPage, _type, const uint8_t) \ 68 nonstatic_field(ZPage, _virtual, const ZVirtualMemory) \ 69 nonstatic_field(ZPage, _forwarding, ZForwardingTable) \ 70 \ 71 nonstatic_field(ZPageAllocator, _physical, ZPhysicalMemoryManager) \ 72 nonstatic_field(ZPageAllocator, _used, size_t) \ 73 \ 74 nonstatic_field(ZPageTable, _map, ZAddressRangeMapForPageTable) \ 75 \ 76 nonstatic_field(ZAddressRangeMapForPageTable, _map, ZPageTableEntry* const) \ 77 \ 78 nonstatic_field(ZVirtualMemory, _start, uintptr_t) \ 79 nonstatic_field(ZVirtualMemory, _end, uintptr_t) \ 80 \ 81 nonstatic_field(ZForwardingTable, _table, ZForwardingTableEntry*) \ 82 nonstatic_field(ZForwardingTable, _size, size_t) \ 83 \ 84 nonstatic_field(ZPhysicalMemoryManager, _max_capacity, const size_t) \ 85 nonstatic_field(ZPhysicalMemoryManager, _capacity, size_t) 86 87 #define VM_INT_CONSTANTS_Z(declare_constant, declare_constant_with_value) \ 88 declare_constant(ZPhaseRelocate) \ 89 declare_constant(ZPageTypeSmall) \ 90 declare_constant(ZPageTypeMedium) \ 91 declare_constant(ZPageTypeLarge) \ 92 declare_constant(ZObjectAlignmentSmallShift) \ 93 declare_constant(ZObjectAlignmentMediumShift) \ 94 declare_constant(ZObjectAlignmentLargeShift) 95 96 #define VM_LONG_CONSTANTS_Z(declare_constant, declare_constant_with_value) \ 97 declare_constant(ZAddressOffsetMask) \ 98 declare_constant(ZAddressSpaceStart) \ 99 declare_constant(ZPageSizeMinShift) 100 101 #define VM_TYPES_Z(declare_type, \ 102 declare_toplevel_type) \ 103 \ 104 declare_toplevel_type(ZGlobalsForVMStructs) \ 105 \ 106 declare_type(ZCollectedHeap, CollectedHeap) \ 107 \ 108 declare_toplevel_type(ZHeap) \ 109 declare_toplevel_type(ZPage) \ 110 declare_toplevel_type(ZPageAllocator) \ 111 declare_toplevel_type(ZPageTable) \ 112 declare_toplevel_type(ZPageTableEntry) \ 113 declare_toplevel_type(ZAddressRangeMapForPageTable) \ 114 declare_toplevel_type(ZVirtualMemory) \ 115 declare_toplevel_type(ZForwardingTable) \ 116 declare_toplevel_type(ZForwardingTableEntry) \ 117 declare_toplevel_type(ZPhysicalMemoryManager) 118 119 #endif // SHARE_VM_GC_Z_VMSTRUCTS_Z_HPP