author | dholmes |
Sat, 23 Jun 2018 01:32:41 -0400 | |
changeset 50735 | 2f2af62dfac7 |
parent 49621 | 5ef28d560b6f |
child 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
25946 | 1 |
/* |
49364
601146c66cad
8173070: Remove ValueObj class for allocation subclassing for runtime code
coleenp
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. |
25946 | 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_SERVICES_ALLOCATION_SITE_HPP |
|
26 |
#define SHARE_VM_SERVICES_ALLOCATION_SITE_HPP |
|
27 |
||
28 |
#include "utilities/nativeCallStack.hpp" |
|
29 |
||
30 |
// Allocation site represents a code path that makes a memory |
|
31 |
// allocation |
|
49364
601146c66cad
8173070: Remove ValueObj class for allocation subclassing for runtime code
coleenp
parents:
47216
diff
changeset
|
32 |
template <class E> class AllocationSite { |
25946 | 33 |
private: |
34 |
NativeCallStack _call_stack; |
|
35 |
E e; |
|
36 |
public: |
|
37 |
AllocationSite(const NativeCallStack& stack) : _call_stack(stack) { } |
|
38 |
int hash() const { return _call_stack.hash(); } |
|
39 |
bool equals(const NativeCallStack& stack) const { |
|
40 |
return _call_stack.equals(stack); |
|
41 |
} |
|
42 |
||
43 |
bool equals(const AllocationSite<E>& other) const { |
|
44 |
return other.equals(_call_stack); |
|
45 |
} |
|
46 |
||
47 |
const NativeCallStack* call_stack() const { |
|
48 |
return &_call_stack; |
|
49 |
} |
|
50 |
||
51 |
// Information regarding this allocation |
|
52 |
E* data() { return &e; } |
|
53 |
const E* peek() const { return &e; } |
|
54 |
}; |
|
55 |
||
56 |
#endif // SHARE_VM_SERVICES_ALLOCATION_SITE_HPP |