src/cpu/sparc/vm/assembler_sparc.inline.hpp

Fri, 07 Nov 2008 09:29:38 -0800

author
kvn
date
Fri, 07 Nov 2008 09:29:38 -0800
changeset 855
a1980da045cc
parent 435
a61af66fc99e
child 1057
56aae7be60d4
permissions
-rw-r--r--

6462850: generate biased locking code in C2 ideal graph
Summary: Inline biased locking code in C2 ideal graph during macro nodes expansion
Reviewed-by: never

duke@435 1 /*
duke@435 2 * Copyright 1997-2006 Sun Microsystems, Inc. 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 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 inline void MacroAssembler::pd_patch_instruction(address branch, address target) {
duke@435 26 jint& stub_inst = *(jint*) branch;
duke@435 27 stub_inst = patched_branch(target - branch, stub_inst, 0);
duke@435 28 }
duke@435 29
duke@435 30 #ifndef PRODUCT
duke@435 31 inline void MacroAssembler::pd_print_patched_instruction(address branch) {
duke@435 32 jint stub_inst = *(jint*) branch;
duke@435 33 print_instruction(stub_inst);
duke@435 34 ::tty->print("%s", " (unresolved)");
duke@435 35 }
duke@435 36 #endif // PRODUCT
duke@435 37
duke@435 38 inline bool Address::is_simm13(int offset) { return Assembler::is_simm13(disp() + offset); }
duke@435 39
duke@435 40
duke@435 41 // inlines for SPARC assembler -- dmu 5/97
duke@435 42
duke@435 43 inline void Assembler::check_delay() {
duke@435 44 # ifdef CHECK_DELAY
duke@435 45 guarantee( delay_state != at_delay_slot, "must say delayed() when filling delay slot");
duke@435 46 delay_state = no_delay;
duke@435 47 # endif
duke@435 48 }
duke@435 49
duke@435 50 inline void Assembler::emit_long(int x) {
duke@435 51 check_delay();
duke@435 52 AbstractAssembler::emit_long(x);
duke@435 53 }
duke@435 54
duke@435 55 inline void Assembler::emit_data(int x, relocInfo::relocType rtype) {
duke@435 56 relocate(rtype);
duke@435 57 emit_long(x);
duke@435 58 }
duke@435 59
duke@435 60 inline void Assembler::emit_data(int x, RelocationHolder const& rspec) {
duke@435 61 relocate(rspec);
duke@435 62 emit_long(x);
duke@435 63 }
duke@435 64
duke@435 65
duke@435 66 inline void Assembler::add( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3) | rs1(s1) | rs2(s2) ); }
duke@435 67 inline void Assembler::add( Register s1, int simm13a, Register d, relocInfo::relocType rtype ) { emit_data( op(arith_op) | rd(d) | op3(add_op3) | rs1(s1) | immed(true) | simm(simm13a, 13), rtype ); }
duke@435 68 inline void Assembler::add( Register s1, int simm13a, Register d, RelocationHolder const& rspec ) { emit_data( op(arith_op) | rd(d) | op3(add_op3) | rs1(s1) | immed(true) | simm(simm13a, 13), rspec ); }
duke@435 69 inline void Assembler::add( const Address& a, Register d, int offset) { add( a.base(), a.disp() + offset, d, a.rspec(offset)); }
duke@435 70
duke@435 71 inline void Assembler::bpr( RCondition c, bool a, Predict p, Register s1, address d, relocInfo::relocType rt ) { v9_only(); emit_data( op(branch_op) | annul(a) | cond(c) | op2(bpr_op2) | wdisp16(intptr_t(d), intptr_t(pc())) | predict(p) | rs1(s1), rt); has_delay_slot(); }
duke@435 72 inline void Assembler::bpr( RCondition c, bool a, Predict p, Register s1, Label& L) { bpr( c, a, p, s1, target(L)); }
duke@435 73
duke@435 74 inline void Assembler::fb( Condition c, bool a, address d, relocInfo::relocType rt ) { v9_dep(); emit_data( op(branch_op) | annul(a) | cond(c) | op2(fb_op2) | wdisp(intptr_t(d), intptr_t(pc()), 22), rt); has_delay_slot(); }
duke@435 75 inline void Assembler::fb( Condition c, bool a, Label& L ) { fb(c, a, target(L)); }
duke@435 76
duke@435 77 inline void Assembler::fbp( Condition c, bool a, CC cc, Predict p, address d, relocInfo::relocType rt ) { v9_only(); emit_data( op(branch_op) | annul(a) | cond(c) | op2(fbp_op2) | branchcc(cc) | predict(p) | wdisp(intptr_t(d), intptr_t(pc()), 19), rt); has_delay_slot(); }
duke@435 78 inline void Assembler::fbp( Condition c, bool a, CC cc, Predict p, Label& L ) { fbp(c, a, cc, p, target(L)); }
duke@435 79
duke@435 80 inline void Assembler::cb( Condition c, bool a, address d, relocInfo::relocType rt ) { v8_only(); emit_data( op(branch_op) | annul(a) | cond(c) | op2(cb_op2) | wdisp(intptr_t(d), intptr_t(pc()), 22), rt); has_delay_slot(); }
duke@435 81 inline void Assembler::cb( Condition c, bool a, Label& L ) { cb(c, a, target(L)); }
duke@435 82
duke@435 83 inline void Assembler::br( Condition c, bool a, address d, relocInfo::relocType rt ) { v9_dep(); emit_data( op(branch_op) | annul(a) | cond(c) | op2(br_op2) | wdisp(intptr_t(d), intptr_t(pc()), 22), rt); has_delay_slot(); }
duke@435 84 inline void Assembler::br( Condition c, bool a, Label& L ) { br(c, a, target(L)); }
duke@435 85
duke@435 86 inline void Assembler::bp( Condition c, bool a, CC cc, Predict p, address d, relocInfo::relocType rt ) { v9_only(); emit_data( op(branch_op) | annul(a) | cond(c) | op2(bp_op2) | branchcc(cc) | predict(p) | wdisp(intptr_t(d), intptr_t(pc()), 19), rt); has_delay_slot(); }
duke@435 87 inline void Assembler::bp( Condition c, bool a, CC cc, Predict p, Label& L ) { bp(c, a, cc, p, target(L)); }
duke@435 88
duke@435 89 inline void Assembler::call( address d, relocInfo::relocType rt ) { emit_data( op(call_op) | wdisp(intptr_t(d), intptr_t(pc()), 30), rt); has_delay_slot(); assert(rt != relocInfo::virtual_call_type, "must use virtual_call_Relocation::spec"); }
duke@435 90 inline void Assembler::call( Label& L, relocInfo::relocType rt ) { call( target(L), rt); }
duke@435 91
duke@435 92 inline void Assembler::flush( Register s1, Register s2) { emit_long( op(arith_op) | op3(flush_op3) | rs1(s1) | rs2(s2)); }
duke@435 93 inline void Assembler::flush( Register s1, int simm13a) { emit_data( op(arith_op) | op3(flush_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 94
duke@435 95 inline void Assembler::jmpl( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(jmpl_op3) | rs1(s1) | rs2(s2)); has_delay_slot(); }
duke@435 96 inline void Assembler::jmpl( Register s1, int simm13a, Register d, RelocationHolder const& rspec ) { emit_data( op(arith_op) | rd(d) | op3(jmpl_op3) | rs1(s1) | immed(true) | simm(simm13a, 13), rspec); has_delay_slot(); }
duke@435 97
duke@435 98 inline void Assembler::jmpl( Address& a, Register d, int offset) { jmpl( a.base(), a.disp() + offset, d, a.rspec(offset)); }
duke@435 99
duke@435 100
duke@435 101 inline void Assembler::ldf( FloatRegisterImpl::Width w, Register s1, Register s2, FloatRegister d) { emit_long( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3, w) | rs1(s1) | rs2(s2) ); }
duke@435 102 inline void Assembler::ldf( FloatRegisterImpl::Width w, Register s1, int simm13a, FloatRegister d) { emit_data( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 103
duke@435 104 inline void Assembler::ldf( FloatRegisterImpl::Width w, const Address& a, FloatRegister d, int offset) { relocate(a.rspec(offset)); ldf( w, a.base(), a.disp() + offset, d); }
duke@435 105
duke@435 106 inline void Assembler::ldfsr( Register s1, Register s2) { v9_dep(); emit_long( op(ldst_op) | op3(ldfsr_op3) | rs1(s1) | rs2(s2) ); }
duke@435 107 inline void Assembler::ldfsr( Register s1, int simm13a) { v9_dep(); emit_data( op(ldst_op) | op3(ldfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 108 inline void Assembler::ldxfsr( Register s1, Register s2) { v9_only(); emit_long( op(ldst_op) | rd(G1) | op3(ldfsr_op3) | rs1(s1) | rs2(s2) ); }
duke@435 109 inline void Assembler::ldxfsr( Register s1, int simm13a) { v9_only(); emit_data( op(ldst_op) | rd(G1) | op3(ldfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 110
duke@435 111 inline void Assembler::ldc( Register s1, Register s2, int crd) { v8_only(); emit_long( op(ldst_op) | fcn(crd) | op3(ldc_op3 ) | rs1(s1) | rs2(s2) ); }
duke@435 112 inline void Assembler::ldc( Register s1, int simm13a, int crd) { v8_only(); emit_data( op(ldst_op) | fcn(crd) | op3(ldc_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 113 inline void Assembler::lddc( Register s1, Register s2, int crd) { v8_only(); emit_long( op(ldst_op) | fcn(crd) | op3(lddc_op3 ) | rs1(s1) | rs2(s2) ); }
duke@435 114 inline void Assembler::lddc( Register s1, int simm13a, int crd) { v8_only(); emit_data( op(ldst_op) | fcn(crd) | op3(lddc_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 115 inline void Assembler::ldcsr( Register s1, Register s2, int crd) { v8_only(); emit_long( op(ldst_op) | fcn(crd) | op3(ldcsr_op3) | rs1(s1) | rs2(s2) ); }
duke@435 116 inline void Assembler::ldcsr( Register s1, int simm13a, int crd) { v8_only(); emit_data( op(ldst_op) | fcn(crd) | op3(ldcsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 117
duke@435 118 inline void Assembler::ldsb( Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldsb_op3) | rs1(s1) | rs2(s2) ); }
duke@435 119 inline void Assembler::ldsb( Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldsb_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 120
duke@435 121 inline void Assembler::ldsh( Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldsh_op3) | rs1(s1) | rs2(s2) ); }
duke@435 122 inline void Assembler::ldsh( Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldsh_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 123 inline void Assembler::ldsw( Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldsw_op3) | rs1(s1) | rs2(s2) ); }
duke@435 124 inline void Assembler::ldsw( Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldsw_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 125 inline void Assembler::ldub( Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldub_op3) | rs1(s1) | rs2(s2) ); }
duke@435 126 inline void Assembler::ldub( Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldub_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 127 inline void Assembler::lduh( Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(lduh_op3) | rs1(s1) | rs2(s2) ); }
duke@435 128 inline void Assembler::lduh( Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(lduh_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 129 inline void Assembler::lduw( Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(lduw_op3) | rs1(s1) | rs2(s2) ); }
duke@435 130 inline void Assembler::lduw( Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(lduw_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 131
duke@435 132 inline void Assembler::ldx( Register s1, Register s2, Register d) { v9_only(); emit_long( op(ldst_op) | rd(d) | op3(ldx_op3) | rs1(s1) | rs2(s2) ); }
duke@435 133 inline void Assembler::ldx( Register s1, int simm13a, Register d) { v9_only(); emit_data( op(ldst_op) | rd(d) | op3(ldx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 134 inline void Assembler::ldd( Register s1, Register s2, Register d) { v9_dep(); assert(d->is_even(), "not even"); emit_long( op(ldst_op) | rd(d) | op3(ldd_op3) | rs1(s1) | rs2(s2) ); }
duke@435 135 inline void Assembler::ldd( Register s1, int simm13a, Register d) { v9_dep(); assert(d->is_even(), "not even"); emit_data( op(ldst_op) | rd(d) | op3(ldd_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 136
duke@435 137 #ifdef _LP64
duke@435 138 // Make all 32 bit loads signed so 64 bit registers maintain proper sign
duke@435 139 inline void Assembler::ld( Register s1, Register s2, Register d) { ldsw( s1, s2, d); }
duke@435 140 inline void Assembler::ld( Register s1, int simm13a, Register d) { ldsw( s1, simm13a, d); }
duke@435 141 #else
duke@435 142 inline void Assembler::ld( Register s1, Register s2, Register d) { lduw( s1, s2, d); }
duke@435 143 inline void Assembler::ld( Register s1, int simm13a, Register d) { lduw( s1, simm13a, d); }
duke@435 144 #endif
duke@435 145
duke@435 146
duke@435 147 inline void Assembler::ld( const Address& a, Register d, int offset ) { relocate(a.rspec(offset)); ld( a.base(), a.disp() + offset, d ); }
duke@435 148 inline void Assembler::ldsb( const Address& a, Register d, int offset ) { relocate(a.rspec(offset)); ldsb( a.base(), a.disp() + offset, d ); }
duke@435 149 inline void Assembler::ldsh( const Address& a, Register d, int offset ) { relocate(a.rspec(offset)); ldsh( a.base(), a.disp() + offset, d ); }
duke@435 150 inline void Assembler::ldsw( const Address& a, Register d, int offset ) { relocate(a.rspec(offset)); ldsw( a.base(), a.disp() + offset, d ); }
duke@435 151 inline void Assembler::ldub( const Address& a, Register d, int offset ) { relocate(a.rspec(offset)); ldub( a.base(), a.disp() + offset, d ); }
duke@435 152 inline void Assembler::lduh( const Address& a, Register d, int offset ) { relocate(a.rspec(offset)); lduh( a.base(), a.disp() + offset, d ); }
duke@435 153 inline void Assembler::lduw( const Address& a, Register d, int offset ) { relocate(a.rspec(offset)); lduw( a.base(), a.disp() + offset, d ); }
duke@435 154 inline void Assembler::ldd( const Address& a, Register d, int offset ) { relocate(a.rspec(offset)); ldd( a.base(), a.disp() + offset, d ); }
duke@435 155 inline void Assembler::ldx( const Address& a, Register d, int offset ) { relocate(a.rspec(offset)); ldx( a.base(), a.disp() + offset, d ); }
duke@435 156
duke@435 157
duke@435 158 inline void Assembler::ldstub( Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldstub_op3) | rs1(s1) | rs2(s2) ); }
duke@435 159 inline void Assembler::ldstub( Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldstub_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 160
duke@435 161
duke@435 162 inline void Assembler::prefetch(Register s1, Register s2, PrefetchFcn f) { v9_only(); emit_long( op(ldst_op) | fcn(f) | op3(prefetch_op3) | rs1(s1) | rs2(s2) ); }
duke@435 163 inline void Assembler::prefetch(Register s1, int simm13a, PrefetchFcn f) { v9_only(); emit_data( op(ldst_op) | fcn(f) | op3(prefetch_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 164
duke@435 165 inline void Assembler::prefetch(const Address& a, PrefetchFcn f, int offset) { v9_only(); relocate(a.rspec(offset)); prefetch(a.base(), a.disp() + offset, f); }
duke@435 166
duke@435 167
duke@435 168 inline void Assembler::rett( Register s1, Register s2 ) { emit_long( op(arith_op) | op3(rett_op3) | rs1(s1) | rs2(s2)); has_delay_slot(); }
duke@435 169 inline void Assembler::rett( Register s1, int simm13a, relocInfo::relocType rt) { emit_data( op(arith_op) | op3(rett_op3) | rs1(s1) | immed(true) | simm(simm13a, 13), rt); has_delay_slot(); }
duke@435 170
duke@435 171 inline void Assembler::sethi( int imm22a, Register d, RelocationHolder const& rspec ) { emit_data( op(branch_op) | rd(d) | op2(sethi_op2) | hi22(imm22a), rspec); }
duke@435 172
duke@435 173 // pp 222
duke@435 174
duke@435 175 inline void Assembler::stf( FloatRegisterImpl::Width w, FloatRegister d, Register s1, Register s2) { emit_long( op(ldst_op) | fd(d, w) | alt_op3(stf_op3, w) | rs1(s1) | rs2(s2) ); }
duke@435 176 inline void Assembler::stf( FloatRegisterImpl::Width w, FloatRegister d, Register s1, int simm13a) { emit_data( op(ldst_op) | fd(d, w) | alt_op3(stf_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 177
duke@435 178 inline void Assembler::stf( FloatRegisterImpl::Width w, FloatRegister d, const Address& a, int offset) { relocate(a.rspec(offset)); stf(w, d, a.base(), a.disp() + offset); }
duke@435 179
duke@435 180 inline void Assembler::stfsr( Register s1, Register s2) { v9_dep(); emit_long( op(ldst_op) | op3(stfsr_op3) | rs1(s1) | rs2(s2) ); }
duke@435 181 inline void Assembler::stfsr( Register s1, int simm13a) { v9_dep(); emit_data( op(ldst_op) | op3(stfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 182 inline void Assembler::stxfsr( Register s1, Register s2) { v9_only(); emit_long( op(ldst_op) | rd(G1) | op3(stfsr_op3) | rs1(s1) | rs2(s2) ); }
duke@435 183 inline void Assembler::stxfsr( Register s1, int simm13a) { v9_only(); emit_data( op(ldst_op) | rd(G1) | op3(stfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 184
duke@435 185 // p 226
duke@435 186
duke@435 187 inline void Assembler::stb( Register d, Register s1, Register s2) { emit_long( op(ldst_op) | rd(d) | op3(stb_op3) | rs1(s1) | rs2(s2) ); }
duke@435 188 inline void Assembler::stb( Register d, Register s1, int simm13a) { emit_data( op(ldst_op) | rd(d) | op3(stb_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 189 inline void Assembler::sth( Register d, Register s1, Register s2) { emit_long( op(ldst_op) | rd(d) | op3(sth_op3) | rs1(s1) | rs2(s2) ); }
duke@435 190 inline void Assembler::sth( Register d, Register s1, int simm13a) { emit_data( op(ldst_op) | rd(d) | op3(sth_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 191 inline void Assembler::stw( Register d, Register s1, Register s2) { emit_long( op(ldst_op) | rd(d) | op3(stw_op3) | rs1(s1) | rs2(s2) ); }
duke@435 192 inline void Assembler::stw( Register d, Register s1, int simm13a) { emit_data( op(ldst_op) | rd(d) | op3(stw_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 193
duke@435 194
duke@435 195 inline void Assembler::stx( Register d, Register s1, Register s2) { v9_only(); emit_long( op(ldst_op) | rd(d) | op3(stx_op3) | rs1(s1) | rs2(s2) ); }
duke@435 196 inline void Assembler::stx( Register d, Register s1, int simm13a) { v9_only(); emit_data( op(ldst_op) | rd(d) | op3(stx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 197 inline void Assembler::std( Register d, Register s1, Register s2) { v9_dep(); assert(d->is_even(), "not even"); emit_long( op(ldst_op) | rd(d) | op3(std_op3) | rs1(s1) | rs2(s2) ); }
duke@435 198 inline void Assembler::std( Register d, Register s1, int simm13a) { v9_dep(); assert(d->is_even(), "not even"); emit_data( op(ldst_op) | rd(d) | op3(std_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 199
duke@435 200 inline void Assembler::st( Register d, Register s1, Register s2) { stw(d, s1, s2); }
duke@435 201 inline void Assembler::st( Register d, Register s1, int simm13a) { stw(d, s1, simm13a); }
duke@435 202
duke@435 203 inline void Assembler::stb( Register d, const Address& a, int offset) { relocate(a.rspec(offset)); stb( d, a.base(), a.disp() + offset); }
duke@435 204 inline void Assembler::sth( Register d, const Address& a, int offset) { relocate(a.rspec(offset)); sth( d, a.base(), a.disp() + offset); }
duke@435 205 inline void Assembler::stw( Register d, const Address& a, int offset) { relocate(a.rspec(offset)); stw( d, a.base(), a.disp() + offset); }
duke@435 206 inline void Assembler::st( Register d, const Address& a, int offset) { relocate(a.rspec(offset)); st( d, a.base(), a.disp() + offset); }
duke@435 207 inline void Assembler::std( Register d, const Address& a, int offset) { relocate(a.rspec(offset)); std( d, a.base(), a.disp() + offset); }
duke@435 208 inline void Assembler::stx( Register d, const Address& a, int offset) { relocate(a.rspec(offset)); stx( d, a.base(), a.disp() + offset); }
duke@435 209
duke@435 210 // v8 p 99
duke@435 211
duke@435 212 inline void Assembler::stc( int crd, Register s1, Register s2) { v8_only(); emit_long( op(ldst_op) | fcn(crd) | op3(stc_op3 ) | rs1(s1) | rs2(s2) ); }
duke@435 213 inline void Assembler::stc( int crd, Register s1, int simm13a) { v8_only(); emit_data( op(ldst_op) | fcn(crd) | op3(stc_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 214 inline void Assembler::stdc( int crd, Register s1, Register s2) { v8_only(); emit_long( op(ldst_op) | fcn(crd) | op3(stdc_op3) | rs1(s1) | rs2(s2) ); }
duke@435 215 inline void Assembler::stdc( int crd, Register s1, int simm13a) { v8_only(); emit_data( op(ldst_op) | fcn(crd) | op3(stdc_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 216 inline void Assembler::stcsr( int crd, Register s1, Register s2) { v8_only(); emit_long( op(ldst_op) | fcn(crd) | op3(stcsr_op3) | rs1(s1) | rs2(s2) ); }
duke@435 217 inline void Assembler::stcsr( int crd, Register s1, int simm13a) { v8_only(); emit_data( op(ldst_op) | fcn(crd) | op3(stcsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 218 inline void Assembler::stdcq( int crd, Register s1, Register s2) { v8_only(); emit_long( op(ldst_op) | fcn(crd) | op3(stdcq_op3) | rs1(s1) | rs2(s2) ); }
duke@435 219 inline void Assembler::stdcq( int crd, Register s1, int simm13a) { v8_only(); emit_data( op(ldst_op) | fcn(crd) | op3(stdcq_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 220
duke@435 221
duke@435 222 // pp 231
duke@435 223
duke@435 224 inline void Assembler::swap( Register s1, Register s2, Register d) { v9_dep(); emit_long( op(ldst_op) | rd(d) | op3(swap_op3) | rs1(s1) | rs2(s2) ); }
duke@435 225 inline void Assembler::swap( Register s1, int simm13a, Register d) { v9_dep(); emit_data( op(ldst_op) | rd(d) | op3(swap_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
duke@435 226
duke@435 227 inline void Assembler::swap( Address& a, Register d, int offset ) { relocate(a.rspec(offset)); swap( a.base(), a.disp() + offset, d ); }
duke@435 228
duke@435 229
duke@435 230 // Use the right loads/stores for the platform
duke@435 231 inline void MacroAssembler::ld_ptr( Register s1, Register s2, Register d ) {
duke@435 232 #ifdef _LP64
duke@435 233 Assembler::ldx( s1, s2, d);
duke@435 234 #else
duke@435 235 Assembler::ld( s1, s2, d);
duke@435 236 #endif
duke@435 237 }
duke@435 238
duke@435 239 inline void MacroAssembler::ld_ptr( Register s1, int simm13a, Register d ) {
duke@435 240 #ifdef _LP64
duke@435 241 Assembler::ldx( s1, simm13a, d);
duke@435 242 #else
duke@435 243 Assembler::ld( s1, simm13a, d);
duke@435 244 #endif
duke@435 245 }
duke@435 246
duke@435 247 inline void MacroAssembler::ld_ptr( const Address& a, Register d, int offset ) {
duke@435 248 #ifdef _LP64
duke@435 249 Assembler::ldx( a, d, offset );
duke@435 250 #else
duke@435 251 Assembler::ld( a, d, offset );
duke@435 252 #endif
duke@435 253 }
duke@435 254
duke@435 255 inline void MacroAssembler::st_ptr( Register d, Register s1, Register s2 ) {
duke@435 256 #ifdef _LP64
duke@435 257 Assembler::stx( d, s1, s2);
duke@435 258 #else
duke@435 259 Assembler::st( d, s1, s2);
duke@435 260 #endif
duke@435 261 }
duke@435 262
duke@435 263 inline void MacroAssembler::st_ptr( Register d, Register s1, int simm13a ) {
duke@435 264 #ifdef _LP64
duke@435 265 Assembler::stx( d, s1, simm13a);
duke@435 266 #else
duke@435 267 Assembler::st( d, s1, simm13a);
duke@435 268 #endif
duke@435 269 }
duke@435 270
duke@435 271 inline void MacroAssembler::st_ptr( Register d, const Address& a, int offset) {
duke@435 272 #ifdef _LP64
duke@435 273 Assembler::stx( d, a, offset);
duke@435 274 #else
duke@435 275 Assembler::st( d, a, offset);
duke@435 276 #endif
duke@435 277 }
duke@435 278
duke@435 279 // Use the right loads/stores for the platform
duke@435 280 inline void MacroAssembler::ld_long( Register s1, Register s2, Register d ) {
duke@435 281 #ifdef _LP64
duke@435 282 Assembler::ldx(s1, s2, d);
duke@435 283 #else
duke@435 284 Assembler::ldd(s1, s2, d);
duke@435 285 #endif
duke@435 286 }
duke@435 287
duke@435 288 inline void MacroAssembler::ld_long( Register s1, int simm13a, Register d ) {
duke@435 289 #ifdef _LP64
duke@435 290 Assembler::ldx(s1, simm13a, d);
duke@435 291 #else
duke@435 292 Assembler::ldd(s1, simm13a, d);
duke@435 293 #endif
duke@435 294 }
duke@435 295
duke@435 296 inline void MacroAssembler::ld_long( const Address& a, Register d, int offset ) {
duke@435 297 #ifdef _LP64
duke@435 298 Assembler::ldx(a, d, offset );
duke@435 299 #else
duke@435 300 Assembler::ldd(a, d, offset );
duke@435 301 #endif
duke@435 302 }
duke@435 303
duke@435 304 inline void MacroAssembler::st_long( Register d, Register s1, Register s2 ) {
duke@435 305 #ifdef _LP64
duke@435 306 Assembler::stx(d, s1, s2);
duke@435 307 #else
duke@435 308 Assembler::std(d, s1, s2);
duke@435 309 #endif
duke@435 310 }
duke@435 311
duke@435 312 inline void MacroAssembler::st_long( Register d, Register s1, int simm13a ) {
duke@435 313 #ifdef _LP64
duke@435 314 Assembler::stx(d, s1, simm13a);
duke@435 315 #else
duke@435 316 Assembler::std(d, s1, simm13a);
duke@435 317 #endif
duke@435 318 }
duke@435 319
duke@435 320 inline void MacroAssembler::st_long( Register d, const Address& a, int offset ) {
duke@435 321 #ifdef _LP64
duke@435 322 Assembler::stx(d, a, offset);
duke@435 323 #else
duke@435 324 Assembler::std(d, a, offset);
duke@435 325 #endif
duke@435 326 }
duke@435 327
duke@435 328 // Functions for isolating 64 bit shifts for LP64
duke@435 329
duke@435 330 inline void MacroAssembler::sll_ptr( Register s1, Register s2, Register d ) {
duke@435 331 #ifdef _LP64
duke@435 332 Assembler::sllx(s1, s2, d);
duke@435 333 #else
duke@435 334 Assembler::sll(s1, s2, d);
duke@435 335 #endif
duke@435 336 }
duke@435 337
duke@435 338 inline void MacroAssembler::sll_ptr( Register s1, int imm6a, Register d ) {
duke@435 339 #ifdef _LP64
duke@435 340 Assembler::sllx(s1, imm6a, d);
duke@435 341 #else
duke@435 342 Assembler::sll(s1, imm6a, d);
duke@435 343 #endif
duke@435 344 }
duke@435 345
duke@435 346 inline void MacroAssembler::srl_ptr( Register s1, Register s2, Register d ) {
duke@435 347 #ifdef _LP64
duke@435 348 Assembler::srlx(s1, s2, d);
duke@435 349 #else
duke@435 350 Assembler::srl(s1, s2, d);
duke@435 351 #endif
duke@435 352 }
duke@435 353
duke@435 354 inline void MacroAssembler::srl_ptr( Register s1, int imm6a, Register d ) {
duke@435 355 #ifdef _LP64
duke@435 356 Assembler::srlx(s1, imm6a, d);
duke@435 357 #else
duke@435 358 Assembler::srl(s1, imm6a, d);
duke@435 359 #endif
duke@435 360 }
duke@435 361
duke@435 362 // Use the right branch for the platform
duke@435 363
duke@435 364 inline void MacroAssembler::br( Condition c, bool a, Predict p, address d, relocInfo::relocType rt ) {
duke@435 365 if (VM_Version::v9_instructions_work())
duke@435 366 Assembler::bp(c, a, icc, p, d, rt);
duke@435 367 else
duke@435 368 Assembler::br(c, a, d, rt);
duke@435 369 }
duke@435 370
duke@435 371 inline void MacroAssembler::br( Condition c, bool a, Predict p, Label& L ) {
duke@435 372 br(c, a, p, target(L));
duke@435 373 }
duke@435 374
duke@435 375
duke@435 376 // Branch that tests either xcc or icc depending on the
duke@435 377 // architecture compiled (LP64 or not)
duke@435 378 inline void MacroAssembler::brx( Condition c, bool a, Predict p, address d, relocInfo::relocType rt ) {
duke@435 379 #ifdef _LP64
duke@435 380 Assembler::bp(c, a, xcc, p, d, rt);
duke@435 381 #else
duke@435 382 MacroAssembler::br(c, a, p, d, rt);
duke@435 383 #endif
duke@435 384 }
duke@435 385
duke@435 386 inline void MacroAssembler::brx( Condition c, bool a, Predict p, Label& L ) {
duke@435 387 brx(c, a, p, target(L));
duke@435 388 }
duke@435 389
duke@435 390 inline void MacroAssembler::ba( bool a, Label& L ) {
duke@435 391 br(always, a, pt, L);
duke@435 392 }
duke@435 393
duke@435 394 // Warning: V9 only functions
duke@435 395 inline void MacroAssembler::bp( Condition c, bool a, CC cc, Predict p, address d, relocInfo::relocType rt ) {
duke@435 396 Assembler::bp(c, a, cc, p, d, rt);
duke@435 397 }
duke@435 398
duke@435 399 inline void MacroAssembler::bp( Condition c, bool a, CC cc, Predict p, Label& L ) {
duke@435 400 Assembler::bp(c, a, cc, p, L);
duke@435 401 }
duke@435 402
duke@435 403 inline void MacroAssembler::fb( Condition c, bool a, Predict p, address d, relocInfo::relocType rt ) {
duke@435 404 if (VM_Version::v9_instructions_work())
duke@435 405 fbp(c, a, fcc0, p, d, rt);
duke@435 406 else
duke@435 407 Assembler::fb(c, a, d, rt);
duke@435 408 }
duke@435 409
duke@435 410 inline void MacroAssembler::fb( Condition c, bool a, Predict p, Label& L ) {
duke@435 411 fb(c, a, p, target(L));
duke@435 412 }
duke@435 413
duke@435 414 inline void MacroAssembler::fbp( Condition c, bool a, CC cc, Predict p, address d, relocInfo::relocType rt ) {
duke@435 415 Assembler::fbp(c, a, cc, p, d, rt);
duke@435 416 }
duke@435 417
duke@435 418 inline void MacroAssembler::fbp( Condition c, bool a, CC cc, Predict p, Label& L ) {
duke@435 419 Assembler::fbp(c, a, cc, p, L);
duke@435 420 }
duke@435 421
duke@435 422 inline void MacroAssembler::jmp( Register s1, Register s2 ) { jmpl( s1, s2, G0 ); }
duke@435 423 inline void MacroAssembler::jmp( Register s1, int simm13a, RelocationHolder const& rspec ) { jmpl( s1, simm13a, G0, rspec); }
duke@435 424
duke@435 425 // Call with a check to see if we need to deal with the added
duke@435 426 // expense of relocation and if we overflow the displacement
duke@435 427 // of the quick call instruction./
duke@435 428 // Check to see if we have to deal with relocations
duke@435 429 inline void MacroAssembler::call( address d, relocInfo::relocType rt ) {
duke@435 430 #ifdef _LP64
duke@435 431 intptr_t disp;
duke@435 432 // NULL is ok because it will be relocated later.
duke@435 433 // Must change NULL to a reachable address in order to
duke@435 434 // pass asserts here and in wdisp.
duke@435 435 if ( d == NULL )
duke@435 436 d = pc();
duke@435 437
duke@435 438 // Is this address within range of the call instruction?
duke@435 439 // If not, use the expensive instruction sequence
duke@435 440 disp = (intptr_t)d - (intptr_t)pc();
duke@435 441 if ( disp != (intptr_t)(int32_t)disp ) {
duke@435 442 relocate(rt);
duke@435 443 Address dest(O7, (address)d);
duke@435 444 sethi(dest, /*ForceRelocatable=*/ true);
duke@435 445 jmpl(dest, O7);
duke@435 446 }
duke@435 447 else {
duke@435 448 Assembler::call( d, rt );
duke@435 449 }
duke@435 450 #else
duke@435 451 Assembler::call( d, rt );
duke@435 452 #endif
duke@435 453 }
duke@435 454
duke@435 455 inline void MacroAssembler::call( Label& L, relocInfo::relocType rt ) {
duke@435 456 MacroAssembler::call( target(L), rt);
duke@435 457 }
duke@435 458
duke@435 459
duke@435 460
duke@435 461 inline void MacroAssembler::callr( Register s1, Register s2 ) { jmpl( s1, s2, O7 ); }
duke@435 462 inline void MacroAssembler::callr( Register s1, int simm13a, RelocationHolder const& rspec ) { jmpl( s1, simm13a, O7, rspec); }
duke@435 463
duke@435 464 // prefetch instruction
duke@435 465 inline void MacroAssembler::iprefetch( address d, relocInfo::relocType rt ) {
duke@435 466 if (VM_Version::v9_instructions_work())
duke@435 467 Assembler::bp( never, true, xcc, pt, d, rt );
duke@435 468 }
duke@435 469 inline void MacroAssembler::iprefetch( Label& L) { iprefetch( target(L) ); }
duke@435 470
duke@435 471
duke@435 472 // clobbers o7 on V8!!
duke@435 473 // returns delta from gotten pc to addr after
duke@435 474 inline int MacroAssembler::get_pc( Register d ) {
duke@435 475 int x = offset();
duke@435 476 if (VM_Version::v9_instructions_work())
duke@435 477 rdpc(d);
duke@435 478 else {
duke@435 479 Label lbl;
duke@435 480 Assembler::call(lbl, relocInfo::none); // No relocation as this is call to pc+0x8
duke@435 481 if (d == O7) delayed()->nop();
duke@435 482 else delayed()->mov(O7, d);
duke@435 483 bind(lbl);
duke@435 484 }
duke@435 485 return offset() - x;
duke@435 486 }
duke@435 487
duke@435 488
duke@435 489 // Note: All MacroAssembler::set_foo functions are defined out-of-line.
duke@435 490
duke@435 491
duke@435 492 // Loads the current PC of the following instruction as an immediate value in
duke@435 493 // 2 instructions. All PCs in the CodeCache are within 2 Gig of each other.
duke@435 494 inline intptr_t MacroAssembler::load_pc_address( Register reg, int bytes_to_skip ) {
duke@435 495 intptr_t thepc = (intptr_t)pc() + 2*BytesPerInstWord + bytes_to_skip;
duke@435 496 #ifdef _LP64
duke@435 497 Unimplemented();
duke@435 498 #else
duke@435 499 Assembler::sethi( thepc & ~0x3ff, reg, internal_word_Relocation::spec((address)thepc));
duke@435 500 Assembler::add(reg,thepc & 0x3ff, reg, internal_word_Relocation::spec((address)thepc));
duke@435 501 #endif
duke@435 502 return thepc;
duke@435 503 }
duke@435 504
duke@435 505 inline void MacroAssembler::load_address( Address& a, int offset ) {
duke@435 506 assert_not_delayed();
duke@435 507 #ifdef _LP64
duke@435 508 sethi(a);
duke@435 509 add(a, a.base(), offset);
duke@435 510 #else
duke@435 511 if (a.hi() == 0 && a.rtype() == relocInfo::none) {
duke@435 512 set(a.disp() + offset, a.base());
duke@435 513 }
duke@435 514 else {
duke@435 515 sethi(a);
duke@435 516 add(a, a.base(), offset);
duke@435 517 }
duke@435 518 #endif
duke@435 519 }
duke@435 520
duke@435 521
duke@435 522 inline void MacroAssembler::split_disp( Address& a, Register temp ) {
duke@435 523 assert_not_delayed();
duke@435 524 a = a.split_disp();
duke@435 525 Assembler::sethi(a.hi(), temp, a.rspec());
duke@435 526 add(a.base(), temp, a.base());
duke@435 527 }
duke@435 528
duke@435 529
duke@435 530 inline void MacroAssembler::load_contents( Address& a, Register d, int offset ) {
duke@435 531 assert_not_delayed();
duke@435 532 sethi(a);
duke@435 533 ld(a, d, offset);
duke@435 534 }
duke@435 535
duke@435 536
duke@435 537 inline void MacroAssembler::load_ptr_contents( Address& a, Register d, int offset ) {
duke@435 538 assert_not_delayed();
duke@435 539 sethi(a);
duke@435 540 ld_ptr(a, d, offset);
duke@435 541 }
duke@435 542
duke@435 543
duke@435 544 inline void MacroAssembler::store_contents( Register s, Address& a, int offset ) {
duke@435 545 assert_not_delayed();
duke@435 546 sethi(a);
duke@435 547 st(s, a, offset);
duke@435 548 }
duke@435 549
duke@435 550
duke@435 551 inline void MacroAssembler::store_ptr_contents( Register s, Address& a, int offset ) {
duke@435 552 assert_not_delayed();
duke@435 553 sethi(a);
duke@435 554 st_ptr(s, a, offset);
duke@435 555 }
duke@435 556
duke@435 557
duke@435 558 // This code sequence is relocatable to any address, even on LP64.
duke@435 559 inline void MacroAssembler::jumpl_to( Address& a, Register d, int offset ) {
duke@435 560 assert_not_delayed();
duke@435 561 // Force fixed length sethi because NativeJump and NativeFarCall don't handle
duke@435 562 // variable length instruction streams.
duke@435 563 sethi(a, /*ForceRelocatable=*/ true);
duke@435 564 jmpl(a, d, offset);
duke@435 565 }
duke@435 566
duke@435 567
duke@435 568 inline void MacroAssembler::jump_to( Address& a, int offset ) {
duke@435 569 jumpl_to( a, G0, offset );
duke@435 570 }
duke@435 571
duke@435 572
duke@435 573 inline void MacroAssembler::set_oop( jobject obj, Register d ) {
duke@435 574 set_oop(allocate_oop_address(obj, d));
duke@435 575 }
duke@435 576
duke@435 577
duke@435 578 inline void MacroAssembler::set_oop_constant( jobject obj, Register d ) {
duke@435 579 set_oop(constant_oop_address(obj, d));
duke@435 580 }
duke@435 581
duke@435 582
duke@435 583 inline void MacroAssembler::set_oop( Address obj_addr ) {
duke@435 584 assert(obj_addr.rspec().type()==relocInfo::oop_type, "must be an oop reloc");
duke@435 585 load_address(obj_addr);
duke@435 586 }
duke@435 587
duke@435 588
duke@435 589 inline void MacroAssembler::load_argument( Argument& a, Register d ) {
duke@435 590 if (a.is_register())
duke@435 591 mov(a.as_register(), d);
duke@435 592 else
duke@435 593 ld (a.as_address(), d);
duke@435 594 }
duke@435 595
duke@435 596 inline void MacroAssembler::store_argument( Register s, Argument& a ) {
duke@435 597 if (a.is_register())
duke@435 598 mov(s, a.as_register());
duke@435 599 else
duke@435 600 st_ptr (s, a.as_address()); // ABI says everything is right justified.
duke@435 601 }
duke@435 602
duke@435 603 inline void MacroAssembler::store_ptr_argument( Register s, Argument& a ) {
duke@435 604 if (a.is_register())
duke@435 605 mov(s, a.as_register());
duke@435 606 else
duke@435 607 st_ptr (s, a.as_address());
duke@435 608 }
duke@435 609
duke@435 610
duke@435 611 #ifdef _LP64
duke@435 612 inline void MacroAssembler::store_float_argument( FloatRegister s, Argument& a ) {
duke@435 613 if (a.is_float_register())
duke@435 614 // V9 ABI has F1, F3, F5 are used to pass instead of O0, O1, O2
duke@435 615 fmov(FloatRegisterImpl::S, s, a.as_float_register() );
duke@435 616 else
duke@435 617 // Floats are stored in the high half of the stack entry
duke@435 618 // The low half is undefined per the ABI.
duke@435 619 stf(FloatRegisterImpl::S, s, a.as_address(), sizeof(jfloat));
duke@435 620 }
duke@435 621
duke@435 622 inline void MacroAssembler::store_double_argument( FloatRegister s, Argument& a ) {
duke@435 623 if (a.is_float_register())
duke@435 624 // V9 ABI has D0, D2, D4 are used to pass instead of O0, O1, O2
duke@435 625 fmov(FloatRegisterImpl::D, s, a.as_double_register() );
duke@435 626 else
duke@435 627 stf(FloatRegisterImpl::D, s, a.as_address());
duke@435 628 }
duke@435 629
duke@435 630 inline void MacroAssembler::store_long_argument( Register s, Argument& a ) {
duke@435 631 if (a.is_register())
duke@435 632 mov(s, a.as_register());
duke@435 633 else
duke@435 634 stx(s, a.as_address());
duke@435 635 }
duke@435 636 #endif
duke@435 637
duke@435 638 inline void MacroAssembler::clrb( Register s1, Register s2) { stb( G0, s1, s2 ); }
duke@435 639 inline void MacroAssembler::clrh( Register s1, Register s2) { sth( G0, s1, s2 ); }
duke@435 640 inline void MacroAssembler::clr( Register s1, Register s2) { stw( G0, s1, s2 ); }
duke@435 641 inline void MacroAssembler::clrx( Register s1, Register s2) { stx( G0, s1, s2 ); }
duke@435 642
duke@435 643 inline void MacroAssembler::clrb( Register s1, int simm13a) { stb( G0, s1, simm13a); }
duke@435 644 inline void MacroAssembler::clrh( Register s1, int simm13a) { sth( G0, s1, simm13a); }
duke@435 645 inline void MacroAssembler::clr( Register s1, int simm13a) { stw( G0, s1, simm13a); }
duke@435 646 inline void MacroAssembler::clrx( Register s1, int simm13a) { stx( G0, s1, simm13a); }
duke@435 647
duke@435 648 // returns if membar generates anything, obviously this code should mirror
duke@435 649 // membar below.
duke@435 650 inline bool MacroAssembler::membar_has_effect( Membar_mask_bits const7a ) {
duke@435 651 if( !os::is_MP() ) return false; // Not needed on single CPU
duke@435 652 if( VM_Version::v9_instructions_work() ) {
duke@435 653 const Membar_mask_bits effective_mask =
duke@435 654 Membar_mask_bits(const7a & ~(LoadLoad | LoadStore | StoreStore));
duke@435 655 return (effective_mask != 0);
duke@435 656 } else {
duke@435 657 return true;
duke@435 658 }
duke@435 659 }
duke@435 660
duke@435 661 inline void MacroAssembler::membar( Membar_mask_bits const7a ) {
duke@435 662 // Uniprocessors do not need memory barriers
duke@435 663 if (!os::is_MP()) return;
duke@435 664 // Weakened for current Sparcs and TSO. See the v9 manual, sections 8.4.3,
duke@435 665 // 8.4.4.3, a.31 and a.50.
duke@435 666 if( VM_Version::v9_instructions_work() ) {
duke@435 667 // Under TSO, setting bit 3, 2, or 0 is redundant, so the only value
duke@435 668 // of the mmask subfield of const7a that does anything that isn't done
duke@435 669 // implicitly is StoreLoad.
duke@435 670 const Membar_mask_bits effective_mask =
duke@435 671 Membar_mask_bits(const7a & ~(LoadLoad | LoadStore | StoreStore));
duke@435 672 if ( effective_mask != 0 ) {
duke@435 673 Assembler::membar( effective_mask );
duke@435 674 }
duke@435 675 } else {
duke@435 676 // stbar is the closest there is on v8. Equivalent to membar(StoreStore). We
duke@435 677 // do not issue the stbar because to my knowledge all v8 machines implement TSO,
duke@435 678 // which guarantees that all stores behave as if an stbar were issued just after
duke@435 679 // each one of them. On these machines, stbar ought to be a nop. There doesn't
duke@435 680 // appear to be an equivalent of membar(StoreLoad) on v8: TSO doesn't require it,
duke@435 681 // it can't be specified by stbar, nor have I come up with a way to simulate it.
duke@435 682 //
duke@435 683 // Addendum. Dave says that ldstub guarantees a write buffer flush to coherent
duke@435 684 // space. Put one here to be on the safe side.
duke@435 685 Assembler::ldstub(SP, 0, G0);
duke@435 686 }
duke@435 687 }

mercurial