Thu, 07 Feb 2019 14:29:17 -0500
8218558: NMT stack traces in output should show mt component for virtual memory allocations
Reviewed-by: shade, stuefe, coleenp
zgu@7074 | 1 | /* |
zgu@7074 | 2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
zgu@7074 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
zgu@7074 | 4 | * |
zgu@7074 | 5 | * This code is free software; you can redistribute it and/or modify it |
zgu@7074 | 6 | * under the terms of the GNU General Public License version 2 only, as |
zgu@7074 | 7 | * published by the Free Software Foundation. |
zgu@7074 | 8 | * |
zgu@7074 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
zgu@7074 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
zgu@7074 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
zgu@7074 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
zgu@7074 | 13 | * accompanied this code). |
zgu@7074 | 14 | * |
zgu@7074 | 15 | * You should have received a copy of the GNU General Public License version |
zgu@7074 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
zgu@7074 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
zgu@7074 | 18 | * |
zgu@7074 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
zgu@7074 | 20 | * or visit www.oracle.com if you need additional information or have any |
zgu@7074 | 21 | * questions. |
zgu@7074 | 22 | * |
zgu@7074 | 23 | */ |
zgu@7074 | 24 | |
zgu@7074 | 25 | #ifndef SHARE_VM_SERVICES_ALLOCATION_SITE_HPP |
zgu@7074 | 26 | #define SHARE_VM_SERVICES_ALLOCATION_SITE_HPP |
zgu@7074 | 27 | |
zgu@7074 | 28 | #include "memory/allocation.hpp" |
zgu@7074 | 29 | #include "utilities/nativeCallStack.hpp" |
zgu@7074 | 30 | |
zgu@7074 | 31 | // Allocation site represents a code path that makes a memory |
zgu@7074 | 32 | // allocation |
zgu@7074 | 33 | template <class E> class AllocationSite VALUE_OBJ_CLASS_SPEC { |
zgu@7074 | 34 | private: |
zgu@7074 | 35 | NativeCallStack _call_stack; |
zgu@7074 | 36 | E e; |
zgu@9778 | 37 | MEMFLAGS _flag; |
zgu@7074 | 38 | public: |
zgu@9778 | 39 | AllocationSite(const NativeCallStack& stack, MEMFLAGS flag) : _call_stack(stack), _flag(flag) { } |
zgu@7074 | 40 | int hash() const { return _call_stack.hash(); } |
zgu@7074 | 41 | bool equals(const NativeCallStack& stack) const { |
zgu@7074 | 42 | return _call_stack.equals(stack); |
zgu@7074 | 43 | } |
zgu@7074 | 44 | |
zgu@7074 | 45 | bool equals(const AllocationSite<E>& other) const { |
zgu@7074 | 46 | return other.equals(_call_stack); |
zgu@7074 | 47 | } |
zgu@7074 | 48 | |
zgu@7074 | 49 | const NativeCallStack* call_stack() const { |
zgu@7074 | 50 | return &_call_stack; |
zgu@7074 | 51 | } |
zgu@7074 | 52 | |
zgu@7074 | 53 | // Information regarding this allocation |
zgu@7074 | 54 | E* data() { return &e; } |
zgu@7074 | 55 | const E* peek() const { return &e; } |
zgu@9778 | 56 | |
zgu@9778 | 57 | MEMFLAGS flag() const { return _flag; } |
zgu@7074 | 58 | }; |
zgu@7074 | 59 | |
zgu@7074 | 60 | #endif // SHARE_VM_SERVICES_ALLOCATION_SITE_HPP |