Mercurial > hg > graal-jvmci-8
annotate src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp @ 3249:e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
Summary: A referent object that is only weakly reachable at the start of concurrent marking but is re-attached to the strongly reachable object graph during marking may not be marked as live. This can cause the reference object to be processed prematurely and leave dangling pointers to the referent object. Implement a read barrier for the java.lang.ref.Reference::referent field by intrinsifying the Reference.get() method, and intercepting accesses though JNI, reflection, and Unsafe, so that when a non-null referent object is read it is also logged in an SATB buffer.
Reviewed-by: kvn, iveresov, never, tonyp, dholmes
author | johnc |
---|---|
date | Thu, 07 Apr 2011 09:53:20 -0700 |
parents | 32f7097f9d8f |
children | 59766fd005ff |
rev | line source |
---|---|
0 | 1 /* |
2168
e4fee0bdaa85
7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents:
2002
diff
changeset
|
2 * Copyright (c) 1999, 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:
1295
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1295
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:
1295
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "c1/c1_CodeStubs.hpp" | |
27 #include "c1/c1_FrameMap.hpp" | |
28 #include "c1/c1_LIRAssembler.hpp" | |
29 #include "c1/c1_MacroAssembler.hpp" | |
30 #include "c1/c1_Runtime1.hpp" | |
31 #include "nativeInst_sparc.hpp" | |
32 #include "runtime/sharedRuntime.hpp" | |
33 #include "vmreg_sparc.inline.hpp" | |
34 #ifndef SERIALGC | |
35 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" | |
36 #endif | |
0 | 37 |
38 #define __ ce->masm()-> | |
39 | |
40 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, | |
41 bool throw_index_out_of_bounds_exception) | |
42 : _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception) | |
43 , _index(index) | |
44 { | |
1819 | 45 assert(info != NULL, "must have info"); |
0 | 46 _info = new CodeEmitInfo(info); |
47 } | |
48 | |
49 | |
50 void RangeCheckStub::emit_code(LIR_Assembler* ce) { | |
51 __ bind(_entry); | |
52 | |
53 if (_index->is_register()) { | |
54 __ mov(_index->as_register(), G4); | |
55 } else { | |
56 __ set(_index->as_jint(), G4); | |
57 } | |
58 if (_throw_index_out_of_bounds_exception) { | |
59 __ call(Runtime1::entry_for(Runtime1::throw_index_exception_id), relocInfo::runtime_call_type); | |
60 } else { | |
61 __ call(Runtime1::entry_for(Runtime1::throw_range_check_failed_id), relocInfo::runtime_call_type); | |
62 } | |
63 __ delayed()->nop(); | |
64 ce->add_call_info_here(_info); | |
65 ce->verify_oop_map(_info); | |
66 #ifdef ASSERT | |
67 __ should_not_reach_here(); | |
68 #endif | |
69 } | |
70 | |
71 | |
72 void CounterOverflowStub::emit_code(LIR_Assembler* ce) { | |
73 __ bind(_entry); | |
74 __ set(_bci, G4); | |
75 __ call(Runtime1::entry_for(Runtime1::counter_overflow_id), relocInfo::runtime_call_type); | |
1783 | 76 __ delayed()->mov_or_nop(_method->as_register(), G5); |
0 | 77 ce->add_call_info_here(_info); |
78 ce->verify_oop_map(_info); | |
79 | |
80 __ br(Assembler::always, true, Assembler::pt, _continuation); | |
81 __ delayed()->nop(); | |
82 } | |
83 | |
84 | |
85 void DivByZeroStub::emit_code(LIR_Assembler* ce) { | |
86 if (_offset != -1) { | |
87 ce->compilation()->implicit_exception_table()->append(_offset, __ offset()); | |
88 } | |
89 __ bind(_entry); | |
90 __ call(Runtime1::entry_for(Runtime1::throw_div0_exception_id), relocInfo::runtime_call_type); | |
91 __ delayed()->nop(); | |
92 ce->add_call_info_here(_info); | |
93 ce->verify_oop_map(_info); | |
94 #ifdef ASSERT | |
95 __ should_not_reach_here(); | |
96 #endif | |
97 } | |
98 | |
99 | |
100 void ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) { | |
101 ce->compilation()->implicit_exception_table()->append(_offset, __ offset()); | |
102 __ bind(_entry); | |
103 __ call(Runtime1::entry_for(Runtime1::throw_null_pointer_exception_id), | |
104 relocInfo::runtime_call_type); | |
105 __ delayed()->nop(); | |
106 ce->add_call_info_here(_info); | |
107 ce->verify_oop_map(_info); | |
108 #ifdef ASSERT | |
109 __ should_not_reach_here(); | |
110 #endif | |
111 } | |
112 | |
113 | |
114 // Implementation of SimpleExceptionStub | |
115 // Note: %g1 and %g3 are already in use | |
116 void SimpleExceptionStub::emit_code(LIR_Assembler* ce) { | |
117 __ bind(_entry); | |
118 __ call(Runtime1::entry_for(_stub), relocInfo::runtime_call_type); | |
119 | |
120 if (_obj->is_valid()) { | |
121 __ delayed()->mov(_obj->as_register(), G4); // _obj contains the optional argument to the stub | |
122 } else { | |
123 __ delayed()->mov(G0, G4); | |
124 } | |
125 ce->add_call_info_here(_info); | |
126 #ifdef ASSERT | |
127 __ should_not_reach_here(); | |
128 #endif | |
129 } | |
130 | |
131 | |
132 // Implementation of NewInstanceStub | |
133 | |
134 NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) { | |
135 _result = result; | |
136 _klass = klass; | |
137 _klass_reg = klass_reg; | |
138 _info = new CodeEmitInfo(info); | |
139 assert(stub_id == Runtime1::new_instance_id || | |
140 stub_id == Runtime1::fast_new_instance_id || | |
141 stub_id == Runtime1::fast_new_instance_init_check_id, | |
142 "need new_instance id"); | |
143 _stub_id = stub_id; | |
144 } | |
145 | |
146 | |
147 void NewInstanceStub::emit_code(LIR_Assembler* ce) { | |
148 __ bind(_entry); | |
149 __ call(Runtime1::entry_for(_stub_id), relocInfo::runtime_call_type); | |
150 __ delayed()->mov_or_nop(_klass_reg->as_register(), G5); | |
151 ce->add_call_info_here(_info); | |
152 ce->verify_oop_map(_info); | |
153 __ br(Assembler::always, false, Assembler::pt, _continuation); | |
154 __ delayed()->mov_or_nop(O0, _result->as_register()); | |
155 } | |
156 | |
157 | |
158 // Implementation of NewTypeArrayStub | |
159 NewTypeArrayStub::NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) { | |
160 _klass_reg = klass_reg; | |
161 _length = length; | |
162 _result = result; | |
163 _info = new CodeEmitInfo(info); | |
164 } | |
165 | |
166 | |
167 void NewTypeArrayStub::emit_code(LIR_Assembler* ce) { | |
168 __ bind(_entry); | |
169 | |
170 __ mov(_length->as_register(), G4); | |
171 __ call(Runtime1::entry_for(Runtime1::new_type_array_id), relocInfo::runtime_call_type); | |
172 __ delayed()->mov_or_nop(_klass_reg->as_register(), G5); | |
173 ce->add_call_info_here(_info); | |
174 ce->verify_oop_map(_info); | |
175 __ br(Assembler::always, false, Assembler::pt, _continuation); | |
176 __ delayed()->mov_or_nop(O0, _result->as_register()); | |
177 } | |
178 | |
179 | |
180 // Implementation of NewObjectArrayStub | |
181 | |
182 NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) { | |
183 _klass_reg = klass_reg; | |
184 _length = length; | |
185 _result = result; | |
186 _info = new CodeEmitInfo(info); | |
187 } | |
188 | |
189 | |
190 void NewObjectArrayStub::emit_code(LIR_Assembler* ce) { | |
191 __ bind(_entry); | |
192 | |
193 __ mov(_length->as_register(), G4); | |
194 __ call(Runtime1::entry_for(Runtime1::new_object_array_id), relocInfo::runtime_call_type); | |
195 __ delayed()->mov_or_nop(_klass_reg->as_register(), G5); | |
196 ce->add_call_info_here(_info); | |
197 ce->verify_oop_map(_info); | |
198 __ br(Assembler::always, false, Assembler::pt, _continuation); | |
199 __ delayed()->mov_or_nop(O0, _result->as_register()); | |
200 } | |
201 | |
202 | |
203 // Implementation of MonitorAccessStubs | |
204 MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info) | |
205 : MonitorAccessStub(obj_reg, lock_reg) { | |
206 _info = new CodeEmitInfo(info); | |
207 } | |
208 | |
209 | |
210 void MonitorEnterStub::emit_code(LIR_Assembler* ce) { | |
211 __ bind(_entry); | |
212 __ mov(_obj_reg->as_register(), G4); | |
213 if (ce->compilation()->has_fpu_code()) { | |
214 __ call(Runtime1::entry_for(Runtime1::monitorenter_id), relocInfo::runtime_call_type); | |
215 } else { | |
216 __ call(Runtime1::entry_for(Runtime1::monitorenter_nofpu_id), relocInfo::runtime_call_type); | |
217 } | |
218 __ delayed()->mov_or_nop(_lock_reg->as_register(), G5); | |
219 ce->add_call_info_here(_info); | |
220 ce->verify_oop_map(_info); | |
221 __ br(Assembler::always, true, Assembler::pt, _continuation); | |
222 __ delayed()->nop(); | |
223 } | |
224 | |
225 | |
226 void MonitorExitStub::emit_code(LIR_Assembler* ce) { | |
227 __ bind(_entry); | |
228 if (_compute_lock) { | |
229 ce->monitor_address(_monitor_ix, _lock_reg); | |
230 } | |
231 if (ce->compilation()->has_fpu_code()) { | |
232 __ call(Runtime1::entry_for(Runtime1::monitorexit_id), relocInfo::runtime_call_type); | |
233 } else { | |
234 __ call(Runtime1::entry_for(Runtime1::monitorexit_nofpu_id), relocInfo::runtime_call_type); | |
235 } | |
236 | |
237 __ delayed()->mov_or_nop(_lock_reg->as_register(), G4); | |
238 __ br(Assembler::always, true, Assembler::pt, _continuation); | |
239 __ delayed()->nop(); | |
240 } | |
241 | |
242 // Implementation of patching: | |
243 // - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes) | |
244 // - Replace original code with a call to the stub | |
245 // At Runtime: | |
246 // - call to stub, jump to runtime | |
247 // - in runtime: preserve all registers (especially objects, i.e., source and destination object) | |
248 // - in runtime: after initializing class, restore original code, reexecute instruction | |
249 | |
250 int PatchingStub::_patch_info_offset = -NativeGeneralJump::instruction_size; | |
251 | |
252 void PatchingStub::align_patch_site(MacroAssembler* ) { | |
253 // patch sites on sparc are always properly aligned. | |
254 } | |
255 | |
256 void PatchingStub::emit_code(LIR_Assembler* ce) { | |
257 // copy original code here | |
258 assert(NativeCall::instruction_size <= _bytes_to_copy && _bytes_to_copy <= 0xFF, | |
259 "not enough room for call"); | |
260 assert((_bytes_to_copy & 0x3) == 0, "must copy a multiple of four bytes"); | |
261 | |
262 Label call_patch; | |
263 | |
264 int being_initialized_entry = __ offset(); | |
265 | |
266 if (_id == load_klass_id) { | |
267 // produce a copy of the load klass instruction for use by the being initialized case | |
727 | 268 #ifdef ASSERT |
0 | 269 address start = __ pc(); |
727 | 270 #endif |
271 AddressLiteral addrlit(NULL, oop_Relocation::spec(_oop_index)); | |
272 __ patchable_set(addrlit, _obj); | |
0 | 273 |
274 #ifdef ASSERT | |
275 for (int i = 0; i < _bytes_to_copy; i++) { | |
276 address ptr = (address)(_pc_start + i); | |
277 int a_byte = (*ptr) & 0xFF; | |
278 assert(a_byte == *start++, "should be the same code"); | |
279 } | |
280 #endif | |
281 } else { | |
282 // make a copy the code which is going to be patched. | |
283 for (int i = 0; i < _bytes_to_copy; i++) { | |
284 address ptr = (address)(_pc_start + i); | |
285 int a_byte = (*ptr) & 0xFF; | |
286 __ a_byte (a_byte); | |
287 } | |
288 } | |
289 | |
290 address end_of_patch = __ pc(); | |
291 int bytes_to_skip = 0; | |
292 if (_id == load_klass_id) { | |
293 int offset = __ offset(); | |
294 if (CommentedAssembly) { | |
295 __ block_comment(" being_initialized check"); | |
296 } | |
297 | |
298 // static field accesses have special semantics while the class | |
299 // initializer is being run so we emit a test which can be used to | |
300 // check that this code is being executed by the initializing | |
301 // thread. | |
302 assert(_obj != noreg, "must be a valid register"); | |
303 assert(_oop_index >= 0, "must have oop index"); | |
2380
32f7097f9d8f
7030300: more nightly failures after statics in Class changes
never
parents:
2376
diff
changeset
|
304 __ load_heap_oop(_obj, java_lang_Class::klass_offset_in_bytes(), G3); |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2168
diff
changeset
|
305 __ ld_ptr(G3, instanceKlass::init_thread_offset_in_bytes() + sizeof(klassOopDesc), G3); |
0 | 306 __ cmp(G2_thread, G3); |
307 __ br(Assembler::notEqual, false, Assembler::pn, call_patch); | |
308 __ delayed()->nop(); | |
309 | |
310 // load_klass patches may execute the patched code before it's | |
311 // copied back into place so we need to jump back into the main | |
312 // code of the nmethod to continue execution. | |
313 __ br(Assembler::always, false, Assembler::pt, _patch_site_continuation); | |
314 __ delayed()->nop(); | |
315 | |
316 // make sure this extra code gets skipped | |
317 bytes_to_skip += __ offset() - offset; | |
318 } | |
319 | |
320 // Now emit the patch record telling the runtime how to find the | |
321 // pieces of the patch. We only need 3 bytes but it has to be | |
322 // aligned as an instruction so emit 4 bytes. | |
323 int sizeof_patch_record = 4; | |
324 bytes_to_skip += sizeof_patch_record; | |
325 | |
326 // emit the offsets needed to find the code to patch | |
327 int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record; | |
328 | |
329 // Emit the patch record. We need to emit a full word, so emit an extra empty byte | |
330 __ a_byte(0); | |
331 __ a_byte(being_initialized_entry_offset); | |
332 __ a_byte(bytes_to_skip); | |
333 __ a_byte(_bytes_to_copy); | |
334 address patch_info_pc = __ pc(); | |
335 assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info"); | |
336 | |
337 address entry = __ pc(); | |
338 NativeGeneralJump::insert_unconditional((address)_pc_start, entry); | |
339 address target = NULL; | |
340 switch (_id) { | |
341 case access_field_id: target = Runtime1::entry_for(Runtime1::access_field_patching_id); break; | |
342 case load_klass_id: target = Runtime1::entry_for(Runtime1::load_klass_patching_id); break; | |
343 default: ShouldNotReachHere(); | |
344 } | |
345 __ bind(call_patch); | |
346 | |
347 if (CommentedAssembly) { | |
348 __ block_comment("patch entry point"); | |
349 } | |
350 __ call(target, relocInfo::runtime_call_type); | |
351 __ delayed()->nop(); | |
352 assert(_patch_info_offset == (patch_info_pc - __ pc()), "must not change"); | |
353 ce->add_call_info_here(_info); | |
354 __ br(Assembler::always, false, Assembler::pt, _patch_site_entry); | |
355 __ delayed()->nop(); | |
356 if (_id == load_klass_id) { | |
357 CodeSection* cs = __ code_section(); | |
358 address pc = (address)_pc_start; | |
359 RelocIterator iter(cs, pc, pc + 1); | |
360 relocInfo::change_reloc_info_for_address(&iter, (address) pc, relocInfo::oop_type, relocInfo::none); | |
361 | |
362 pc = (address)(_pc_start + NativeMovConstReg::add_offset); | |
363 RelocIterator iter2(cs, pc, pc+1); | |
364 relocInfo::change_reloc_info_for_address(&iter2, (address) pc, relocInfo::oop_type, relocInfo::none); | |
365 } | |
366 | |
367 } | |
368 | |
1295 | 369 |
370 void DeoptimizeStub::emit_code(LIR_Assembler* ce) { | |
371 __ bind(_entry); | |
372 __ call(SharedRuntime::deopt_blob()->unpack_with_reexecution()); | |
373 __ delayed()->nop(); | |
374 ce->add_call_info_here(_info); | |
375 debug_only(__ should_not_reach_here()); | |
376 } | |
377 | |
378 | |
0 | 379 void ArrayCopyStub::emit_code(LIR_Assembler* ce) { |
380 //---------------slow case: call to native----------------- | |
381 __ bind(_entry); | |
382 __ mov(src()->as_register(), O0); | |
383 __ mov(src_pos()->as_register(), O1); | |
384 __ mov(dst()->as_register(), O2); | |
385 __ mov(dst_pos()->as_register(), O3); | |
386 __ mov(length()->as_register(), O4); | |
387 | |
388 ce->emit_static_call_stub(); | |
389 | |
390 __ call(SharedRuntime::get_resolve_static_call_stub(), relocInfo::static_call_type); | |
391 __ delayed()->nop(); | |
392 ce->add_call_info_here(info()); | |
393 ce->verify_oop_map(info()); | |
394 | |
395 #ifndef PRODUCT | |
396 __ set((intptr_t)&Runtime1::_arraycopy_slowcase_cnt, O0); | |
397 __ ld(O0, 0, O1); | |
398 __ inc(O1); | |
399 __ st(O1, 0, O0); | |
400 #endif | |
401 | |
402 __ br(Assembler::always, false, Assembler::pt, _continuation); | |
403 __ delayed()->nop(); | |
404 } | |
405 | |
406 | |
342 | 407 /////////////////////////////////////////////////////////////////////////////////// |
408 #ifndef SERIALGC | |
409 | |
410 void G1PreBarrierStub::emit_code(LIR_Assembler* ce) { | |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
411 // At this point we know that marking is in progress. |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
412 // If do_load() is true then we have to emit the |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
413 // load of the previous value; otherwise it has already |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
414 // been loaded into _pre_val. |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
415 |
342 | 416 __ bind(_entry); |
417 | |
418 assert(pre_val()->is_register(), "Precondition."); | |
419 Register pre_val_reg = pre_val()->as_register(); | |
420 | |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
421 if (do_load()) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
422 ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
423 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
424 |
1848 | 425 if (__ is_in_wdisp16_range(_continuation)) { |
426 __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, | |
427 pre_val_reg, _continuation); | |
428 } else { | |
429 __ cmp(pre_val_reg, G0); | |
430 __ brx(Assembler::equal, false, Assembler::pn, _continuation); | |
431 } | |
342 | 432 __ delayed()->nop(); |
433 | |
434 __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id)); | |
435 __ delayed()->mov(pre_val_reg, G4); | |
436 __ br(Assembler::always, false, Assembler::pt, _continuation); | |
437 __ delayed()->nop(); | |
438 | |
439 } | |
440 | |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
441 void G1UnsafeGetObjSATBBarrierStub::emit_code(LIR_Assembler* ce) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
442 // At this point we know that offset == referent_offset. |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
443 // |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
444 // So we might have to emit: |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
445 // if (src == null) goto continuation. |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
446 // |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
447 // and we definitely have to emit: |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
448 // if (klass(src).reference_type == REF_NONE) goto continuation |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
449 // if (!marking_active) goto continuation |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
450 // if (pre_val == null) goto continuation |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
451 // call pre_barrier(pre_val) |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
452 // goto continuation |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
453 // |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
454 __ bind(_entry); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
455 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
456 assert(src()->is_register(), "sanity"); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
457 Register src_reg = src()->as_register(); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
458 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
459 if (gen_src_check()) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
460 // The original src operand was not a constant. |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
461 // Generate src == null? |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
462 if (__ is_in_wdisp16_range(_continuation)) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
463 __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
464 src_reg, _continuation); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
465 } else { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
466 __ cmp(src_reg, G0); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
467 __ brx(Assembler::equal, false, Assembler::pt, _continuation); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
468 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
469 __ delayed()->nop(); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
470 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
471 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
472 // Generate src->_klass->_reference_type() == REF_NONE)? |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
473 assert(tmp()->is_register(), "sanity"); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
474 Register tmp_reg = tmp()->as_register(); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
475 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
476 __ load_klass(src_reg, tmp_reg); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
477 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
478 Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset_in_bytes() + sizeof(oopDesc)); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
479 __ ld(ref_type_adr, tmp_reg); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
480 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
481 if (__ is_in_wdisp16_range(_continuation)) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
482 __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
483 tmp_reg, _continuation); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
484 } else { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
485 __ cmp(tmp_reg, G0); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
486 __ brx(Assembler::equal, false, Assembler::pt, _continuation); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
487 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
488 __ delayed()->nop(); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
489 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
490 // Is marking active? |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
491 assert(thread()->is_register(), "precondition"); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
492 Register thread_reg = thread()->as_register(); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
493 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
494 Address in_progress(thread_reg, in_bytes(JavaThread::satb_mark_queue_offset() + |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
495 PtrQueue::byte_offset_of_active())); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
496 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
497 if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
498 __ ld(in_progress, tmp_reg); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
499 } else { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
500 assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption"); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
501 __ ldsb(in_progress, tmp_reg); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
502 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
503 if (__ is_in_wdisp16_range(_continuation)) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
504 __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
505 tmp_reg, _continuation); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
506 } else { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
507 __ cmp(tmp_reg, G0); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
508 __ brx(Assembler::equal, false, Assembler::pt, _continuation); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
509 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
510 __ delayed()->nop(); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
511 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
512 // val == null? |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
513 assert(val()->is_register(), "Precondition."); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
514 Register val_reg = val()->as_register(); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
515 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
516 if (__ is_in_wdisp16_range(_continuation)) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
517 __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
518 val_reg, _continuation); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
519 } else { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
520 __ cmp(val_reg, G0); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
521 __ brx(Assembler::equal, false, Assembler::pt, _continuation); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
522 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
523 __ delayed()->nop(); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
524 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
525 __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id)); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
526 __ delayed()->mov(val_reg, G4); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
527 __ br(Assembler::always, false, Assembler::pt, _continuation); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
528 __ delayed()->nop(); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
529 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2380
diff
changeset
|
530 |
342 | 531 jbyte* G1PostBarrierStub::_byte_map_base = NULL; |
532 | |
533 jbyte* G1PostBarrierStub::byte_map_base_slow() { | |
534 BarrierSet* bs = Universe::heap()->barrier_set(); | |
535 assert(bs->is_a(BarrierSet::G1SATBCTLogging), | |
536 "Must be if we're using this."); | |
537 return ((G1SATBCardTableModRefBS*)bs)->byte_map_base; | |
538 } | |
539 | |
540 void G1PostBarrierStub::emit_code(LIR_Assembler* ce) { | |
541 __ bind(_entry); | |
542 | |
543 assert(addr()->is_register(), "Precondition."); | |
544 assert(new_val()->is_register(), "Precondition."); | |
545 Register addr_reg = addr()->as_pointer_register(); | |
546 Register new_val_reg = new_val()->as_register(); | |
1848 | 547 if (__ is_in_wdisp16_range(_continuation)) { |
548 __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, | |
549 new_val_reg, _continuation); | |
550 } else { | |
551 __ cmp(new_val_reg, G0); | |
552 __ brx(Assembler::equal, false, Assembler::pn, _continuation); | |
553 } | |
342 | 554 __ delayed()->nop(); |
555 | |
556 __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_post_barrier_slow_id)); | |
557 __ delayed()->mov(addr_reg, G4); | |
558 __ br(Assembler::always, false, Assembler::pt, _continuation); | |
559 __ delayed()->nop(); | |
560 } | |
561 | |
562 #endif // SERIALGC | |
563 /////////////////////////////////////////////////////////////////////////////////// | |
564 | |
0 | 565 #undef __ |