--- old/src/hotspot/share/gc/z/vmStructs_z.hpp 2018-01-10 17:33:30.613319916 +0100 +++ new/src/hotspot/share/gc/z/vmStructs_z.hpp 2018-01-10 17:33:30.329310554 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,27 +29,82 @@ #include "gc/z/zHeap.hpp" #include "gc/z/zPageAllocator.hpp" #include "gc/z/zPhysicalMemory.hpp" +#include "gc/z/zAddressRangeMap.hpp" #include "utilities/macros.hpp" -#define VM_STRUCTS_Z(nonstatic_field, static_field) \ - \ - nonstatic_field(ZCollectedHeap, _heap, ZHeap) \ - \ - nonstatic_field(ZHeap, _page_allocator, ZPageAllocator) \ - \ - nonstatic_field(ZPageAllocator, _physical, ZPhysicalMemoryManager) \ - nonstatic_field(ZPageAllocator, _used, size_t) \ - \ - nonstatic_field(ZPhysicalMemoryManager, _max_capacity, const size_t) \ - nonstatic_field(ZPhysicalMemoryManager, _capacity, size_t) - -#define VM_TYPES_Z(declare_type, \ - declare_toplevel_type) \ - \ - declare_type(ZCollectedHeap, CollectedHeap) \ - \ - declare_toplevel_type(ZHeap) \ - declare_toplevel_type(ZPageAllocator) \ +// Expose some ZGC globals to the SA agent. +class ZGlobalsForVMStructs { + static ZGlobalsForVMStructs _instance; + +public: + static ZGlobalsForVMStructs* _instance_p; + + ZGlobalsForVMStructs(); + + uint32_t* _ZGlobalPhase; + + uintptr_t* _ZAddressGoodMask; + uintptr_t* _ZAddressBadMask; + uintptr_t* _ZAddressWeakBadMask; + + const int* _ZObjectAlignmentSmallShift; + const int* _ZObjectAlignmentSmall; +}; + + +typedef ZAddressRangeMap ZAddressRangeMapForPageTable; + +#define VM_STRUCTS_Z(nonstatic_field, static_field) \ + \ + static_field(ZGlobalsForVMStructs, _instance_p, ZGlobalsForVMStructs*) \ + nonstatic_field(ZGlobalsForVMStructs, _ZGlobalPhase, uint32_t*) \ + nonstatic_field(ZGlobalsForVMStructs, _ZAddressGoodMask, uintptr_t*) \ + nonstatic_field(ZGlobalsForVMStructs, _ZAddressBadMask, uintptr_t*) \ + nonstatic_field(ZGlobalsForVMStructs, _ZAddressWeakBadMask, uintptr_t*) \ + nonstatic_field(ZGlobalsForVMStructs, _ZObjectAlignmentSmallShift, const int*) \ + nonstatic_field(ZGlobalsForVMStructs, _ZObjectAlignmentSmall, const int*) \ + \ + nonstatic_field(ZCollectedHeap, _heap, ZHeap) \ + \ + nonstatic_field(ZHeap, _page_allocator, ZPageAllocator) \ + nonstatic_field(ZHeap, _pagetable, ZPageTable) \ + \ + nonstatic_field(ZPage, _type, const uint8_t) \ + nonstatic_field(ZPage, _virtual, const ZVirtualMemory) \ + nonstatic_field(ZPage, _forwarding, ZForwardingTable) \ + \ + nonstatic_field(ZPageAllocator, _physical, ZPhysicalMemoryManager) \ + nonstatic_field(ZPageAllocator, _used, size_t) \ + \ + nonstatic_field(ZPageTable, _map, ZAddressRangeMapForPageTable) \ + \ + nonstatic_field(ZAddressRangeMapForPageTable, _map, ZPageTableEntry* const) \ + \ + nonstatic_field(ZVirtualMemory, _start, uintptr_t) \ + nonstatic_field(ZVirtualMemory, _end, uintptr_t) \ + \ + nonstatic_field(ZForwardingTable, _table, ZForwardingTableEntry*) \ + nonstatic_field(ZForwardingTable, _size, size_t) \ + \ + nonstatic_field(ZPhysicalMemoryManager, _max_capacity, const size_t) \ + nonstatic_field(ZPhysicalMemoryManager, _capacity, size_t) + +#define VM_TYPES_Z(declare_type, \ + declare_toplevel_type) \ + \ + declare_toplevel_type(ZGlobalsForVMStructs) \ + \ + declare_type(ZCollectedHeap, CollectedHeap) \ + \ + declare_toplevel_type(ZHeap) \ + declare_toplevel_type(ZPage) \ + declare_toplevel_type(ZPageAllocator) \ + declare_toplevel_type(ZPageTable) \ + declare_toplevel_type(ZPageTableEntry) \ + declare_toplevel_type(ZAddressRangeMapForPageTable) \ + declare_toplevel_type(ZVirtualMemory) \ + declare_toplevel_type(ZForwardingTable) \ + declare_toplevel_type(ZForwardingTableEntry) \ declare_toplevel_type(ZPhysicalMemoryManager) #endif // SHARE_VM_GC_Z_VMSTRUCTS_Z_HPP