author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 40010 | hotspot/src/share/vm/runtime/registerMap.hpp@e32d5e545789 |
child 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
40010 | 2 |
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_RUNTIME_REGISTERMAP_HPP |
26 |
#define SHARE_VM_RUNTIME_REGISTERMAP_HPP |
|
27 |
||
28 |
#include "code/vmreg.hpp" |
|
29 |
#include "utilities/globalDefinitions.hpp" |
|
40010 | 30 |
#include "utilities/macros.hpp" |
7397 | 31 |
|
1 | 32 |
class JavaThread; |
33 |
||
34 |
// |
|
35 |
// RegisterMap |
|
36 |
// |
|
37 |
// A companion structure used for stack traversal. The RegisterMap contains |
|
38 |
// misc. information needed in order to do correct stack traversal of stack |
|
39 |
// frames. Hence, it must always be passed in as an argument to |
|
40 |
// frame::sender(RegisterMap*). |
|
41 |
// |
|
42 |
// In particular, |
|
43 |
// 1) It provides access to the thread for which the stack belongs. The |
|
44 |
// thread object is needed in order to get sender of a deoptimized frame. |
|
45 |
// |
|
46 |
// 2) It is used to pass information from a callee frame to its caller |
|
47 |
// frame about how the frame should be traversed. This is used to let |
|
48 |
// the caller frame take care of calling oops-do of out-going |
|
49 |
// arguments, when the callee frame is not instantiated yet. This |
|
50 |
// happens, e.g., when a compiled frame calls into |
|
51 |
// resolve_virtual_call. (Hence, it is critical that the same |
|
52 |
// RegisterMap object is used for the entire stack walk. Normally, |
|
53 |
// this is hidden by using the StackFrameStream.) This is used when |
|
54 |
// doing follow_oops and oops_do. |
|
55 |
// |
|
56 |
// 3) The RegisterMap keeps track of the values of callee-saved registers |
|
57 |
// from frame to frame (hence, the name). For some stack traversal the |
|
58 |
// values of the callee-saved registers does not matter, e.g., if you |
|
22551 | 59 |
// only need the static properties such as frame type, pc, and such. |
1 | 60 |
// Updating of the RegisterMap can be turned off by instantiating the |
61 |
// register map as: RegisterMap map(thread, false); |
|
62 |
||
63 |
class RegisterMap : public StackObj { |
|
64 |
public: |
|
65 |
typedef julong LocationValidType; |
|
66 |
enum { |
|
67 |
reg_count = ConcreteRegisterImpl::number_of_registers, |
|
68 |
location_valid_type_size = sizeof(LocationValidType)*8, |
|
69 |
location_valid_size = (reg_count+location_valid_type_size-1)/location_valid_type_size |
|
70 |
}; |
|
71 |
private: |
|
72 |
intptr_t* _location[reg_count]; // Location of registers (intptr_t* looks better than address in the debugger) |
|
73 |
LocationValidType _location_valid[location_valid_size]; |
|
74 |
bool _include_argument_oops; // Should include argument_oop marked locations for compiler |
|
75 |
JavaThread* _thread; // Reference to current thread |
|
76 |
bool _update_map; // Tells if the register map need to be |
|
77 |
// updated when traversing the stack |
|
78 |
||
79 |
#ifdef ASSERT |
|
80 |
void check_location_valid(); |
|
81 |
#else |
|
82 |
void check_location_valid() {} |
|
83 |
#endif |
|
84 |
||
85 |
public: |
|
86 |
debug_only(intptr_t* _update_for_id;) // Assert that RegisterMap is not updated twice for same frame |
|
87 |
RegisterMap(JavaThread *thread, bool update_map = true); |
|
88 |
RegisterMap(const RegisterMap* map); |
|
89 |
||
90 |
address location(VMReg reg) const { |
|
91 |
int index = reg->value() / location_valid_type_size; |
|
92 |
assert(0 <= reg->value() && reg->value() < reg_count, "range check"); |
|
93 |
assert(0 <= index && index < location_valid_size, "range check"); |
|
94 |
if (_location_valid[index] & ((LocationValidType)1 << (reg->value() % location_valid_type_size))) { |
|
95 |
return (address) _location[reg->value()]; |
|
96 |
} else { |
|
97 |
return pd_location(reg); |
|
98 |
} |
|
99 |
} |
|
100 |
||
101 |
void set_location(VMReg reg, address loc) { |
|
102 |
int index = reg->value() / location_valid_type_size; |
|
103 |
assert(0 <= reg->value() && reg->value() < reg_count, "range check"); |
|
104 |
assert(0 <= index && index < location_valid_size, "range check"); |
|
105 |
assert(_update_map, "updating map that does not need updating"); |
|
106 |
_location[reg->value()] = (intptr_t*) loc; |
|
107 |
_location_valid[index] |= ((LocationValidType)1 << (reg->value() % location_valid_type_size)); |
|
108 |
check_location_valid(); |
|
109 |
} |
|
110 |
||
111 |
// Called by an entry frame. |
|
112 |
void clear(); |
|
113 |
||
114 |
bool include_argument_oops() const { return _include_argument_oops; } |
|
115 |
void set_include_argument_oops(bool f) { _include_argument_oops = f; } |
|
116 |
||
117 |
JavaThread *thread() const { return _thread; } |
|
118 |
bool update_map() const { return _update_map; } |
|
119 |
||
120 |
void print_on(outputStream* st) const; |
|
121 |
void print() const; |
|
122 |
||
123 |
// the following contains the definition of pd_xxx methods |
|
40010 | 124 |
#include CPU_HEADER(registerMap) |
7397 | 125 |
|
1 | 126 |
}; |
7397 | 127 |
|
128 |
#endif // SHARE_VM_RUNTIME_REGISTERMAP_HPP |