Mercurial > hg > graal-compiler
annotate src/share/vm/runtime/registerMap.hpp @ 3917:eca1193ca245
4965777: GC changes to support use of discovered field for pending references
Summary: If and when the reference handler thread is able to use the discovered field to link reference objects in its pending list, so will GC. In that case, GC will scan through this field once a reference object has been placed on the pending list, but not scan that field before that stage, as the field is used by the concurrent GC thread to link discovered objects. When ReferenceHandleR thread does not use the discovered field for the purpose of linking the elements in the pending list, as would be the case in older JDKs, the JVM will fall back to the old behaviour of using the next field for that purpose.
Reviewed-by: jcoomes, mchung, stefank
author | ysr |
---|---|
date | Wed, 07 Sep 2011 13:55:42 -0700 |
parents | 1d1603768966 |
children | 63a4eb8bcd23 |
rev | line source |
---|---|
0 | 1 /* |
2426
1d1603768966
7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass
trims
parents:
2192
diff
changeset
|
2 * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 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" | |
30 #ifdef TARGET_ARCH_x86 | |
31 # include "register_x86.hpp" | |
32 #endif | |
33 #ifdef TARGET_ARCH_sparc | |
34 # include "register_sparc.hpp" | |
35 #endif | |
36 #ifdef TARGET_ARCH_zero | |
37 # include "register_zero.hpp" | |
38 #endif | |
2192
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
39 #ifdef TARGET_ARCH_arm |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
40 # include "register_arm.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
41 #endif |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
42 #ifdef TARGET_ARCH_ppc |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
43 # include "register_ppc.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
44 #endif |
1972 | 45 |
0 | 46 class JavaThread; |
47 | |
48 // | |
49 // RegisterMap | |
50 // | |
51 // A companion structure used for stack traversal. The RegisterMap contains | |
52 // misc. information needed in order to do correct stack traversal of stack | |
53 // frames. Hence, it must always be passed in as an argument to | |
54 // frame::sender(RegisterMap*). | |
55 // | |
56 // In particular, | |
57 // 1) It provides access to the thread for which the stack belongs. The | |
58 // thread object is needed in order to get sender of a deoptimized frame. | |
59 // | |
60 // 2) It is used to pass information from a callee frame to its caller | |
61 // frame about how the frame should be traversed. This is used to let | |
62 // the caller frame take care of calling oops-do of out-going | |
63 // arguments, when the callee frame is not instantiated yet. This | |
64 // happens, e.g., when a compiled frame calls into | |
65 // resolve_virtual_call. (Hence, it is critical that the same | |
66 // RegisterMap object is used for the entire stack walk. Normally, | |
67 // this is hidden by using the StackFrameStream.) This is used when | |
68 // doing follow_oops and oops_do. | |
69 // | |
70 // 3) The RegisterMap keeps track of the values of callee-saved registers | |
71 // from frame to frame (hence, the name). For some stack traversal the | |
72 // values of the callee-saved registers does not matter, e.g., if you | |
73 // only need the static properies such as frame type, pc, and such. | |
74 // Updating of the RegisterMap can be turned off by instantiating the | |
75 // register map as: RegisterMap map(thread, false); | |
76 | |
77 class RegisterMap : public StackObj { | |
78 public: | |
79 typedef julong LocationValidType; | |
80 enum { | |
81 reg_count = ConcreteRegisterImpl::number_of_registers, | |
82 location_valid_type_size = sizeof(LocationValidType)*8, | |
83 location_valid_size = (reg_count+location_valid_type_size-1)/location_valid_type_size | |
84 }; | |
85 private: | |
86 intptr_t* _location[reg_count]; // Location of registers (intptr_t* looks better than address in the debugger) | |
87 LocationValidType _location_valid[location_valid_size]; | |
88 bool _include_argument_oops; // Should include argument_oop marked locations for compiler | |
89 JavaThread* _thread; // Reference to current thread | |
90 bool _update_map; // Tells if the register map need to be | |
91 // updated when traversing the stack | |
92 | |
93 #ifdef ASSERT | |
94 void check_location_valid(); | |
95 #else | |
96 void check_location_valid() {} | |
97 #endif | |
98 | |
99 public: | |
100 debug_only(intptr_t* _update_for_id;) // Assert that RegisterMap is not updated twice for same frame | |
101 RegisterMap(JavaThread *thread, bool update_map = true); | |
102 RegisterMap(const RegisterMap* map); | |
103 | |
104 address location(VMReg reg) const { | |
105 int index = reg->value() / location_valid_type_size; | |
106 assert(0 <= reg->value() && reg->value() < reg_count, "range check"); | |
107 assert(0 <= index && index < location_valid_size, "range check"); | |
108 if (_location_valid[index] & ((LocationValidType)1 << (reg->value() % location_valid_type_size))) { | |
109 return (address) _location[reg->value()]; | |
110 } else { | |
111 return pd_location(reg); | |
112 } | |
113 } | |
114 | |
115 void set_location(VMReg reg, address loc) { | |
116 int index = reg->value() / location_valid_type_size; | |
117 assert(0 <= reg->value() && reg->value() < reg_count, "range check"); | |
118 assert(0 <= index && index < location_valid_size, "range check"); | |
119 assert(_update_map, "updating map that does not need updating"); | |
120 _location[reg->value()] = (intptr_t*) loc; | |
121 _location_valid[index] |= ((LocationValidType)1 << (reg->value() % location_valid_type_size)); | |
122 check_location_valid(); | |
123 } | |
124 | |
125 // Called by an entry frame. | |
126 void clear(); | |
127 | |
128 bool include_argument_oops() const { return _include_argument_oops; } | |
129 void set_include_argument_oops(bool f) { _include_argument_oops = f; } | |
130 | |
131 JavaThread *thread() const { return _thread; } | |
132 bool update_map() const { return _update_map; } | |
133 | |
134 void print_on(outputStream* st) const; | |
135 void print() const; | |
136 | |
137 // the following contains the definition of pd_xxx methods | |
1972 | 138 #ifdef TARGET_ARCH_x86 |
139 # include "registerMap_x86.hpp" | |
140 #endif | |
141 #ifdef TARGET_ARCH_sparc | |
142 # include "registerMap_sparc.hpp" | |
143 #endif | |
144 #ifdef TARGET_ARCH_zero | |
145 # include "registerMap_zero.hpp" | |
146 #endif | |
2192
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
147 #ifdef TARGET_ARCH_arm |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
148 # include "registerMap_arm.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
149 #endif |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
150 #ifdef TARGET_ARCH_ppc |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
151 # include "registerMap_ppc.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
152 #endif |
1972 | 153 |
0 | 154 }; |
1972 | 155 |
156 #endif // SHARE_VM_RUNTIME_REGISTERMAP_HPP |