Mon, 11 Oct 2010 04:18:58 -0700
6829194: JSR 292 needs to support compressed oops
Reviewed-by: kvn, jrose
duke@435 | 1 | /* |
trims@1907 | 2 | * Copyright (c) 1999, 2010, 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 | |
duke@435 | 25 | #include "incls/_precompiled.incl" |
duke@435 | 26 | #include "incls/_c1_CodeStubs_sparc.cpp.incl" |
duke@435 | 27 | |
duke@435 | 28 | #define __ ce->masm()-> |
duke@435 | 29 | |
duke@435 | 30 | RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, |
duke@435 | 31 | bool throw_index_out_of_bounds_exception) |
duke@435 | 32 | : _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception) |
duke@435 | 33 | , _index(index) |
duke@435 | 34 | { |
roland@2174 | 35 | assert(info != NULL, "must have info"); |
duke@435 | 36 | _info = new CodeEmitInfo(info); |
duke@435 | 37 | } |
duke@435 | 38 | |
duke@435 | 39 | |
duke@435 | 40 | void RangeCheckStub::emit_code(LIR_Assembler* ce) { |
duke@435 | 41 | __ bind(_entry); |
duke@435 | 42 | |
duke@435 | 43 | if (_index->is_register()) { |
duke@435 | 44 | __ mov(_index->as_register(), G4); |
duke@435 | 45 | } else { |
duke@435 | 46 | __ set(_index->as_jint(), G4); |
duke@435 | 47 | } |
duke@435 | 48 | if (_throw_index_out_of_bounds_exception) { |
duke@435 | 49 | __ call(Runtime1::entry_for(Runtime1::throw_index_exception_id), relocInfo::runtime_call_type); |
duke@435 | 50 | } else { |
duke@435 | 51 | __ call(Runtime1::entry_for(Runtime1::throw_range_check_failed_id), relocInfo::runtime_call_type); |
duke@435 | 52 | } |
duke@435 | 53 | __ delayed()->nop(); |
duke@435 | 54 | ce->add_call_info_here(_info); |
duke@435 | 55 | ce->verify_oop_map(_info); |
duke@435 | 56 | #ifdef ASSERT |
duke@435 | 57 | __ should_not_reach_here(); |
duke@435 | 58 | #endif |
duke@435 | 59 | } |
duke@435 | 60 | |
duke@435 | 61 | |
duke@435 | 62 | void CounterOverflowStub::emit_code(LIR_Assembler* ce) { |
duke@435 | 63 | __ bind(_entry); |
duke@435 | 64 | __ set(_bci, G4); |
duke@435 | 65 | __ call(Runtime1::entry_for(Runtime1::counter_overflow_id), relocInfo::runtime_call_type); |
iveresov@2138 | 66 | __ delayed()->mov_or_nop(_method->as_register(), G5); |
duke@435 | 67 | ce->add_call_info_here(_info); |
duke@435 | 68 | ce->verify_oop_map(_info); |
duke@435 | 69 | |
duke@435 | 70 | __ br(Assembler::always, true, Assembler::pt, _continuation); |
duke@435 | 71 | __ delayed()->nop(); |
duke@435 | 72 | } |
duke@435 | 73 | |
duke@435 | 74 | |
duke@435 | 75 | void DivByZeroStub::emit_code(LIR_Assembler* ce) { |
duke@435 | 76 | if (_offset != -1) { |
duke@435 | 77 | ce->compilation()->implicit_exception_table()->append(_offset, __ offset()); |
duke@435 | 78 | } |
duke@435 | 79 | __ bind(_entry); |
duke@435 | 80 | __ call(Runtime1::entry_for(Runtime1::throw_div0_exception_id), relocInfo::runtime_call_type); |
duke@435 | 81 | __ delayed()->nop(); |
duke@435 | 82 | ce->add_call_info_here(_info); |
duke@435 | 83 | ce->verify_oop_map(_info); |
duke@435 | 84 | #ifdef ASSERT |
duke@435 | 85 | __ should_not_reach_here(); |
duke@435 | 86 | #endif |
duke@435 | 87 | } |
duke@435 | 88 | |
duke@435 | 89 | |
duke@435 | 90 | void ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) { |
duke@435 | 91 | ce->compilation()->implicit_exception_table()->append(_offset, __ offset()); |
duke@435 | 92 | __ bind(_entry); |
duke@435 | 93 | __ call(Runtime1::entry_for(Runtime1::throw_null_pointer_exception_id), |
duke@435 | 94 | relocInfo::runtime_call_type); |
duke@435 | 95 | __ delayed()->nop(); |
duke@435 | 96 | ce->add_call_info_here(_info); |
duke@435 | 97 | ce->verify_oop_map(_info); |
duke@435 | 98 | #ifdef ASSERT |
duke@435 | 99 | __ should_not_reach_here(); |
duke@435 | 100 | #endif |
duke@435 | 101 | } |
duke@435 | 102 | |
duke@435 | 103 | |
duke@435 | 104 | // Implementation of SimpleExceptionStub |
duke@435 | 105 | // Note: %g1 and %g3 are already in use |
duke@435 | 106 | void SimpleExceptionStub::emit_code(LIR_Assembler* ce) { |
duke@435 | 107 | __ bind(_entry); |
duke@435 | 108 | __ call(Runtime1::entry_for(_stub), relocInfo::runtime_call_type); |
duke@435 | 109 | |
duke@435 | 110 | if (_obj->is_valid()) { |
duke@435 | 111 | __ delayed()->mov(_obj->as_register(), G4); // _obj contains the optional argument to the stub |
duke@435 | 112 | } else { |
duke@435 | 113 | __ delayed()->mov(G0, G4); |
duke@435 | 114 | } |
duke@435 | 115 | ce->add_call_info_here(_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 | // Implementation of ArrayStoreExceptionStub |
duke@435 | 123 | |
duke@435 | 124 | ArrayStoreExceptionStub::ArrayStoreExceptionStub(CodeEmitInfo* info): |
duke@435 | 125 | _info(info) { |
duke@435 | 126 | } |
duke@435 | 127 | |
duke@435 | 128 | |
duke@435 | 129 | void ArrayStoreExceptionStub::emit_code(LIR_Assembler* ce) { |
duke@435 | 130 | __ bind(_entry); |
duke@435 | 131 | __ call(Runtime1::entry_for(Runtime1::throw_array_store_exception_id), relocInfo::runtime_call_type); |
duke@435 | 132 | __ delayed()->nop(); |
duke@435 | 133 | ce->add_call_info_here(_info); |
duke@435 | 134 | ce->verify_oop_map(_info); |
duke@435 | 135 | #ifdef ASSERT |
duke@435 | 136 | __ should_not_reach_here(); |
duke@435 | 137 | #endif |
duke@435 | 138 | } |
duke@435 | 139 | |
duke@435 | 140 | |
duke@435 | 141 | |
duke@435 | 142 | |
duke@435 | 143 | // Implementation of NewInstanceStub |
duke@435 | 144 | |
duke@435 | 145 | NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) { |
duke@435 | 146 | _result = result; |
duke@435 | 147 | _klass = klass; |
duke@435 | 148 | _klass_reg = klass_reg; |
duke@435 | 149 | _info = new CodeEmitInfo(info); |
duke@435 | 150 | assert(stub_id == Runtime1::new_instance_id || |
duke@435 | 151 | stub_id == Runtime1::fast_new_instance_id || |
duke@435 | 152 | stub_id == Runtime1::fast_new_instance_init_check_id, |
duke@435 | 153 | "need new_instance id"); |
duke@435 | 154 | _stub_id = stub_id; |
duke@435 | 155 | } |
duke@435 | 156 | |
duke@435 | 157 | |
duke@435 | 158 | void NewInstanceStub::emit_code(LIR_Assembler* ce) { |
duke@435 | 159 | __ bind(_entry); |
duke@435 | 160 | __ call(Runtime1::entry_for(_stub_id), relocInfo::runtime_call_type); |
duke@435 | 161 | __ delayed()->mov_or_nop(_klass_reg->as_register(), G5); |
duke@435 | 162 | ce->add_call_info_here(_info); |
duke@435 | 163 | ce->verify_oop_map(_info); |
duke@435 | 164 | __ br(Assembler::always, false, Assembler::pt, _continuation); |
duke@435 | 165 | __ delayed()->mov_or_nop(O0, _result->as_register()); |
duke@435 | 166 | } |
duke@435 | 167 | |
duke@435 | 168 | |
duke@435 | 169 | // Implementation of NewTypeArrayStub |
duke@435 | 170 | NewTypeArrayStub::NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) { |
duke@435 | 171 | _klass_reg = klass_reg; |
duke@435 | 172 | _length = length; |
duke@435 | 173 | _result = result; |
duke@435 | 174 | _info = new CodeEmitInfo(info); |
duke@435 | 175 | } |
duke@435 | 176 | |
duke@435 | 177 | |
duke@435 | 178 | void NewTypeArrayStub::emit_code(LIR_Assembler* ce) { |
duke@435 | 179 | __ bind(_entry); |
duke@435 | 180 | |
duke@435 | 181 | __ mov(_length->as_register(), G4); |
duke@435 | 182 | __ call(Runtime1::entry_for(Runtime1::new_type_array_id), relocInfo::runtime_call_type); |
duke@435 | 183 | __ delayed()->mov_or_nop(_klass_reg->as_register(), G5); |
duke@435 | 184 | ce->add_call_info_here(_info); |
duke@435 | 185 | ce->verify_oop_map(_info); |
duke@435 | 186 | __ br(Assembler::always, false, Assembler::pt, _continuation); |
duke@435 | 187 | __ delayed()->mov_or_nop(O0, _result->as_register()); |
duke@435 | 188 | } |
duke@435 | 189 | |
duke@435 | 190 | |
duke@435 | 191 | // Implementation of NewObjectArrayStub |
duke@435 | 192 | |
duke@435 | 193 | NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) { |
duke@435 | 194 | _klass_reg = klass_reg; |
duke@435 | 195 | _length = length; |
duke@435 | 196 | _result = result; |
duke@435 | 197 | _info = new CodeEmitInfo(info); |
duke@435 | 198 | } |
duke@435 | 199 | |
duke@435 | 200 | |
duke@435 | 201 | void NewObjectArrayStub::emit_code(LIR_Assembler* ce) { |
duke@435 | 202 | __ bind(_entry); |
duke@435 | 203 | |
duke@435 | 204 | __ mov(_length->as_register(), G4); |
duke@435 | 205 | __ call(Runtime1::entry_for(Runtime1::new_object_array_id), relocInfo::runtime_call_type); |
duke@435 | 206 | __ delayed()->mov_or_nop(_klass_reg->as_register(), G5); |
duke@435 | 207 | ce->add_call_info_here(_info); |
duke@435 | 208 | ce->verify_oop_map(_info); |
duke@435 | 209 | __ br(Assembler::always, false, Assembler::pt, _continuation); |
duke@435 | 210 | __ delayed()->mov_or_nop(O0, _result->as_register()); |
duke@435 | 211 | } |
duke@435 | 212 | |
duke@435 | 213 | |
duke@435 | 214 | // Implementation of MonitorAccessStubs |
duke@435 | 215 | MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info) |
duke@435 | 216 | : MonitorAccessStub(obj_reg, lock_reg) { |
duke@435 | 217 | _info = new CodeEmitInfo(info); |
duke@435 | 218 | } |
duke@435 | 219 | |
duke@435 | 220 | |
duke@435 | 221 | void MonitorEnterStub::emit_code(LIR_Assembler* ce) { |
duke@435 | 222 | __ bind(_entry); |
duke@435 | 223 | __ mov(_obj_reg->as_register(), G4); |
duke@435 | 224 | if (ce->compilation()->has_fpu_code()) { |
duke@435 | 225 | __ call(Runtime1::entry_for(Runtime1::monitorenter_id), relocInfo::runtime_call_type); |
duke@435 | 226 | } else { |
duke@435 | 227 | __ call(Runtime1::entry_for(Runtime1::monitorenter_nofpu_id), relocInfo::runtime_call_type); |
duke@435 | 228 | } |
duke@435 | 229 | __ delayed()->mov_or_nop(_lock_reg->as_register(), G5); |
duke@435 | 230 | ce->add_call_info_here(_info); |
duke@435 | 231 | ce->verify_oop_map(_info); |
duke@435 | 232 | __ br(Assembler::always, true, Assembler::pt, _continuation); |
duke@435 | 233 | __ delayed()->nop(); |
duke@435 | 234 | } |
duke@435 | 235 | |
duke@435 | 236 | |
duke@435 | 237 | void MonitorExitStub::emit_code(LIR_Assembler* ce) { |
duke@435 | 238 | __ bind(_entry); |
duke@435 | 239 | if (_compute_lock) { |
duke@435 | 240 | ce->monitor_address(_monitor_ix, _lock_reg); |
duke@435 | 241 | } |
duke@435 | 242 | if (ce->compilation()->has_fpu_code()) { |
duke@435 | 243 | __ call(Runtime1::entry_for(Runtime1::monitorexit_id), relocInfo::runtime_call_type); |
duke@435 | 244 | } else { |
duke@435 | 245 | __ call(Runtime1::entry_for(Runtime1::monitorexit_nofpu_id), relocInfo::runtime_call_type); |
duke@435 | 246 | } |
duke@435 | 247 | |
duke@435 | 248 | __ delayed()->mov_or_nop(_lock_reg->as_register(), G4); |
duke@435 | 249 | __ br(Assembler::always, true, Assembler::pt, _continuation); |
duke@435 | 250 | __ delayed()->nop(); |
duke@435 | 251 | } |
duke@435 | 252 | |
duke@435 | 253 | // Implementation of patching: |
duke@435 | 254 | // - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes) |
duke@435 | 255 | // - Replace original code with a call to the stub |
duke@435 | 256 | // At Runtime: |
duke@435 | 257 | // - call to stub, jump to runtime |
duke@435 | 258 | // - in runtime: preserve all registers (especially objects, i.e., source and destination object) |
duke@435 | 259 | // - in runtime: after initializing class, restore original code, reexecute instruction |
duke@435 | 260 | |
duke@435 | 261 | int PatchingStub::_patch_info_offset = -NativeGeneralJump::instruction_size; |
duke@435 | 262 | |
duke@435 | 263 | void PatchingStub::align_patch_site(MacroAssembler* ) { |
duke@435 | 264 | // patch sites on sparc are always properly aligned. |
duke@435 | 265 | } |
duke@435 | 266 | |
duke@435 | 267 | void PatchingStub::emit_code(LIR_Assembler* ce) { |
duke@435 | 268 | // copy original code here |
duke@435 | 269 | assert(NativeCall::instruction_size <= _bytes_to_copy && _bytes_to_copy <= 0xFF, |
duke@435 | 270 | "not enough room for call"); |
duke@435 | 271 | assert((_bytes_to_copy & 0x3) == 0, "must copy a multiple of four bytes"); |
duke@435 | 272 | |
duke@435 | 273 | Label call_patch; |
duke@435 | 274 | |
duke@435 | 275 | int being_initialized_entry = __ offset(); |
duke@435 | 276 | |
duke@435 | 277 | if (_id == load_klass_id) { |
duke@435 | 278 | // produce a copy of the load klass instruction for use by the being initialized case |
twisti@1162 | 279 | #ifdef ASSERT |
duke@435 | 280 | address start = __ pc(); |
twisti@1162 | 281 | #endif |
twisti@1162 | 282 | AddressLiteral addrlit(NULL, oop_Relocation::spec(_oop_index)); |
twisti@1162 | 283 | __ patchable_set(addrlit, _obj); |
duke@435 | 284 | |
duke@435 | 285 | #ifdef ASSERT |
duke@435 | 286 | for (int i = 0; i < _bytes_to_copy; i++) { |
duke@435 | 287 | address ptr = (address)(_pc_start + i); |
duke@435 | 288 | int a_byte = (*ptr) & 0xFF; |
duke@435 | 289 | assert(a_byte == *start++, "should be the same code"); |
duke@435 | 290 | } |
duke@435 | 291 | #endif |
duke@435 | 292 | } else { |
duke@435 | 293 | // make a copy the code which is going to be patched. |
duke@435 | 294 | for (int i = 0; i < _bytes_to_copy; i++) { |
duke@435 | 295 | address ptr = (address)(_pc_start + i); |
duke@435 | 296 | int a_byte = (*ptr) & 0xFF; |
duke@435 | 297 | __ a_byte (a_byte); |
duke@435 | 298 | } |
duke@435 | 299 | } |
duke@435 | 300 | |
duke@435 | 301 | address end_of_patch = __ pc(); |
duke@435 | 302 | int bytes_to_skip = 0; |
duke@435 | 303 | if (_id == load_klass_id) { |
duke@435 | 304 | int offset = __ offset(); |
duke@435 | 305 | if (CommentedAssembly) { |
duke@435 | 306 | __ block_comment(" being_initialized check"); |
duke@435 | 307 | } |
duke@435 | 308 | |
duke@435 | 309 | // static field accesses have special semantics while the class |
duke@435 | 310 | // initializer is being run so we emit a test which can be used to |
duke@435 | 311 | // check that this code is being executed by the initializing |
duke@435 | 312 | // thread. |
duke@435 | 313 | assert(_obj != noreg, "must be a valid register"); |
duke@435 | 314 | assert(_oop_index >= 0, "must have oop index"); |
duke@435 | 315 | __ ld_ptr(_obj, instanceKlass::init_thread_offset_in_bytes() + sizeof(klassOopDesc), G3); |
duke@435 | 316 | __ cmp(G2_thread, G3); |
duke@435 | 317 | __ br(Assembler::notEqual, false, Assembler::pn, call_patch); |
duke@435 | 318 | __ delayed()->nop(); |
duke@435 | 319 | |
duke@435 | 320 | // load_klass patches may execute the patched code before it's |
duke@435 | 321 | // copied back into place so we need to jump back into the main |
duke@435 | 322 | // code of the nmethod to continue execution. |
duke@435 | 323 | __ br(Assembler::always, false, Assembler::pt, _patch_site_continuation); |
duke@435 | 324 | __ delayed()->nop(); |
duke@435 | 325 | |
duke@435 | 326 | // make sure this extra code gets skipped |
duke@435 | 327 | bytes_to_skip += __ offset() - offset; |
duke@435 | 328 | } |
duke@435 | 329 | |
duke@435 | 330 | // Now emit the patch record telling the runtime how to find the |
duke@435 | 331 | // pieces of the patch. We only need 3 bytes but it has to be |
duke@435 | 332 | // aligned as an instruction so emit 4 bytes. |
duke@435 | 333 | int sizeof_patch_record = 4; |
duke@435 | 334 | bytes_to_skip += sizeof_patch_record; |
duke@435 | 335 | |
duke@435 | 336 | // emit the offsets needed to find the code to patch |
duke@435 | 337 | int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record; |
duke@435 | 338 | |
duke@435 | 339 | // Emit the patch record. We need to emit a full word, so emit an extra empty byte |
duke@435 | 340 | __ a_byte(0); |
duke@435 | 341 | __ a_byte(being_initialized_entry_offset); |
duke@435 | 342 | __ a_byte(bytes_to_skip); |
duke@435 | 343 | __ a_byte(_bytes_to_copy); |
duke@435 | 344 | address patch_info_pc = __ pc(); |
duke@435 | 345 | assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info"); |
duke@435 | 346 | |
duke@435 | 347 | address entry = __ pc(); |
duke@435 | 348 | NativeGeneralJump::insert_unconditional((address)_pc_start, entry); |
duke@435 | 349 | address target = NULL; |
duke@435 | 350 | switch (_id) { |
duke@435 | 351 | case access_field_id: target = Runtime1::entry_for(Runtime1::access_field_patching_id); break; |
duke@435 | 352 | case load_klass_id: target = Runtime1::entry_for(Runtime1::load_klass_patching_id); break; |
duke@435 | 353 | default: ShouldNotReachHere(); |
duke@435 | 354 | } |
duke@435 | 355 | __ bind(call_patch); |
duke@435 | 356 | |
duke@435 | 357 | if (CommentedAssembly) { |
duke@435 | 358 | __ block_comment("patch entry point"); |
duke@435 | 359 | } |
duke@435 | 360 | __ call(target, relocInfo::runtime_call_type); |
duke@435 | 361 | __ delayed()->nop(); |
duke@435 | 362 | assert(_patch_info_offset == (patch_info_pc - __ pc()), "must not change"); |
duke@435 | 363 | ce->add_call_info_here(_info); |
duke@435 | 364 | __ br(Assembler::always, false, Assembler::pt, _patch_site_entry); |
duke@435 | 365 | __ delayed()->nop(); |
duke@435 | 366 | if (_id == load_klass_id) { |
duke@435 | 367 | CodeSection* cs = __ code_section(); |
duke@435 | 368 | address pc = (address)_pc_start; |
duke@435 | 369 | RelocIterator iter(cs, pc, pc + 1); |
duke@435 | 370 | relocInfo::change_reloc_info_for_address(&iter, (address) pc, relocInfo::oop_type, relocInfo::none); |
duke@435 | 371 | |
duke@435 | 372 | pc = (address)(_pc_start + NativeMovConstReg::add_offset); |
duke@435 | 373 | RelocIterator iter2(cs, pc, pc+1); |
duke@435 | 374 | relocInfo::change_reloc_info_for_address(&iter2, (address) pc, relocInfo::oop_type, relocInfo::none); |
duke@435 | 375 | } |
duke@435 | 376 | |
duke@435 | 377 | } |
duke@435 | 378 | |
twisti@1730 | 379 | |
twisti@1730 | 380 | void DeoptimizeStub::emit_code(LIR_Assembler* ce) { |
twisti@1730 | 381 | __ bind(_entry); |
twisti@1730 | 382 | __ call(SharedRuntime::deopt_blob()->unpack_with_reexecution()); |
twisti@1730 | 383 | __ delayed()->nop(); |
twisti@1730 | 384 | ce->add_call_info_here(_info); |
twisti@1730 | 385 | debug_only(__ should_not_reach_here()); |
twisti@1730 | 386 | } |
twisti@1730 | 387 | |
twisti@1730 | 388 | |
duke@435 | 389 | void ArrayCopyStub::emit_code(LIR_Assembler* ce) { |
duke@435 | 390 | //---------------slow case: call to native----------------- |
duke@435 | 391 | __ bind(_entry); |
duke@435 | 392 | __ mov(src()->as_register(), O0); |
duke@435 | 393 | __ mov(src_pos()->as_register(), O1); |
duke@435 | 394 | __ mov(dst()->as_register(), O2); |
duke@435 | 395 | __ mov(dst_pos()->as_register(), O3); |
duke@435 | 396 | __ mov(length()->as_register(), O4); |
duke@435 | 397 | |
duke@435 | 398 | ce->emit_static_call_stub(); |
duke@435 | 399 | |
duke@435 | 400 | __ call(SharedRuntime::get_resolve_static_call_stub(), relocInfo::static_call_type); |
duke@435 | 401 | __ delayed()->nop(); |
duke@435 | 402 | ce->add_call_info_here(info()); |
duke@435 | 403 | ce->verify_oop_map(info()); |
duke@435 | 404 | |
duke@435 | 405 | #ifndef PRODUCT |
duke@435 | 406 | __ set((intptr_t)&Runtime1::_arraycopy_slowcase_cnt, O0); |
duke@435 | 407 | __ ld(O0, 0, O1); |
duke@435 | 408 | __ inc(O1); |
duke@435 | 409 | __ st(O1, 0, O0); |
duke@435 | 410 | #endif |
duke@435 | 411 | |
duke@435 | 412 | __ br(Assembler::always, false, Assembler::pt, _continuation); |
duke@435 | 413 | __ delayed()->nop(); |
duke@435 | 414 | } |
duke@435 | 415 | |
duke@435 | 416 | |
ysr@777 | 417 | /////////////////////////////////////////////////////////////////////////////////// |
ysr@777 | 418 | #ifndef SERIALGC |
ysr@777 | 419 | |
ysr@777 | 420 | void G1PreBarrierStub::emit_code(LIR_Assembler* ce) { |
ysr@777 | 421 | __ bind(_entry); |
ysr@777 | 422 | |
ysr@777 | 423 | assert(pre_val()->is_register(), "Precondition."); |
ysr@777 | 424 | |
ysr@777 | 425 | Register pre_val_reg = pre_val()->as_register(); |
ysr@777 | 426 | |
ysr@777 | 427 | ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false); |
ysr@777 | 428 | __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, |
ysr@777 | 429 | pre_val_reg, _continuation); |
ysr@777 | 430 | __ delayed()->nop(); |
ysr@777 | 431 | |
ysr@777 | 432 | __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id)); |
ysr@777 | 433 | __ delayed()->mov(pre_val_reg, G4); |
ysr@777 | 434 | __ br(Assembler::always, false, Assembler::pt, _continuation); |
ysr@777 | 435 | __ delayed()->nop(); |
ysr@777 | 436 | |
ysr@777 | 437 | } |
ysr@777 | 438 | |
ysr@777 | 439 | jbyte* G1PostBarrierStub::_byte_map_base = NULL; |
ysr@777 | 440 | |
ysr@777 | 441 | jbyte* G1PostBarrierStub::byte_map_base_slow() { |
ysr@777 | 442 | BarrierSet* bs = Universe::heap()->barrier_set(); |
ysr@777 | 443 | assert(bs->is_a(BarrierSet::G1SATBCTLogging), |
ysr@777 | 444 | "Must be if we're using this."); |
ysr@777 | 445 | return ((G1SATBCardTableModRefBS*)bs)->byte_map_base; |
ysr@777 | 446 | } |
ysr@777 | 447 | |
ysr@777 | 448 | void G1PostBarrierStub::emit_code(LIR_Assembler* ce) { |
ysr@777 | 449 | __ bind(_entry); |
ysr@777 | 450 | |
ysr@777 | 451 | assert(addr()->is_register(), "Precondition."); |
ysr@777 | 452 | assert(new_val()->is_register(), "Precondition."); |
ysr@777 | 453 | Register addr_reg = addr()->as_pointer_register(); |
ysr@777 | 454 | Register new_val_reg = new_val()->as_register(); |
ysr@777 | 455 | __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, |
ysr@777 | 456 | new_val_reg, _continuation); |
ysr@777 | 457 | __ delayed()->nop(); |
ysr@777 | 458 | |
ysr@777 | 459 | __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_post_barrier_slow_id)); |
ysr@777 | 460 | __ delayed()->mov(addr_reg, G4); |
ysr@777 | 461 | __ br(Assembler::always, false, Assembler::pt, _continuation); |
ysr@777 | 462 | __ delayed()->nop(); |
ysr@777 | 463 | } |
ysr@777 | 464 | |
ysr@777 | 465 | #endif // SERIALGC |
ysr@777 | 466 | /////////////////////////////////////////////////////////////////////////////////// |
ysr@777 | 467 | |
duke@435 | 468 | #undef __ |