Mercurial > hg > truffle
annotate src/cpu/sparc/vm/relocInfo_sparc.cpp @ 4711:adedfbbf0360
7120038: G1: ParallelGCThreads==0 is broken
Summary: Running G1 with ParallelGCThreads==0 results in various crashes and asserts. Most of these are caused by unguarded references to the worker threads array or an incorrect number of active workers.
Reviewed-by: jmasa, tonyp
author | johnc |
---|---|
date | Fri, 16 Dec 2011 11:40:00 -0800 |
parents | 1d1603768966 |
children | da91efe96a93 |
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:
2375
diff
changeset
|
2 * Copyright (c) 1998, 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:
727
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
727
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:
727
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "asm/assembler.inline.hpp" | |
27 #include "assembler_sparc.inline.hpp" | |
28 #include "code/relocInfo.hpp" | |
29 #include "nativeInst_sparc.hpp" | |
30 #include "oops/oop.inline.hpp" | |
31 #include "runtime/safepoint.hpp" | |
0 | 32 |
2375
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
33 void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) { |
0 | 34 NativeInstruction* ip = nativeInstruction_at(addr()); |
35 jint inst = ip->long_at(0); | |
36 assert(inst != NativeInstruction::illegal_instruction(), "no breakpoint"); | |
37 switch (Assembler::inv_op(inst)) { | |
38 | |
39 case Assembler::ldst_op: | |
40 #ifdef ASSERT | |
41 switch (Assembler::inv_op3(inst)) { | |
42 case Assembler::lduw_op3: | |
43 case Assembler::ldub_op3: | |
44 case Assembler::lduh_op3: | |
45 case Assembler::ldd_op3: | |
46 case Assembler::ldsw_op3: | |
47 case Assembler::ldsb_op3: | |
48 case Assembler::ldsh_op3: | |
49 case Assembler::ldx_op3: | |
50 case Assembler::ldf_op3: | |
51 case Assembler::lddf_op3: | |
52 case Assembler::stw_op3: | |
53 case Assembler::stb_op3: | |
54 case Assembler::sth_op3: | |
55 case Assembler::std_op3: | |
56 case Assembler::stx_op3: | |
57 case Assembler::stf_op3: | |
58 case Assembler::stdf_op3: | |
59 case Assembler::casa_op3: | |
60 case Assembler::casxa_op3: | |
61 break; | |
62 default: | |
63 ShouldNotReachHere(); | |
64 } | |
65 goto do_non_sethi; | |
66 #endif | |
67 | |
68 case Assembler::arith_op: | |
69 #ifdef ASSERT | |
70 switch (Assembler::inv_op3(inst)) { | |
71 case Assembler::or_op3: | |
72 case Assembler::add_op3: | |
73 case Assembler::jmpl_op3: | |
74 break; | |
75 default: | |
76 ShouldNotReachHere(); | |
77 } | |
78 do_non_sethi:; | |
79 #endif | |
80 { | |
81 guarantee(Assembler::inv_immed(inst), "must have a simm13 field"); | |
82 int simm13 = Assembler::low10((intptr_t)x) + o; | |
83 guarantee(Assembler::is_simm13(simm13), "offset can't overflow simm13"); | |
84 inst &= ~Assembler::simm( -1, 13); | |
85 inst |= Assembler::simm(simm13, 13); | |
2375
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
86 if (verify_only) { |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
87 assert(ip->long_at(0) == inst, "instructions must match"); |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
88 } else { |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
89 ip->set_long_at(0, inst); |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
90 } |
0 | 91 } |
92 break; | |
93 | |
94 case Assembler::branch_op: | |
95 { | |
96 #ifdef _LP64 | |
97 jint inst2; | |
98 guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi"); | |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
0
diff
changeset
|
99 if (format() != 0) { |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
0
diff
changeset
|
100 assert(type() == relocInfo::oop_type, "only narrow oops case"); |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
0
diff
changeset
|
101 jint np = oopDesc::encode_heap_oop((oop)x); |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
0
diff
changeset
|
102 inst &= ~Assembler::hi22(-1); |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
0
diff
changeset
|
103 inst |= Assembler::hi22((intptr_t)np); |
2375
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
104 if (verify_only) { |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
105 assert(ip->long_at(0) == inst, "instructions must match"); |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
106 } else { |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
107 ip->set_long_at(0, inst); |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
108 } |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
0
diff
changeset
|
109 inst2 = ip->long_at( NativeInstruction::nop_instruction_size ); |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
0
diff
changeset
|
110 guarantee(Assembler::inv_op(inst2)==Assembler::arith_op, "arith op"); |
2375
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
111 if (verify_only) { |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
112 assert(ip->long_at(NativeInstruction::nop_instruction_size) == NativeInstruction::set_data32_simm13( inst2, (intptr_t)np), |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
113 "instructions must match"); |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
114 } else { |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
115 ip->set_long_at(NativeInstruction::nop_instruction_size, NativeInstruction::set_data32_simm13( inst2, (intptr_t)np)); |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
116 } |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
0
diff
changeset
|
117 break; |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
0
diff
changeset
|
118 } |
2375
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
119 if (verify_only) { |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
120 ip->verify_data64_sethi( ip->addr_at(0), (intptr_t)x ); |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
121 } else { |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
122 ip->set_data64_sethi( ip->addr_at(0), (intptr_t)x ); |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
123 } |
0 | 124 #else |
125 guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi"); | |
126 inst &= ~Assembler::hi22( -1); | |
127 inst |= Assembler::hi22((intptr_t)x); | |
128 // (ignore offset; it doesn't play into the sethi) | |
2375
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
129 if (verify_only) { |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
130 assert(ip->long_at(0) == inst, "instructions must match"); |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
131 } else { |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
132 ip->set_long_at(0, inst); |
d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
1972
diff
changeset
|
133 } |
0 | 134 #endif |
135 } | |
136 break; | |
137 | |
138 default: | |
139 guarantee(false, "instruction must perform arithmetic or memory access"); | |
140 } | |
141 } | |
142 | |
143 | |
144 address Relocation::pd_call_destination(address orig_addr) { | |
145 intptr_t adj = 0; | |
146 if (orig_addr != NULL) { | |
147 // We just moved this call instruction from orig_addr to addr(). | |
148 // This means its target will appear to have grown by addr() - orig_addr. | |
149 adj = -( addr() - orig_addr ); | |
150 } | |
151 if (NativeCall::is_call_at(addr())) { | |
152 NativeCall* call = nativeCall_at(addr()); | |
153 return call->destination() + adj; | |
154 } | |
155 if (NativeFarCall::is_call_at(addr())) { | |
156 NativeFarCall* call = nativeFarCall_at(addr()); | |
157 return call->destination() + adj; | |
158 } | |
159 // Special case: Patchable branch local to the code cache. | |
160 // This will break badly if the code cache grows larger than a few Mb. | |
161 NativeGeneralJump* br = nativeGeneralJump_at(addr()); | |
162 return br->jump_destination() + adj; | |
163 } | |
164 | |
165 | |
166 void Relocation::pd_set_call_destination(address x) { | |
167 if (NativeCall::is_call_at(addr())) { | |
168 NativeCall* call = nativeCall_at(addr()); | |
169 call->set_destination(x); | |
170 return; | |
171 } | |
172 if (NativeFarCall::is_call_at(addr())) { | |
173 NativeFarCall* call = nativeFarCall_at(addr()); | |
174 call->set_destination(x); | |
175 return; | |
176 } | |
177 // Special case: Patchable branch local to the code cache. | |
178 // This will break badly if the code cache grows larger than a few Mb. | |
179 NativeGeneralJump* br = nativeGeneralJump_at(addr()); | |
180 br->set_jump_destination(x); | |
181 } | |
182 | |
183 | |
184 address* Relocation::pd_address_in_code() { | |
185 // SPARC never embeds addresses in code, at present. | |
186 //assert(type() == relocInfo::oop_type, "only oops are inlined at present"); | |
187 return (address*)addr(); | |
188 } | |
189 | |
190 | |
191 address Relocation::pd_get_address_from_code() { | |
192 // SPARC never embeds addresses in code, at present. | |
193 //assert(type() == relocInfo::oop_type, "only oops are inlined at present"); | |
194 return *(address*)addr(); | |
195 } | |
196 | |
197 | |
198 int Relocation::pd_breakpoint_size() { | |
199 // minimum breakpoint size, in short words | |
200 return NativeIllegalInstruction::instruction_size / sizeof(short); | |
201 } | |
202 | |
203 void Relocation::pd_swap_in_breakpoint(address x, short* instrs, int instrlen) { | |
204 Untested("pd_swap_in_breakpoint"); | |
205 // %%% probably do not need a general instrlen; just use the trap size | |
206 if (instrs != NULL) { | |
207 assert(instrlen * sizeof(short) == NativeIllegalInstruction::instruction_size, "enough instrlen in reloc. data"); | |
208 for (int i = 0; i < instrlen; i++) { | |
209 instrs[i] = ((short*)x)[i]; | |
210 } | |
211 } | |
212 NativeIllegalInstruction::insert(x); | |
213 } | |
214 | |
215 | |
216 void Relocation::pd_swap_out_breakpoint(address x, short* instrs, int instrlen) { | |
217 Untested("pd_swap_out_breakpoint"); | |
218 assert(instrlen * sizeof(short) == sizeof(int), "enough buf"); | |
219 union { int l; short s[1]; } u; | |
220 for (int i = 0; i < instrlen; i++) { | |
221 u.s[i] = instrs[i]; | |
222 } | |
223 NativeInstruction* ni = nativeInstruction_at(x); | |
224 ni->set_long_at(0, u.l); | |
225 } | |
304 | 226 |
227 void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { | |
228 } | |
229 | |
230 void poll_return_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { | |
231 } |