src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp

Thu, 21 Mar 2013 09:27:54 +0100

author
roland
date
Thu, 21 Mar 2013 09:27:54 +0100
changeset 4860
46f6f063b272
parent 4542
db9981fd3124
child 5628
f98f5d48f511
permissions
-rw-r--r--

7153771: array bound check elimination for c1
Summary: when possible optimize out array bound checks, inserting predicates when needed.
Reviewed-by: never, kvn, twisti
Contributed-by: thomaswue <thomas.wuerthinger@oracle.com>

duke@435 1 /*
coleenp@4037 2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
stefank@2314 26 #include "c1/c1_CodeStubs.hpp"
stefank@2314 27 #include "c1/c1_FrameMap.hpp"
stefank@2314 28 #include "c1/c1_LIRAssembler.hpp"
stefank@2314 29 #include "c1/c1_MacroAssembler.hpp"
stefank@2314 30 #include "c1/c1_Runtime1.hpp"
stefank@2314 31 #include "nativeInst_sparc.hpp"
stefank@2314 32 #include "runtime/sharedRuntime.hpp"
jprovino@4542 33 #include "utilities/macros.hpp"
stefank@2314 34 #include "vmreg_sparc.inline.hpp"
jprovino@4542 35 #if INCLUDE_ALL_GCS
stefank@2314 36 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
jprovino@4542 37 #endif // INCLUDE_ALL_GCS
duke@435 38
duke@435 39 #define __ ce->masm()->
duke@435 40
duke@435 41 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index,
duke@435 42 bool throw_index_out_of_bounds_exception)
duke@435 43 : _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception)
duke@435 44 , _index(index)
duke@435 45 {
roland@2174 46 assert(info != NULL, "must have info");
duke@435 47 _info = new CodeEmitInfo(info);
duke@435 48 }
duke@435 49
duke@435 50
duke@435 51 void RangeCheckStub::emit_code(LIR_Assembler* ce) {
duke@435 52 __ bind(_entry);
duke@435 53
roland@4860 54 if (_info->deoptimize_on_exception()) {
roland@4860 55 address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
roland@4860 56 __ call(a, relocInfo::runtime_call_type);
roland@4860 57 __ delayed()->nop();
roland@4860 58 ce->add_call_info_here(_info);
roland@4860 59 ce->verify_oop_map(_info);
roland@4860 60 debug_only(__ should_not_reach_here());
roland@4860 61 return;
roland@4860 62 }
roland@4860 63
duke@435 64 if (_index->is_register()) {
duke@435 65 __ mov(_index->as_register(), G4);
duke@435 66 } else {
duke@435 67 __ set(_index->as_jint(), G4);
duke@435 68 }
duke@435 69 if (_throw_index_out_of_bounds_exception) {
duke@435 70 __ call(Runtime1::entry_for(Runtime1::throw_index_exception_id), relocInfo::runtime_call_type);
duke@435 71 } else {
duke@435 72 __ call(Runtime1::entry_for(Runtime1::throw_range_check_failed_id), relocInfo::runtime_call_type);
duke@435 73 }
duke@435 74 __ delayed()->nop();
duke@435 75 ce->add_call_info_here(_info);
duke@435 76 ce->verify_oop_map(_info);
roland@4860 77 debug_only(__ should_not_reach_here());
duke@435 78 }
duke@435 79
roland@4860 80 PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {
roland@4860 81 _info = new CodeEmitInfo(info);
roland@4860 82 }
roland@4860 83
roland@4860 84 void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
roland@4860 85 __ bind(_entry);
roland@4860 86 address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
roland@4860 87 __ call(a, relocInfo::runtime_call_type);
roland@4860 88 __ delayed()->nop();
roland@4860 89 ce->add_call_info_here(_info);
roland@4860 90 ce->verify_oop_map(_info);
roland@4860 91 debug_only(__ should_not_reach_here());
roland@4860 92 }
duke@435 93
duke@435 94 void CounterOverflowStub::emit_code(LIR_Assembler* ce) {
duke@435 95 __ bind(_entry);
duke@435 96 __ set(_bci, G4);
duke@435 97 __ call(Runtime1::entry_for(Runtime1::counter_overflow_id), relocInfo::runtime_call_type);
iveresov@2138 98 __ delayed()->mov_or_nop(_method->as_register(), G5);
duke@435 99 ce->add_call_info_here(_info);
duke@435 100 ce->verify_oop_map(_info);
duke@435 101
duke@435 102 __ br(Assembler::always, true, Assembler::pt, _continuation);
duke@435 103 __ delayed()->nop();
duke@435 104 }
duke@435 105
duke@435 106
duke@435 107 void DivByZeroStub::emit_code(LIR_Assembler* ce) {
duke@435 108 if (_offset != -1) {
duke@435 109 ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
duke@435 110 }
duke@435 111 __ bind(_entry);
duke@435 112 __ call(Runtime1::entry_for(Runtime1::throw_div0_exception_id), relocInfo::runtime_call_type);
duke@435 113 __ delayed()->nop();
duke@435 114 ce->add_call_info_here(_info);
duke@435 115 ce->verify_oop_map(_info);
duke@435 116 #ifdef ASSERT
duke@435 117 __ should_not_reach_here();
duke@435 118 #endif
duke@435 119 }
duke@435 120
duke@435 121
duke@435 122 void ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) {
roland@4860 123 address a;
roland@4860 124 if (_info->deoptimize_on_exception()) {
roland@4860 125 // Deoptimize, do not throw the exception, because it is probably wrong to do it here.
roland@4860 126 a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
roland@4860 127 } else {
roland@4860 128 a = Runtime1::entry_for(Runtime1::throw_null_pointer_exception_id);
roland@4860 129 }
roland@4860 130
duke@435 131 ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
duke@435 132 __ bind(_entry);
roland@4860 133 __ call(a, relocInfo::runtime_call_type);
duke@435 134 __ delayed()->nop();
duke@435 135 ce->add_call_info_here(_info);
duke@435 136 ce->verify_oop_map(_info);
duke@435 137 #ifdef ASSERT
duke@435 138 __ should_not_reach_here();
duke@435 139 #endif
duke@435 140 }
duke@435 141
duke@435 142
duke@435 143 // Implementation of SimpleExceptionStub
duke@435 144 // Note: %g1 and %g3 are already in use
duke@435 145 void SimpleExceptionStub::emit_code(LIR_Assembler* ce) {
duke@435 146 __ bind(_entry);
duke@435 147 __ call(Runtime1::entry_for(_stub), relocInfo::runtime_call_type);
duke@435 148
duke@435 149 if (_obj->is_valid()) {
duke@435 150 __ delayed()->mov(_obj->as_register(), G4); // _obj contains the optional argument to the stub
duke@435 151 } else {
duke@435 152 __ delayed()->mov(G0, G4);
duke@435 153 }
duke@435 154 ce->add_call_info_here(_info);
duke@435 155 #ifdef ASSERT
duke@435 156 __ should_not_reach_here();
duke@435 157 #endif
duke@435 158 }
duke@435 159
duke@435 160
duke@435 161 // Implementation of NewInstanceStub
duke@435 162
duke@435 163 NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) {
duke@435 164 _result = result;
duke@435 165 _klass = klass;
duke@435 166 _klass_reg = klass_reg;
duke@435 167 _info = new CodeEmitInfo(info);
duke@435 168 assert(stub_id == Runtime1::new_instance_id ||
duke@435 169 stub_id == Runtime1::fast_new_instance_id ||
duke@435 170 stub_id == Runtime1::fast_new_instance_init_check_id,
duke@435 171 "need new_instance id");
duke@435 172 _stub_id = stub_id;
duke@435 173 }
duke@435 174
duke@435 175
duke@435 176 void NewInstanceStub::emit_code(LIR_Assembler* ce) {
duke@435 177 __ bind(_entry);
duke@435 178 __ call(Runtime1::entry_for(_stub_id), relocInfo::runtime_call_type);
duke@435 179 __ delayed()->mov_or_nop(_klass_reg->as_register(), G5);
duke@435 180 ce->add_call_info_here(_info);
duke@435 181 ce->verify_oop_map(_info);
duke@435 182 __ br(Assembler::always, false, Assembler::pt, _continuation);
duke@435 183 __ delayed()->mov_or_nop(O0, _result->as_register());
duke@435 184 }
duke@435 185
duke@435 186
duke@435 187 // Implementation of NewTypeArrayStub
duke@435 188 NewTypeArrayStub::NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
duke@435 189 _klass_reg = klass_reg;
duke@435 190 _length = length;
duke@435 191 _result = result;
duke@435 192 _info = new CodeEmitInfo(info);
duke@435 193 }
duke@435 194
duke@435 195
duke@435 196 void NewTypeArrayStub::emit_code(LIR_Assembler* ce) {
duke@435 197 __ bind(_entry);
duke@435 198
duke@435 199 __ mov(_length->as_register(), G4);
duke@435 200 __ call(Runtime1::entry_for(Runtime1::new_type_array_id), relocInfo::runtime_call_type);
duke@435 201 __ delayed()->mov_or_nop(_klass_reg->as_register(), G5);
duke@435 202 ce->add_call_info_here(_info);
duke@435 203 ce->verify_oop_map(_info);
duke@435 204 __ br(Assembler::always, false, Assembler::pt, _continuation);
duke@435 205 __ delayed()->mov_or_nop(O0, _result->as_register());
duke@435 206 }
duke@435 207
duke@435 208
duke@435 209 // Implementation of NewObjectArrayStub
duke@435 210
duke@435 211 NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
duke@435 212 _klass_reg = klass_reg;
duke@435 213 _length = length;
duke@435 214 _result = result;
duke@435 215 _info = new CodeEmitInfo(info);
duke@435 216 }
duke@435 217
duke@435 218
duke@435 219 void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
duke@435 220 __ bind(_entry);
duke@435 221
duke@435 222 __ mov(_length->as_register(), G4);
duke@435 223 __ call(Runtime1::entry_for(Runtime1::new_object_array_id), relocInfo::runtime_call_type);
duke@435 224 __ delayed()->mov_or_nop(_klass_reg->as_register(), G5);
duke@435 225 ce->add_call_info_here(_info);
duke@435 226 ce->verify_oop_map(_info);
duke@435 227 __ br(Assembler::always, false, Assembler::pt, _continuation);
duke@435 228 __ delayed()->mov_or_nop(O0, _result->as_register());
duke@435 229 }
duke@435 230
duke@435 231
duke@435 232 // Implementation of MonitorAccessStubs
duke@435 233 MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info)
duke@435 234 : MonitorAccessStub(obj_reg, lock_reg) {
duke@435 235 _info = new CodeEmitInfo(info);
duke@435 236 }
duke@435 237
duke@435 238
duke@435 239 void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
duke@435 240 __ bind(_entry);
duke@435 241 __ mov(_obj_reg->as_register(), G4);
duke@435 242 if (ce->compilation()->has_fpu_code()) {
duke@435 243 __ call(Runtime1::entry_for(Runtime1::monitorenter_id), relocInfo::runtime_call_type);
duke@435 244 } else {
duke@435 245 __ call(Runtime1::entry_for(Runtime1::monitorenter_nofpu_id), relocInfo::runtime_call_type);
duke@435 246 }
duke@435 247 __ delayed()->mov_or_nop(_lock_reg->as_register(), G5);
duke@435 248 ce->add_call_info_here(_info);
duke@435 249 ce->verify_oop_map(_info);
duke@435 250 __ br(Assembler::always, true, Assembler::pt, _continuation);
duke@435 251 __ delayed()->nop();
duke@435 252 }
duke@435 253
duke@435 254
duke@435 255 void MonitorExitStub::emit_code(LIR_Assembler* ce) {
duke@435 256 __ bind(_entry);
duke@435 257 if (_compute_lock) {
duke@435 258 ce->monitor_address(_monitor_ix, _lock_reg);
duke@435 259 }
duke@435 260 if (ce->compilation()->has_fpu_code()) {
duke@435 261 __ call(Runtime1::entry_for(Runtime1::monitorexit_id), relocInfo::runtime_call_type);
duke@435 262 } else {
duke@435 263 __ call(Runtime1::entry_for(Runtime1::monitorexit_nofpu_id), relocInfo::runtime_call_type);
duke@435 264 }
duke@435 265
duke@435 266 __ delayed()->mov_or_nop(_lock_reg->as_register(), G4);
duke@435 267 __ br(Assembler::always, true, Assembler::pt, _continuation);
duke@435 268 __ delayed()->nop();
duke@435 269 }
duke@435 270
duke@435 271 // Implementation of patching:
duke@435 272 // - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes)
duke@435 273 // - Replace original code with a call to the stub
duke@435 274 // At Runtime:
duke@435 275 // - call to stub, jump to runtime
duke@435 276 // - in runtime: preserve all registers (especially objects, i.e., source and destination object)
duke@435 277 // - in runtime: after initializing class, restore original code, reexecute instruction
duke@435 278
duke@435 279 int PatchingStub::_patch_info_offset = -NativeGeneralJump::instruction_size;
duke@435 280
duke@435 281 void PatchingStub::align_patch_site(MacroAssembler* ) {
duke@435 282 // patch sites on sparc are always properly aligned.
duke@435 283 }
duke@435 284
duke@435 285 void PatchingStub::emit_code(LIR_Assembler* ce) {
duke@435 286 // copy original code here
duke@435 287 assert(NativeCall::instruction_size <= _bytes_to_copy && _bytes_to_copy <= 0xFF,
duke@435 288 "not enough room for call");
duke@435 289 assert((_bytes_to_copy & 0x3) == 0, "must copy a multiple of four bytes");
duke@435 290
duke@435 291 Label call_patch;
duke@435 292
duke@435 293 int being_initialized_entry = __ offset();
duke@435 294
duke@435 295 if (_id == load_klass_id) {
duke@435 296 // produce a copy of the load klass instruction for use by the being initialized case
twisti@1162 297 #ifdef ASSERT
duke@435 298 address start = __ pc();
twisti@1162 299 #endif
coleenp@4037 300 AddressLiteral addrlit(NULL, metadata_Relocation::spec(_index));
coleenp@4037 301 __ patchable_set(addrlit, _obj);
coleenp@4037 302
coleenp@4037 303 #ifdef ASSERT
coleenp@4037 304 for (int i = 0; i < _bytes_to_copy; i++) {
coleenp@4037 305 address ptr = (address)(_pc_start + i);
coleenp@4037 306 int a_byte = (*ptr) & 0xFF;
coleenp@4037 307 assert(a_byte == *start++, "should be the same code");
coleenp@4037 308 }
coleenp@4037 309 #endif
coleenp@4037 310 } else if (_id == load_mirror_id) {
coleenp@4037 311 // produce a copy of the load mirror instruction for use by the being initialized case
coleenp@4037 312 #ifdef ASSERT
coleenp@4037 313 address start = __ pc();
coleenp@4037 314 #endif
coleenp@4037 315 AddressLiteral addrlit(NULL, oop_Relocation::spec(_index));
twisti@1162 316 __ patchable_set(addrlit, _obj);
duke@435 317
duke@435 318 #ifdef ASSERT
duke@435 319 for (int i = 0; i < _bytes_to_copy; i++) {
duke@435 320 address ptr = (address)(_pc_start + i);
duke@435 321 int a_byte = (*ptr) & 0xFF;
duke@435 322 assert(a_byte == *start++, "should be the same code");
duke@435 323 }
duke@435 324 #endif
duke@435 325 } else {
duke@435 326 // make a copy the code which is going to be patched.
duke@435 327 for (int i = 0; i < _bytes_to_copy; i++) {
duke@435 328 address ptr = (address)(_pc_start + i);
duke@435 329 int a_byte = (*ptr) & 0xFF;
twisti@4366 330 __ emit_int8 (a_byte);
duke@435 331 }
duke@435 332 }
duke@435 333
duke@435 334 address end_of_patch = __ pc();
duke@435 335 int bytes_to_skip = 0;
coleenp@4037 336 if (_id == load_mirror_id) {
duke@435 337 int offset = __ offset();
duke@435 338 if (CommentedAssembly) {
duke@435 339 __ block_comment(" being_initialized check");
duke@435 340 }
duke@435 341
duke@435 342 // static field accesses have special semantics while the class
duke@435 343 // initializer is being run so we emit a test which can be used to
duke@435 344 // check that this code is being executed by the initializing
duke@435 345 // thread.
duke@435 346 assert(_obj != noreg, "must be a valid register");
coleenp@4037 347 assert(_index >= 0, "must have oop index");
coleenp@4037 348 __ ld_ptr(_obj, java_lang_Class::klass_offset_in_bytes(), G3);
coleenp@4037 349 __ ld_ptr(G3, in_bytes(InstanceKlass::init_thread_offset()), G3);
kvn@3037 350 __ cmp_and_brx_short(G2_thread, G3, Assembler::notEqual, Assembler::pn, call_patch);
duke@435 351
duke@435 352 // load_klass patches may execute the patched code before it's
duke@435 353 // copied back into place so we need to jump back into the main
duke@435 354 // code of the nmethod to continue execution.
duke@435 355 __ br(Assembler::always, false, Assembler::pt, _patch_site_continuation);
duke@435 356 __ delayed()->nop();
duke@435 357
duke@435 358 // make sure this extra code gets skipped
duke@435 359 bytes_to_skip += __ offset() - offset;
duke@435 360 }
duke@435 361
duke@435 362 // Now emit the patch record telling the runtime how to find the
duke@435 363 // pieces of the patch. We only need 3 bytes but it has to be
duke@435 364 // aligned as an instruction so emit 4 bytes.
duke@435 365 int sizeof_patch_record = 4;
duke@435 366 bytes_to_skip += sizeof_patch_record;
duke@435 367
duke@435 368 // emit the offsets needed to find the code to patch
duke@435 369 int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record;
duke@435 370
duke@435 371 // Emit the patch record. We need to emit a full word, so emit an extra empty byte
twisti@4366 372 __ emit_int8(0);
twisti@4366 373 __ emit_int8(being_initialized_entry_offset);
twisti@4366 374 __ emit_int8(bytes_to_skip);
twisti@4366 375 __ emit_int8(_bytes_to_copy);
duke@435 376 address patch_info_pc = __ pc();
duke@435 377 assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info");
duke@435 378
duke@435 379 address entry = __ pc();
duke@435 380 NativeGeneralJump::insert_unconditional((address)_pc_start, entry);
duke@435 381 address target = NULL;
coleenp@4037 382 relocInfo::relocType reloc_type = relocInfo::none;
duke@435 383 switch (_id) {
duke@435 384 case access_field_id: target = Runtime1::entry_for(Runtime1::access_field_patching_id); break;
coleenp@4037 385 case load_klass_id: target = Runtime1::entry_for(Runtime1::load_klass_patching_id); reloc_type = relocInfo::metadata_type; break;
coleenp@4037 386 case load_mirror_id: target = Runtime1::entry_for(Runtime1::load_mirror_patching_id); reloc_type = relocInfo::oop_type; break;
duke@435 387 default: ShouldNotReachHere();
duke@435 388 }
duke@435 389 __ bind(call_patch);
duke@435 390
duke@435 391 if (CommentedAssembly) {
duke@435 392 __ block_comment("patch entry point");
duke@435 393 }
duke@435 394 __ call(target, relocInfo::runtime_call_type);
duke@435 395 __ delayed()->nop();
duke@435 396 assert(_patch_info_offset == (patch_info_pc - __ pc()), "must not change");
duke@435 397 ce->add_call_info_here(_info);
duke@435 398 __ br(Assembler::always, false, Assembler::pt, _patch_site_entry);
duke@435 399 __ delayed()->nop();
coleenp@4037 400 if (_id == load_klass_id || _id == load_mirror_id) {
duke@435 401 CodeSection* cs = __ code_section();
duke@435 402 address pc = (address)_pc_start;
duke@435 403 RelocIterator iter(cs, pc, pc + 1);
coleenp@4037 404 relocInfo::change_reloc_info_for_address(&iter, (address) pc, reloc_type, relocInfo::none);
duke@435 405
duke@435 406 pc = (address)(_pc_start + NativeMovConstReg::add_offset);
duke@435 407 RelocIterator iter2(cs, pc, pc+1);
coleenp@4037 408 relocInfo::change_reloc_info_for_address(&iter2, (address) pc, reloc_type, relocInfo::none);
duke@435 409 }
duke@435 410
duke@435 411 }
duke@435 412
twisti@1730 413
twisti@1730 414 void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
twisti@1730 415 __ bind(_entry);
twisti@3244 416 __ call(Runtime1::entry_for(Runtime1::deoptimize_id), relocInfo::runtime_call_type);
twisti@1730 417 __ delayed()->nop();
twisti@1730 418 ce->add_call_info_here(_info);
twisti@3244 419 DEBUG_ONLY(__ should_not_reach_here());
twisti@1730 420 }
twisti@1730 421
twisti@1730 422
duke@435 423 void ArrayCopyStub::emit_code(LIR_Assembler* ce) {
duke@435 424 //---------------slow case: call to native-----------------
duke@435 425 __ bind(_entry);
duke@435 426 __ mov(src()->as_register(), O0);
duke@435 427 __ mov(src_pos()->as_register(), O1);
duke@435 428 __ mov(dst()->as_register(), O2);
duke@435 429 __ mov(dst_pos()->as_register(), O3);
duke@435 430 __ mov(length()->as_register(), O4);
duke@435 431
duke@435 432 ce->emit_static_call_stub();
duke@435 433
duke@435 434 __ call(SharedRuntime::get_resolve_static_call_stub(), relocInfo::static_call_type);
duke@435 435 __ delayed()->nop();
duke@435 436 ce->add_call_info_here(info());
duke@435 437 ce->verify_oop_map(info());
duke@435 438
duke@435 439 #ifndef PRODUCT
duke@435 440 __ set((intptr_t)&Runtime1::_arraycopy_slowcase_cnt, O0);
duke@435 441 __ ld(O0, 0, O1);
duke@435 442 __ inc(O1);
duke@435 443 __ st(O1, 0, O0);
duke@435 444 #endif
duke@435 445
duke@435 446 __ br(Assembler::always, false, Assembler::pt, _continuation);
duke@435 447 __ delayed()->nop();
duke@435 448 }
duke@435 449
duke@435 450
ysr@777 451 ///////////////////////////////////////////////////////////////////////////////////
jprovino@4542 452 #if INCLUDE_ALL_GCS
ysr@777 453
ysr@777 454 void G1PreBarrierStub::emit_code(LIR_Assembler* ce) {
johnc@2781 455 // At this point we know that marking is in progress.
johnc@2781 456 // If do_load() is true then we have to emit the
johnc@2781 457 // load of the previous value; otherwise it has already
johnc@2781 458 // been loaded into _pre_val.
johnc@2781 459
ysr@777 460 __ bind(_entry);
ysr@777 461
ysr@777 462 assert(pre_val()->is_register(), "Precondition.");
ysr@777 463 Register pre_val_reg = pre_val()->as_register();
ysr@777 464
johnc@2781 465 if (do_load()) {
johnc@2781 466 ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/);
johnc@2781 467 }
johnc@2781 468
iveresov@2203 469 if (__ is_in_wdisp16_range(_continuation)) {
johnc@3088 470 __ br_null(pre_val_reg, /*annul*/false, Assembler::pt, _continuation);
iveresov@2203 471 } else {
iveresov@2203 472 __ cmp(pre_val_reg, G0);
iveresov@2203 473 __ brx(Assembler::equal, false, Assembler::pn, _continuation);
iveresov@2203 474 }
ysr@777 475 __ delayed()->nop();
ysr@777 476
ysr@777 477 __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id));
ysr@777 478 __ delayed()->mov(pre_val_reg, G4);
ysr@777 479 __ br(Assembler::always, false, Assembler::pt, _continuation);
ysr@777 480 __ delayed()->nop();
ysr@777 481
ysr@777 482 }
ysr@777 483
ysr@777 484 jbyte* G1PostBarrierStub::_byte_map_base = NULL;
ysr@777 485
ysr@777 486 jbyte* G1PostBarrierStub::byte_map_base_slow() {
ysr@777 487 BarrierSet* bs = Universe::heap()->barrier_set();
ysr@777 488 assert(bs->is_a(BarrierSet::G1SATBCTLogging),
ysr@777 489 "Must be if we're using this.");
ysr@777 490 return ((G1SATBCardTableModRefBS*)bs)->byte_map_base;
ysr@777 491 }
ysr@777 492
ysr@777 493 void G1PostBarrierStub::emit_code(LIR_Assembler* ce) {
ysr@777 494 __ bind(_entry);
ysr@777 495
ysr@777 496 assert(addr()->is_register(), "Precondition.");
ysr@777 497 assert(new_val()->is_register(), "Precondition.");
ysr@777 498 Register addr_reg = addr()->as_pointer_register();
ysr@777 499 Register new_val_reg = new_val()->as_register();
johnc@3088 500
iveresov@2203 501 if (__ is_in_wdisp16_range(_continuation)) {
johnc@3088 502 __ br_null(new_val_reg, /*annul*/false, Assembler::pt, _continuation);
iveresov@2203 503 } else {
iveresov@2203 504 __ cmp(new_val_reg, G0);
iveresov@2203 505 __ brx(Assembler::equal, false, Assembler::pn, _continuation);
iveresov@2203 506 }
ysr@777 507 __ delayed()->nop();
ysr@777 508
ysr@777 509 __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_post_barrier_slow_id));
ysr@777 510 __ delayed()->mov(addr_reg, G4);
ysr@777 511 __ br(Assembler::always, false, Assembler::pt, _continuation);
ysr@777 512 __ delayed()->nop();
ysr@777 513 }
ysr@777 514
jprovino@4542 515 #endif // INCLUDE_ALL_GCS
ysr@777 516 ///////////////////////////////////////////////////////////////////////////////////
ysr@777 517
duke@435 518 #undef __

mercurial