zgu@7074: /* zgu@7074: * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. zgu@7074: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. zgu@7074: * zgu@7074: * This code is free software; you can redistribute it and/or modify it zgu@7074: * under the terms of the GNU General Public License version 2 only, as zgu@7074: * published by the Free Software Foundation. zgu@7074: * zgu@7074: * This code is distributed in the hope that it will be useful, but WITHOUT zgu@7074: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or zgu@7074: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License zgu@7074: * version 2 for more details (a copy is included in the LICENSE file that zgu@7074: * accompanied this code). zgu@7074: * zgu@7074: * You should have received a copy of the GNU General Public License version zgu@7074: * 2 along with this work; if not, write to the Free Software Foundation, zgu@7074: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. zgu@7074: * zgu@7074: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA zgu@7074: * or visit www.oracle.com if you need additional information or have any zgu@7074: * questions. zgu@7074: * zgu@7074: */ zgu@7074: zgu@7074: #ifndef SHARE_VM_SERVICES_ALLOCATION_SITE_HPP zgu@7074: #define SHARE_VM_SERVICES_ALLOCATION_SITE_HPP zgu@7074: zgu@7074: #include "memory/allocation.hpp" zgu@7074: #include "utilities/nativeCallStack.hpp" zgu@7074: zgu@7074: // Allocation site represents a code path that makes a memory zgu@7074: // allocation zgu@7074: template class AllocationSite VALUE_OBJ_CLASS_SPEC { zgu@7074: private: zgu@7074: NativeCallStack _call_stack; zgu@7074: E e; zgu@9778: MEMFLAGS _flag; zgu@7074: public: zgu@9778: AllocationSite(const NativeCallStack& stack, MEMFLAGS flag) : _call_stack(stack), _flag(flag) { } zgu@7074: int hash() const { return _call_stack.hash(); } zgu@7074: bool equals(const NativeCallStack& stack) const { zgu@7074: return _call_stack.equals(stack); zgu@7074: } zgu@7074: zgu@7074: bool equals(const AllocationSite& other) const { zgu@7074: return other.equals(_call_stack); zgu@7074: } zgu@7074: zgu@7074: const NativeCallStack* call_stack() const { zgu@7074: return &_call_stack; zgu@7074: } zgu@7074: zgu@7074: // Information regarding this allocation zgu@7074: E* data() { return &e; } zgu@7074: const E* peek() const { return &e; } zgu@9778: zgu@9778: MEMFLAGS flag() const { return _flag; } zgu@7074: }; zgu@7074: zgu@7074: #endif // SHARE_VM_SERVICES_ALLOCATION_SITE_HPP