c1_CodeStubs_sparc.cpp revision 1879:f95d63e2154a
1113288Smdodd/* 2113288Smdodd * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 3113288Smdodd * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4113288Smdodd * 5113288Smdodd * This code is free software; you can redistribute it and/or modify it 6113288Smdodd * under the terms of the GNU General Public License version 2 only, as 7113288Smdodd * published by the Free Software Foundation. 8113288Smdodd * 9113288Smdodd * This code is distributed in the hope that it will be useful, but WITHOUT 10113288Smdodd * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11113288Smdodd * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12113288Smdodd * version 2 for more details (a copy is included in the LICENSE file that 13113288Smdodd * accompanied this code). 14113288Smdodd * 15113288Smdodd * You should have received a copy of the GNU General Public License version 16113288Smdodd * 2 along with this work; if not, write to the Free Software Foundation, 17113288Smdodd * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18113288Smdodd * 19113288Smdodd * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20113288Smdodd * or visit www.oracle.com if you need additional information or have any 21113288Smdodd * questions. 22113288Smdodd * 23113288Smdodd */ 24113288Smdodd 25113288Smdodd#include "precompiled.hpp" 26113288Smdodd#include "c1/c1_CodeStubs.hpp" 27113288Smdodd#include "c1/c1_FrameMap.hpp" 28113288Smdodd#include "c1/c1_LIRAssembler.hpp" 29113288Smdodd#include "c1/c1_MacroAssembler.hpp" 30113288Smdodd#include "c1/c1_Runtime1.hpp" 31113288Smdodd#include "nativeInst_sparc.hpp" 32113288Smdodd#include "runtime/sharedRuntime.hpp" 33113288Smdodd#include "vmreg_sparc.inline.hpp" 34113288Smdodd#ifndef SERIALGC 35113288Smdodd#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" 36113288Smdodd#endif 37113288Smdodd 38113288Smdodd#define __ ce->masm()-> 39113288Smdodd 40113288SmdoddRangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, 41113288Smdodd bool throw_index_out_of_bounds_exception) 42188945Sthompsa : _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception) 43113288Smdodd , _index(index) 44113288Smdodd{ 45113288Smdodd assert(info != NULL, "must have info"); 46200462Sdelphij _info = new CodeEmitInfo(info); 47113288Smdodd} 48113288Smdodd 49113288Smdodd 50113288Smdoddvoid RangeCheckStub::emit_code(LIR_Assembler* ce) { 51113288Smdodd __ bind(_entry); 52126774Sdwmalone 53113288Smdodd if (_index->is_register()) { 54113288Smdodd __ mov(_index->as_register(), G4); 55113288Smdodd } else { 56113288Smdodd __ set(_index->as_jint(), G4); 57113288Smdodd } 58113288Smdodd if (_throw_index_out_of_bounds_exception) { 59113288Smdodd __ call(Runtime1::entry_for(Runtime1::throw_index_exception_id), relocInfo::runtime_call_type); 60113309Smdodd } else { 61113309Smdodd __ call(Runtime1::entry_for(Runtime1::throw_range_check_failed_id), relocInfo::runtime_call_type); 62113309Smdodd } 63113288Smdodd __ delayed()->nop(); 64113288Smdodd ce->add_call_info_here(_info); 65113288Smdodd ce->verify_oop_map(_info); 66113288Smdodd#ifdef ASSERT 67227195Sed __ should_not_reach_here(); 68113288Smdodd#endif 69113288Smdodd} 70113288Smdodd 71113288Smdodd 72113288Smdoddvoid CounterOverflowStub::emit_code(LIR_Assembler* ce) { 73113288Smdodd __ bind(_entry); 74113288Smdodd __ set(_bci, G4); 75113288Smdodd __ call(Runtime1::entry_for(Runtime1::counter_overflow_id), relocInfo::runtime_call_type); 76113288Smdodd __ delayed()->mov_or_nop(_method->as_register(), G5); 77126774Sdwmalone ce->add_call_info_here(_info); 78113288Smdodd ce->verify_oop_map(_info); 79113288Smdodd 80113288Smdodd __ br(Assembler::always, true, Assembler::pt, _continuation); 81113288Smdodd __ delayed()->nop(); 82113288Smdodd} 83113288Smdodd 84113288Smdodd 85113288Smdoddvoid DivByZeroStub::emit_code(LIR_Assembler* ce) { 86113288Smdodd if (_offset != -1) { 87171101Simp ce->compilation()->implicit_exception_table()->append(_offset, __ offset()); 88126774Sdwmalone } 89126774Sdwmalone __ bind(_entry); 90113309Smdodd __ call(Runtime1::entry_for(Runtime1::throw_div0_exception_id), relocInfo::runtime_call_type); 91113288Smdodd __ delayed()->nop(); 92113288Smdodd ce->add_call_info_here(_info); 93113288Smdodd ce->verify_oop_map(_info); 94113288Smdodd#ifdef ASSERT 95224511Smav __ should_not_reach_here(); 96113288Smdodd#endif 97113288Smdodd} 98113288Smdodd 99113309Smdodd 100224511Smavvoid ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) { 101113288Smdodd ce->compilation()->implicit_exception_table()->append(_offset, __ offset()); 102113288Smdodd __ bind(_entry); 103113288Smdodd __ call(Runtime1::entry_for(Runtime1::throw_null_pointer_exception_id), 104113288Smdodd relocInfo::runtime_call_type); 105113288Smdodd __ delayed()->nop(); 106113288Smdodd ce->add_call_info_here(_info); 107113288Smdodd ce->verify_oop_map(_info); 108113309Smdodd#ifdef ASSERT 109113309Smdodd __ should_not_reach_here(); 110113309Smdodd#endif 111113288Smdodd} 112113288Smdodd 113113288Smdodd 114113288Smdodd// Implementation of SimpleExceptionStub 115113288Smdodd// Note: %g1 and %g3 are already in use 116113288Smdoddvoid SimpleExceptionStub::emit_code(LIR_Assembler* ce) { 117113288Smdodd __ bind(_entry); 118113288Smdodd __ call(Runtime1::entry_for(_stub), relocInfo::runtime_call_type); 119113288Smdodd 120224511Smav if (_obj->is_valid()) { 121224511Smav __ delayed()->mov(_obj->as_register(), G4); // _obj contains the optional argument to the stub 122224511Smav } else { 123171101Simp __ delayed()->mov(G0, G4); 124171101Simp } 125171101Simp ce->add_call_info_here(_info); 126113288Smdodd#ifdef ASSERT 127113288Smdodd __ should_not_reach_here(); 128113288Smdodd#endif 129113288Smdodd} 130113288Smdodd 131113288Smdodd 132113288Smdodd// Implementation of ArrayStoreExceptionStub 133113288Smdodd 134113288SmdoddArrayStoreExceptionStub::ArrayStoreExceptionStub(CodeEmitInfo* info): 135113288Smdodd _info(info) { 136113288Smdodd} 137113288Smdodd 138113288Smdodd 139113288Smdoddvoid ArrayStoreExceptionStub::emit_code(LIR_Assembler* ce) { 140113288Smdodd __ bind(_entry); 141171101Simp __ call(Runtime1::entry_for(Runtime1::throw_array_store_exception_id), relocInfo::runtime_call_type); 142113288Smdodd __ delayed()->nop(); 143113288Smdodd ce->add_call_info_here(_info); 144113288Smdodd ce->verify_oop_map(_info); 145113288Smdodd#ifdef ASSERT 146113288Smdodd __ should_not_reach_here(); 147113288Smdodd#endif 148113288Smdodd} 149113288Smdodd 150113288Smdodd 151113288Smdodd 152113288Smdodd 153113288Smdodd// Implementation of NewInstanceStub 154113288Smdodd 155113288SmdoddNewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) { 156113288Smdodd _result = result; 157113288Smdodd _klass = klass; 158224511Smav _klass_reg = klass_reg; 159113288Smdodd _info = new CodeEmitInfo(info); 160113288Smdodd assert(stub_id == Runtime1::new_instance_id || 161126774Sdwmalone stub_id == Runtime1::fast_new_instance_id || 162113288Smdodd stub_id == Runtime1::fast_new_instance_init_check_id, 163113288Smdodd "need new_instance id"); 164113288Smdodd _stub_id = stub_id; 165113288Smdodd} 166113288Smdodd 167113288Smdodd 168113288Smdoddvoid NewInstanceStub::emit_code(LIR_Assembler* ce) { 169113288Smdodd __ bind(_entry); 170212048Skevlo __ call(Runtime1::entry_for(_stub_id), relocInfo::runtime_call_type); 171212048Skevlo __ delayed()->mov_or_nop(_klass_reg->as_register(), G5); 172126774Sdwmalone ce->add_call_info_here(_info); 173126774Sdwmalone ce->verify_oop_map(_info); 174126774Sdwmalone __ br(Assembler::always, false, Assembler::pt, _continuation); 175113288Smdodd __ delayed()->mov_or_nop(O0, _result->as_register()); 176113288Smdodd} 177113288Smdodd 178113309Smdodd 179113309Smdodd// Implementation of NewTypeArrayStub 180113288SmdoddNewTypeArrayStub::NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) { 181113288Smdodd _klass_reg = klass_reg; 182113288Smdodd _length = length; 183113288Smdodd _result = result; 184113288Smdodd _info = new CodeEmitInfo(info); 185113288Smdodd} 186113288Smdodd 187113288Smdodd 188113288Smdoddvoid NewTypeArrayStub::emit_code(LIR_Assembler* ce) { 189113288Smdodd __ bind(_entry); 190113288Smdodd 191113288Smdodd __ mov(_length->as_register(), G4); 192113288Smdodd __ call(Runtime1::entry_for(Runtime1::new_type_array_id), relocInfo::runtime_call_type); 193113288Smdodd __ delayed()->mov_or_nop(_klass_reg->as_register(), G5); 194113288Smdodd ce->add_call_info_here(_info); 195113288Smdodd ce->verify_oop_map(_info); 196113288Smdodd __ br(Assembler::always, false, Assembler::pt, _continuation); 197113288Smdodd __ delayed()->mov_or_nop(O0, _result->as_register()); 198113288Smdodd} 199113288Smdodd 200113288Smdodd 201113288Smdodd// Implementation of NewObjectArrayStub 202113288Smdodd 203224511SmavNewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) { 204224511Smav _klass_reg = klass_reg; 205224511Smav _length = length; 206224511Smav _result = result; 207224511Smav _info = new CodeEmitInfo(info); 208224511Smav} 209224511Smav 210224511Smav 211224511Smavvoid NewObjectArrayStub::emit_code(LIR_Assembler* ce) { 212224511Smav __ bind(_entry); 213224511Smav 214224511Smav __ mov(_length->as_register(), G4); 215224511Smav __ call(Runtime1::entry_for(Runtime1::new_object_array_id), relocInfo::runtime_call_type); 216224511Smav __ delayed()->mov_or_nop(_klass_reg->as_register(), G5); 217224511Smav ce->add_call_info_here(_info); 218224511Smav ce->verify_oop_map(_info); 219224511Smav __ br(Assembler::always, false, Assembler::pt, _continuation); 220113309Smdodd __ delayed()->mov_or_nop(O0, _result->as_register()); 221113309Smdodd} 222113309Smdodd 223113328Smdodd 224113309Smdodd// Implementation of MonitorAccessStubs 225113288SmdoddMonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info) 226113309Smdodd : MonitorAccessStub(obj_reg, lock_reg) { 227113309Smdodd _info = new CodeEmitInfo(info); 228113309Smdodd} 229113309Smdodd 230113309Smdodd 231113309Smdoddvoid MonitorEnterStub::emit_code(LIR_Assembler* ce) { 232113309Smdodd __ bind(_entry); 233113309Smdodd __ mov(_obj_reg->as_register(), G4); 234113309Smdodd if (ce->compilation()->has_fpu_code()) { 235113309Smdodd __ call(Runtime1::entry_for(Runtime1::monitorenter_id), relocInfo::runtime_call_type); 236113309Smdodd } else { 237113288Smdodd __ call(Runtime1::entry_for(Runtime1::monitorenter_nofpu_id), relocInfo::runtime_call_type); 238113309Smdodd } 239113309Smdodd __ delayed()->mov_or_nop(_lock_reg->as_register(), G5); 240113309Smdodd ce->add_call_info_here(_info); 241113309Smdodd ce->verify_oop_map(_info); 242113288Smdodd __ br(Assembler::always, true, Assembler::pt, _continuation); 243113288Smdodd __ delayed()->nop(); 244113288Smdodd} 245113288Smdodd 246113288Smdodd 247113288Smdoddvoid MonitorExitStub::emit_code(LIR_Assembler* ce) { 248113288Smdodd __ bind(_entry); 249113288Smdodd if (_compute_lock) { 250113288Smdodd ce->monitor_address(_monitor_ix, _lock_reg); 251113288Smdodd } 252113288Smdodd if (ce->compilation()->has_fpu_code()) { 253113288Smdodd __ call(Runtime1::entry_for(Runtime1::monitorexit_id), relocInfo::runtime_call_type); 254113288Smdodd } else { 255113288Smdodd __ call(Runtime1::entry_for(Runtime1::monitorexit_nofpu_id), relocInfo::runtime_call_type); 256113288Smdodd } 257113288Smdodd 258113288Smdodd __ delayed()->mov_or_nop(_lock_reg->as_register(), G4); 259113288Smdodd __ br(Assembler::always, true, Assembler::pt, _continuation); 260113309Smdodd __ delayed()->nop(); 261171101Simp} 262113288Smdodd 263113288Smdodd// Implementation of patching: 264113288Smdodd// - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes) 265113288Smdodd// - Replace original code with a call to the stub 266113288Smdodd// At Runtime: 267113288Smdodd// - call to stub, jump to runtime 268113288Smdodd// - in runtime: preserve all registers (especially objects, i.e., source and destination object) 269113288Smdodd// - in runtime: after initializing class, restore original code, reexecute instruction 270113288Smdodd 271113288Smdoddint PatchingStub::_patch_info_offset = -NativeGeneralJump::instruction_size; 272113288Smdodd 273113288Smdoddvoid PatchingStub::align_patch_site(MacroAssembler* ) { 274113288Smdodd // patch sites on sparc are always properly aligned. 275113288Smdodd} 276113288Smdodd 277113288Smdoddvoid PatchingStub::emit_code(LIR_Assembler* ce) { 278113288Smdodd // copy original code here 279113288Smdodd assert(NativeCall::instruction_size <= _bytes_to_copy && _bytes_to_copy <= 0xFF, 280113288Smdodd "not enough room for call"); 281113288Smdodd assert((_bytes_to_copy & 0x3) == 0, "must copy a multiple of four bytes"); 282113309Smdodd 283225839Smav Label call_patch; 284113288Smdodd 285113288Smdodd int being_initialized_entry = __ offset(); 286113288Smdodd 287225839Smav if (_id == load_klass_id) { 288113288Smdodd // produce a copy of the load klass instruction for use by the being initialized case 289113288Smdodd#ifdef ASSERT 290113288Smdodd address start = __ pc(); 291113288Smdodd#endif 292113288Smdodd AddressLiteral addrlit(NULL, oop_Relocation::spec(_oop_index)); 293113288Smdodd __ patchable_set(addrlit, _obj); 294113288Smdodd 295113288Smdodd#ifdef ASSERT 296113288Smdodd for (int i = 0; i < _bytes_to_copy; i++) { 297113288Smdodd address ptr = (address)(_pc_start + i); 298113288Smdodd int a_byte = (*ptr) & 0xFF; 299113288Smdodd assert(a_byte == *start++, "should be the same code"); 300113288Smdodd } 301113288Smdodd#endif 302113288Smdodd } else { 303113288Smdodd // make a copy the code which is going to be patched. 304113288Smdodd for (int i = 0; i < _bytes_to_copy; i++) { 305113288Smdodd address ptr = (address)(_pc_start + i); 306113288Smdodd int a_byte = (*ptr) & 0xFF; 307113309Smdodd __ a_byte (a_byte); 308113309Smdodd } 309113288Smdodd } 310113288Smdodd 311113288Smdodd address end_of_patch = __ pc(); 312113288Smdodd int bytes_to_skip = 0; 313113288Smdodd if (_id == load_klass_id) { 314113288Smdodd int offset = __ offset(); 315113288Smdodd if (CommentedAssembly) { 316113288Smdodd __ block_comment(" being_initialized check"); 317113288Smdodd } 318113288Smdodd 319225839Smav // static field accesses have special semantics while the class 320225839Smav // initializer is being run so we emit a test which can be used to 321225839Smav // check that this code is being executed by the initializing 322225839Smav // thread. 323225839Smav assert(_obj != noreg, "must be a valid register"); 324225839Smav assert(_oop_index >= 0, "must have oop index"); 325113288Smdodd __ ld_ptr(_obj, instanceKlass::init_thread_offset_in_bytes() + sizeof(klassOopDesc), G3); 326113288Smdodd __ cmp(G2_thread, G3); 327113288Smdodd __ br(Assembler::notEqual, false, Assembler::pn, call_patch); 328113288Smdodd __ delayed()->nop(); 329113288Smdodd 330113288Smdodd // load_klass patches may execute the patched code before it's 331113288Smdodd // copied back into place so we need to jump back into the main 332113288Smdodd // code of the nmethod to continue execution. 333113288Smdodd __ br(Assembler::always, false, Assembler::pt, _patch_site_continuation); 334113288Smdodd __ delayed()->nop(); 335113288Smdodd 336113288Smdodd // make sure this extra code gets skipped 337113288Smdodd bytes_to_skip += __ offset() - offset; 338113288Smdodd } 339113288Smdodd 340113288Smdodd // Now emit the patch record telling the runtime how to find the 341113309Smdodd // pieces of the patch. We only need 3 bytes but it has to be 342113288Smdodd // aligned as an instruction so emit 4 bytes. 343113288Smdodd int sizeof_patch_record = 4; 344113288Smdodd bytes_to_skip += sizeof_patch_record; 345113288Smdodd 346113288Smdodd // emit the offsets needed to find the code to patch 347113309Smdodd int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record; 348113288Smdodd 349113288Smdodd // Emit the patch record. We need to emit a full word, so emit an extra empty byte 350113288Smdodd __ a_byte(0); 351113288Smdodd __ a_byte(being_initialized_entry_offset); 352113288Smdodd __ a_byte(bytes_to_skip); 353113309Smdodd __ a_byte(_bytes_to_copy); 354113309Smdodd address patch_info_pc = __ pc(); 355113309Smdodd assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info"); 356113309Smdodd 357113309Smdodd address entry = __ pc(); 358113309Smdodd NativeGeneralJump::insert_unconditional((address)_pc_start, entry); 359113309Smdodd address target = NULL; 360113309Smdodd switch (_id) { 361113309Smdodd case access_field_id: target = Runtime1::entry_for(Runtime1::access_field_patching_id); break; 362113309Smdodd case load_klass_id: target = Runtime1::entry_for(Runtime1::load_klass_patching_id); break; 363113309Smdodd default: ShouldNotReachHere(); 364113309Smdodd } 365113309Smdodd __ bind(call_patch); 366113309Smdodd 367113309Smdodd if (CommentedAssembly) { 368113288Smdodd __ block_comment("patch entry point"); 369225839Smav } 370113288Smdodd __ call(target, relocInfo::runtime_call_type); 371113288Smdodd __ delayed()->nop(); 372113288Smdodd assert(_patch_info_offset == (patch_info_pc - __ pc()), "must not change"); 373113288Smdodd ce->add_call_info_here(_info); 374113288Smdodd __ br(Assembler::always, false, Assembler::pt, _patch_site_entry); 375113288Smdodd __ delayed()->nop(); 376113288Smdodd if (_id == load_klass_id) { 377113288Smdodd CodeSection* cs = __ code_section(); 378113288Smdodd address pc = (address)_pc_start; 379113288Smdodd RelocIterator iter(cs, pc, pc + 1); 380113288Smdodd relocInfo::change_reloc_info_for_address(&iter, (address) pc, relocInfo::oop_type, relocInfo::none); 381113288Smdodd 382113288Smdodd pc = (address)(_pc_start + NativeMovConstReg::add_offset); 383113288Smdodd RelocIterator iter2(cs, pc, pc+1); 384113288Smdodd relocInfo::change_reloc_info_for_address(&iter2, (address) pc, relocInfo::oop_type, relocInfo::none); 385113288Smdodd } 386113288Smdodd 387113288Smdodd} 388113288Smdodd 389113288Smdodd 390126774Sdwmalonevoid DeoptimizeStub::emit_code(LIR_Assembler* ce) { 391113288Smdodd __ bind(_entry); 392225839Smav __ call(SharedRuntime::deopt_blob()->unpack_with_reexecution()); 393113288Smdodd __ delayed()->nop(); 394225839Smav ce->add_call_info_here(_info); 395225839Smav debug_only(__ should_not_reach_here()); 396225839Smav} 397225839Smav 398225839Smav 399113288Smdoddvoid ArrayCopyStub::emit_code(LIR_Assembler* ce) { 400225839Smav //---------------slow case: call to native----------------- 401225839Smav __ bind(_entry); 402225839Smav __ mov(src()->as_register(), O0); 403225839Smav __ mov(src_pos()->as_register(), O1); 404225839Smav __ mov(dst()->as_register(), O2); 405225839Smav __ mov(dst_pos()->as_register(), O3); 406225839Smav __ mov(length()->as_register(), O4); 407225839Smav 408225839Smav ce->emit_static_call_stub(); 409225839Smav 410225839Smav __ call(SharedRuntime::get_resolve_static_call_stub(), relocInfo::static_call_type); 411225839Smav __ delayed()->nop(); 412113288Smdodd ce->add_call_info_here(info()); 413113288Smdodd ce->verify_oop_map(info()); 414113288Smdodd 415113288Smdodd#ifndef PRODUCT 416113288Smdodd __ set((intptr_t)&Runtime1::_arraycopy_slowcase_cnt, O0); 417113288Smdodd __ ld(O0, 0, O1); 418113288Smdodd __ inc(O1); 419113288Smdodd __ st(O1, 0, O0); 420113288Smdodd#endif 421113288Smdodd 422113288Smdodd __ br(Assembler::always, false, Assembler::pt, _continuation); 423113288Smdodd __ delayed()->nop(); 424113288Smdodd} 425113288Smdodd 426113288Smdodd 427113288Smdodd/////////////////////////////////////////////////////////////////////////////////// 428113288Smdodd#ifndef SERIALGC 429113288Smdodd 430113288Smdoddvoid G1PreBarrierStub::emit_code(LIR_Assembler* ce) { 431113288Smdodd __ bind(_entry); 432113288Smdodd 433113288Smdodd assert(pre_val()->is_register(), "Precondition."); 434113288Smdodd 435113288Smdodd Register pre_val_reg = pre_val()->as_register(); 436113288Smdodd 437113288Smdodd ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false); 438113288Smdodd if (__ is_in_wdisp16_range(_continuation)) { 439113288Smdodd __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, 440113288Smdodd pre_val_reg, _continuation); 441113288Smdodd } else { 442113288Smdodd __ cmp(pre_val_reg, G0); 443113288Smdodd __ brx(Assembler::equal, false, Assembler::pn, _continuation); 444113288Smdodd } 445113328Smdodd __ delayed()->nop(); 446113328Smdodd 447113288Smdodd __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id)); 448113288Smdodd __ delayed()->mov(pre_val_reg, G4); 449113288Smdodd __ br(Assembler::always, false, Assembler::pt, _continuation); 450113288Smdodd __ delayed()->nop(); 451113288Smdodd 452113288Smdodd} 453113288Smdodd 454113288Smdoddjbyte* G1PostBarrierStub::_byte_map_base = NULL; 455113288Smdodd 456113288Smdoddjbyte* G1PostBarrierStub::byte_map_base_slow() { 457113288Smdodd BarrierSet* bs = Universe::heap()->barrier_set(); 458113288Smdodd assert(bs->is_a(BarrierSet::G1SATBCTLogging), 459113288Smdodd "Must be if we're using this."); 460113288Smdodd return ((G1SATBCardTableModRefBS*)bs)->byte_map_base; 461113288Smdodd} 462113288Smdodd 463113288Smdoddvoid G1PostBarrierStub::emit_code(LIR_Assembler* ce) { 464113288Smdodd __ bind(_entry); 465113288Smdodd 466113288Smdodd assert(addr()->is_register(), "Precondition."); 467113288Smdodd assert(new_val()->is_register(), "Precondition."); 468113288Smdodd Register addr_reg = addr()->as_pointer_register(); 469113288Smdodd Register new_val_reg = new_val()->as_register(); 470113288Smdodd if (__ is_in_wdisp16_range(_continuation)) { 471113288Smdodd __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, 472113288Smdodd new_val_reg, _continuation); 473113288Smdodd } else { 474113288Smdodd __ cmp(new_val_reg, G0); 475113288Smdodd __ brx(Assembler::equal, false, Assembler::pn, _continuation); 476113288Smdodd } 477113288Smdodd __ delayed()->nop(); 478113288Smdodd 479113288Smdodd __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_post_barrier_slow_id)); 480113288Smdodd __ delayed()->mov(addr_reg, G4); 481113288Smdodd __ br(Assembler::always, false, Assembler::pt, _continuation); 482113288Smdodd __ delayed()->nop(); 483113288Smdodd} 484113288Smdodd 485113288Smdodd#endif // SERIALGC 486113288Smdodd/////////////////////////////////////////////////////////////////////////////////// 487113288Smdodd 488113288Smdodd#undef __ 489113288Smdodd