src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp

Thu, 24 May 2018 17:06:56 +0800

author
aoqi
date
Thu, 24 May 2018 17:06:56 +0800
changeset 8604
04d83ba48607
parent 8427
c3d0bd36ab28
parent 6876
710a3c8b516e
permissions
-rw-r--r--

Merge

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

mercurial