Wed, 08 Apr 2009 10:56:49 -0700
6655638: dynamic languages need method handles
Summary: initial implementation, with known omissions (x86/64, sparc, compiler optim., c-oops, C++ interp.)
Reviewed-by: kvn, twisti, never
duke@435 | 1 | /* |
xdono@631 | 2 | * Copyright 2005-2008 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 | # include "incls/_precompiled.incl" |
duke@435 | 26 | # include "incls/_c1_LIRGenerator_sparc.cpp.incl" |
duke@435 | 27 | |
duke@435 | 28 | #ifdef ASSERT |
duke@435 | 29 | #define __ gen()->lir(__FILE__, __LINE__)-> |
duke@435 | 30 | #else |
duke@435 | 31 | #define __ gen()->lir()-> |
duke@435 | 32 | #endif |
duke@435 | 33 | |
duke@435 | 34 | void LIRItem::load_byte_item() { |
duke@435 | 35 | // byte loads use same registers as other loads |
duke@435 | 36 | load_item(); |
duke@435 | 37 | } |
duke@435 | 38 | |
duke@435 | 39 | |
duke@435 | 40 | void LIRItem::load_nonconstant() { |
duke@435 | 41 | LIR_Opr r = value()->operand(); |
duke@435 | 42 | if (_gen->can_inline_as_constant(value())) { |
duke@435 | 43 | if (!r->is_constant()) { |
duke@435 | 44 | r = LIR_OprFact::value_type(value()->type()); |
duke@435 | 45 | } |
duke@435 | 46 | _result = r; |
duke@435 | 47 | } else { |
duke@435 | 48 | load_item(); |
duke@435 | 49 | } |
duke@435 | 50 | } |
duke@435 | 51 | |
duke@435 | 52 | |
duke@435 | 53 | //-------------------------------------------------------------- |
duke@435 | 54 | // LIRGenerator |
duke@435 | 55 | //-------------------------------------------------------------- |
duke@435 | 56 | |
duke@435 | 57 | LIR_Opr LIRGenerator::exceptionOopOpr() { return FrameMap::Oexception_opr; } |
duke@435 | 58 | LIR_Opr LIRGenerator::exceptionPcOpr() { return FrameMap::Oissuing_pc_opr; } |
duke@435 | 59 | LIR_Opr LIRGenerator::syncTempOpr() { return new_register(T_OBJECT); } |
duke@435 | 60 | LIR_Opr LIRGenerator::getThreadTemp() { return rlock_callee_saved(T_INT); } |
duke@435 | 61 | |
duke@435 | 62 | LIR_Opr LIRGenerator::result_register_for(ValueType* type, bool callee) { |
duke@435 | 63 | LIR_Opr opr; |
duke@435 | 64 | switch (type->tag()) { |
duke@435 | 65 | case intTag: opr = callee ? FrameMap::I0_opr : FrameMap::O0_opr; break; |
duke@435 | 66 | case objectTag: opr = callee ? FrameMap::I0_oop_opr : FrameMap::O0_oop_opr; break; |
duke@435 | 67 | case longTag: opr = callee ? FrameMap::in_long_opr : FrameMap::out_long_opr; break; |
duke@435 | 68 | case floatTag: opr = FrameMap::F0_opr; break; |
duke@435 | 69 | case doubleTag: opr = FrameMap::F0_double_opr; break; |
duke@435 | 70 | |
duke@435 | 71 | case addressTag: |
duke@435 | 72 | default: ShouldNotReachHere(); return LIR_OprFact::illegalOpr; |
duke@435 | 73 | } |
duke@435 | 74 | |
duke@435 | 75 | assert(opr->type_field() == as_OprType(as_BasicType(type)), "type mismatch"); |
duke@435 | 76 | return opr; |
duke@435 | 77 | } |
duke@435 | 78 | |
duke@435 | 79 | LIR_Opr LIRGenerator::rlock_callee_saved(BasicType type) { |
duke@435 | 80 | LIR_Opr reg = new_register(type); |
duke@435 | 81 | set_vreg_flag(reg, callee_saved); |
duke@435 | 82 | return reg; |
duke@435 | 83 | } |
duke@435 | 84 | |
duke@435 | 85 | |
duke@435 | 86 | LIR_Opr LIRGenerator::rlock_byte(BasicType type) { |
duke@435 | 87 | return new_register(T_INT); |
duke@435 | 88 | } |
duke@435 | 89 | |
duke@435 | 90 | |
duke@435 | 91 | |
duke@435 | 92 | |
duke@435 | 93 | |
duke@435 | 94 | //--------- loading items into registers -------------------------------- |
duke@435 | 95 | |
duke@435 | 96 | // SPARC cannot inline all constants |
duke@435 | 97 | bool LIRGenerator::can_store_as_constant(Value v, BasicType type) const { |
duke@435 | 98 | if (v->type()->as_IntConstant() != NULL) { |
duke@435 | 99 | return v->type()->as_IntConstant()->value() == 0; |
duke@435 | 100 | } else if (v->type()->as_LongConstant() != NULL) { |
duke@435 | 101 | return v->type()->as_LongConstant()->value() == 0L; |
duke@435 | 102 | } else if (v->type()->as_ObjectConstant() != NULL) { |
duke@435 | 103 | return v->type()->as_ObjectConstant()->value()->is_null_object(); |
duke@435 | 104 | } else { |
duke@435 | 105 | return false; |
duke@435 | 106 | } |
duke@435 | 107 | } |
duke@435 | 108 | |
duke@435 | 109 | |
duke@435 | 110 | // only simm13 constants can be inlined |
duke@435 | 111 | bool LIRGenerator:: can_inline_as_constant(Value i) const { |
duke@435 | 112 | if (i->type()->as_IntConstant() != NULL) { |
duke@435 | 113 | return Assembler::is_simm13(i->type()->as_IntConstant()->value()); |
duke@435 | 114 | } else { |
duke@435 | 115 | return can_store_as_constant(i, as_BasicType(i->type())); |
duke@435 | 116 | } |
duke@435 | 117 | } |
duke@435 | 118 | |
duke@435 | 119 | |
duke@435 | 120 | bool LIRGenerator:: can_inline_as_constant(LIR_Const* c) const { |
duke@435 | 121 | if (c->type() == T_INT) { |
duke@435 | 122 | return Assembler::is_simm13(c->as_jint()); |
duke@435 | 123 | } |
duke@435 | 124 | return false; |
duke@435 | 125 | } |
duke@435 | 126 | |
duke@435 | 127 | |
duke@435 | 128 | LIR_Opr LIRGenerator::safepoint_poll_register() { |
duke@435 | 129 | return new_register(T_INT); |
duke@435 | 130 | } |
duke@435 | 131 | |
duke@435 | 132 | |
duke@435 | 133 | |
duke@435 | 134 | LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index, |
duke@435 | 135 | int shift, int disp, BasicType type) { |
duke@435 | 136 | assert(base->is_register(), "must be"); |
duke@435 | 137 | |
duke@435 | 138 | // accumulate fixed displacements |
duke@435 | 139 | if (index->is_constant()) { |
duke@435 | 140 | disp += index->as_constant_ptr()->as_jint() << shift; |
duke@435 | 141 | index = LIR_OprFact::illegalOpr; |
duke@435 | 142 | } |
duke@435 | 143 | |
duke@435 | 144 | if (index->is_register()) { |
duke@435 | 145 | // apply the shift and accumulate the displacement |
duke@435 | 146 | if (shift > 0) { |
duke@435 | 147 | LIR_Opr tmp = new_register(T_INT); |
duke@435 | 148 | __ shift_left(index, shift, tmp); |
duke@435 | 149 | index = tmp; |
duke@435 | 150 | } |
duke@435 | 151 | if (disp != 0) { |
duke@435 | 152 | LIR_Opr tmp = new_register(T_INT); |
duke@435 | 153 | if (Assembler::is_simm13(disp)) { |
duke@435 | 154 | __ add(tmp, LIR_OprFact::intConst(disp), tmp); |
duke@435 | 155 | index = tmp; |
duke@435 | 156 | } else { |
duke@435 | 157 | __ move(LIR_OprFact::intConst(disp), tmp); |
duke@435 | 158 | __ add(tmp, index, tmp); |
duke@435 | 159 | index = tmp; |
duke@435 | 160 | } |
duke@435 | 161 | disp = 0; |
duke@435 | 162 | } |
duke@435 | 163 | } else if (disp != 0 && !Assembler::is_simm13(disp)) { |
duke@435 | 164 | // index is illegal so replace it with the displacement loaded into a register |
duke@435 | 165 | index = new_register(T_INT); |
duke@435 | 166 | __ move(LIR_OprFact::intConst(disp), index); |
duke@435 | 167 | disp = 0; |
duke@435 | 168 | } |
duke@435 | 169 | |
duke@435 | 170 | // at this point we either have base + index or base + displacement |
duke@435 | 171 | if (disp == 0) { |
duke@435 | 172 | return new LIR_Address(base, index, type); |
duke@435 | 173 | } else { |
duke@435 | 174 | assert(Assembler::is_simm13(disp), "must be"); |
duke@435 | 175 | return new LIR_Address(base, disp, type); |
duke@435 | 176 | } |
duke@435 | 177 | } |
duke@435 | 178 | |
duke@435 | 179 | |
duke@435 | 180 | LIR_Address* LIRGenerator::emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr, |
duke@435 | 181 | BasicType type, bool needs_card_mark) { |
kvn@464 | 182 | int elem_size = type2aelembytes(type); |
duke@435 | 183 | int shift = exact_log2(elem_size); |
duke@435 | 184 | |
duke@435 | 185 | LIR_Opr base_opr; |
duke@435 | 186 | int offset = arrayOopDesc::base_offset_in_bytes(type); |
duke@435 | 187 | |
duke@435 | 188 | if (index_opr->is_constant()) { |
duke@435 | 189 | int i = index_opr->as_constant_ptr()->as_jint(); |
duke@435 | 190 | int array_offset = i * elem_size; |
duke@435 | 191 | if (Assembler::is_simm13(array_offset + offset)) { |
duke@435 | 192 | base_opr = array_opr; |
duke@435 | 193 | offset = array_offset + offset; |
duke@435 | 194 | } else { |
duke@435 | 195 | base_opr = new_pointer_register(); |
duke@435 | 196 | if (Assembler::is_simm13(array_offset)) { |
duke@435 | 197 | __ add(array_opr, LIR_OprFact::intptrConst(array_offset), base_opr); |
duke@435 | 198 | } else { |
duke@435 | 199 | __ move(LIR_OprFact::intptrConst(array_offset), base_opr); |
duke@435 | 200 | __ add(base_opr, array_opr, base_opr); |
duke@435 | 201 | } |
duke@435 | 202 | } |
duke@435 | 203 | } else { |
duke@435 | 204 | #ifdef _LP64 |
duke@435 | 205 | if (index_opr->type() == T_INT) { |
duke@435 | 206 | LIR_Opr tmp = new_register(T_LONG); |
duke@435 | 207 | __ convert(Bytecodes::_i2l, index_opr, tmp); |
duke@435 | 208 | index_opr = tmp; |
duke@435 | 209 | } |
duke@435 | 210 | #endif |
duke@435 | 211 | |
duke@435 | 212 | base_opr = new_pointer_register(); |
duke@435 | 213 | assert (index_opr->is_register(), "Must be register"); |
duke@435 | 214 | if (shift > 0) { |
duke@435 | 215 | __ shift_left(index_opr, shift, base_opr); |
duke@435 | 216 | __ add(base_opr, array_opr, base_opr); |
duke@435 | 217 | } else { |
duke@435 | 218 | __ add(index_opr, array_opr, base_opr); |
duke@435 | 219 | } |
duke@435 | 220 | } |
duke@435 | 221 | if (needs_card_mark) { |
duke@435 | 222 | LIR_Opr ptr = new_pointer_register(); |
duke@435 | 223 | __ add(base_opr, LIR_OprFact::intptrConst(offset), ptr); |
duke@435 | 224 | return new LIR_Address(ptr, 0, type); |
duke@435 | 225 | } else { |
duke@435 | 226 | return new LIR_Address(base_opr, offset, type); |
duke@435 | 227 | } |
duke@435 | 228 | } |
duke@435 | 229 | |
duke@435 | 230 | |
duke@435 | 231 | void LIRGenerator::increment_counter(address counter, int step) { |
duke@435 | 232 | LIR_Opr pointer = new_pointer_register(); |
duke@435 | 233 | __ move(LIR_OprFact::intptrConst(counter), pointer); |
duke@435 | 234 | LIR_Address* addr = new LIR_Address(pointer, 0, T_INT); |
duke@435 | 235 | increment_counter(addr, step); |
duke@435 | 236 | } |
duke@435 | 237 | |
duke@435 | 238 | void LIRGenerator::increment_counter(LIR_Address* addr, int step) { |
duke@435 | 239 | LIR_Opr temp = new_register(T_INT); |
duke@435 | 240 | __ move(addr, temp); |
duke@435 | 241 | LIR_Opr c = LIR_OprFact::intConst(step); |
duke@435 | 242 | if (Assembler::is_simm13(step)) { |
duke@435 | 243 | __ add(temp, c, temp); |
duke@435 | 244 | } else { |
duke@435 | 245 | LIR_Opr temp2 = new_register(T_INT); |
duke@435 | 246 | __ move(c, temp2); |
duke@435 | 247 | __ add(temp, temp2, temp); |
duke@435 | 248 | } |
duke@435 | 249 | __ move(temp, addr); |
duke@435 | 250 | } |
duke@435 | 251 | |
duke@435 | 252 | |
duke@435 | 253 | void LIRGenerator::cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info) { |
duke@435 | 254 | LIR_Opr o7opr = FrameMap::O7_opr; |
duke@435 | 255 | __ load(new LIR_Address(base, disp, T_INT), o7opr, info); |
duke@435 | 256 | __ cmp(condition, o7opr, c); |
duke@435 | 257 | } |
duke@435 | 258 | |
duke@435 | 259 | |
duke@435 | 260 | void LIRGenerator::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, int disp, BasicType type, CodeEmitInfo* info) { |
duke@435 | 261 | LIR_Opr o7opr = FrameMap::O7_opr; |
duke@435 | 262 | __ load(new LIR_Address(base, disp, type), o7opr, info); |
duke@435 | 263 | __ cmp(condition, reg, o7opr); |
duke@435 | 264 | } |
duke@435 | 265 | |
duke@435 | 266 | |
duke@435 | 267 | void LIRGenerator::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, LIR_Opr disp, BasicType type, CodeEmitInfo* info) { |
duke@435 | 268 | LIR_Opr o7opr = FrameMap::O7_opr; |
duke@435 | 269 | __ load(new LIR_Address(base, disp, type), o7opr, info); |
duke@435 | 270 | __ cmp(condition, reg, o7opr); |
duke@435 | 271 | } |
duke@435 | 272 | |
duke@435 | 273 | |
duke@435 | 274 | bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, int c, LIR_Opr result, LIR_Opr tmp) { |
duke@435 | 275 | assert(left != result, "should be different registers"); |
duke@435 | 276 | if (is_power_of_2(c + 1)) { |
duke@435 | 277 | __ shift_left(left, log2_intptr(c + 1), result); |
duke@435 | 278 | __ sub(result, left, result); |
duke@435 | 279 | return true; |
duke@435 | 280 | } else if (is_power_of_2(c - 1)) { |
duke@435 | 281 | __ shift_left(left, log2_intptr(c - 1), result); |
duke@435 | 282 | __ add(result, left, result); |
duke@435 | 283 | return true; |
duke@435 | 284 | } |
duke@435 | 285 | return false; |
duke@435 | 286 | } |
duke@435 | 287 | |
duke@435 | 288 | |
duke@435 | 289 | void LIRGenerator::store_stack_parameter (LIR_Opr item, ByteSize offset_from_sp) { |
duke@435 | 290 | BasicType t = item->type(); |
duke@435 | 291 | LIR_Opr sp_opr = FrameMap::SP_opr; |
duke@435 | 292 | if ((t == T_LONG || t == T_DOUBLE) && |
duke@435 | 293 | ((in_bytes(offset_from_sp) - STACK_BIAS) % 8 != 0)) { |
duke@435 | 294 | __ unaligned_move(item, new LIR_Address(sp_opr, in_bytes(offset_from_sp), t)); |
duke@435 | 295 | } else { |
duke@435 | 296 | __ move(item, new LIR_Address(sp_opr, in_bytes(offset_from_sp), t)); |
duke@435 | 297 | } |
duke@435 | 298 | } |
duke@435 | 299 | |
duke@435 | 300 | //---------------------------------------------------------------------- |
duke@435 | 301 | // visitor functions |
duke@435 | 302 | //---------------------------------------------------------------------- |
duke@435 | 303 | |
duke@435 | 304 | |
duke@435 | 305 | void LIRGenerator::do_StoreIndexed(StoreIndexed* x) { |
duke@435 | 306 | assert(x->is_root(),""); |
duke@435 | 307 | bool needs_range_check = true; |
duke@435 | 308 | bool use_length = x->length() != NULL; |
duke@435 | 309 | bool obj_store = x->elt_type() == T_ARRAY || x->elt_type() == T_OBJECT; |
duke@435 | 310 | bool needs_store_check = obj_store && (x->value()->as_Constant() == NULL || |
duke@435 | 311 | !get_jobject_constant(x->value())->is_null_object()); |
duke@435 | 312 | |
duke@435 | 313 | LIRItem array(x->array(), this); |
duke@435 | 314 | LIRItem index(x->index(), this); |
duke@435 | 315 | LIRItem value(x->value(), this); |
duke@435 | 316 | LIRItem length(this); |
duke@435 | 317 | |
duke@435 | 318 | array.load_item(); |
duke@435 | 319 | index.load_nonconstant(); |
duke@435 | 320 | |
duke@435 | 321 | if (use_length) { |
duke@435 | 322 | needs_range_check = x->compute_needs_range_check(); |
duke@435 | 323 | if (needs_range_check) { |
duke@435 | 324 | length.set_instruction(x->length()); |
duke@435 | 325 | length.load_item(); |
duke@435 | 326 | } |
duke@435 | 327 | } |
duke@435 | 328 | if (needs_store_check) { |
duke@435 | 329 | value.load_item(); |
duke@435 | 330 | } else { |
duke@435 | 331 | value.load_for_store(x->elt_type()); |
duke@435 | 332 | } |
duke@435 | 333 | |
duke@435 | 334 | set_no_result(x); |
duke@435 | 335 | |
duke@435 | 336 | // the CodeEmitInfo must be duplicated for each different |
duke@435 | 337 | // LIR-instruction because spilling can occur anywhere between two |
duke@435 | 338 | // instructions and so the debug information must be different |
duke@435 | 339 | CodeEmitInfo* range_check_info = state_for(x); |
duke@435 | 340 | CodeEmitInfo* null_check_info = NULL; |
duke@435 | 341 | if (x->needs_null_check()) { |
duke@435 | 342 | null_check_info = new CodeEmitInfo(range_check_info); |
duke@435 | 343 | } |
duke@435 | 344 | |
duke@435 | 345 | // emit array address setup early so it schedules better |
duke@435 | 346 | LIR_Address* array_addr = emit_array_address(array.result(), index.result(), x->elt_type(), obj_store); |
duke@435 | 347 | |
duke@435 | 348 | if (GenerateRangeChecks && needs_range_check) { |
duke@435 | 349 | if (use_length) { |
duke@435 | 350 | __ cmp(lir_cond_belowEqual, length.result(), index.result()); |
duke@435 | 351 | __ branch(lir_cond_belowEqual, T_INT, new RangeCheckStub(range_check_info, index.result())); |
duke@435 | 352 | } else { |
duke@435 | 353 | array_range_check(array.result(), index.result(), null_check_info, range_check_info); |
duke@435 | 354 | // range_check also does the null check |
duke@435 | 355 | null_check_info = NULL; |
duke@435 | 356 | } |
duke@435 | 357 | } |
duke@435 | 358 | |
duke@435 | 359 | if (GenerateArrayStoreCheck && needs_store_check) { |
duke@435 | 360 | LIR_Opr tmp1 = FrameMap::G1_opr; |
duke@435 | 361 | LIR_Opr tmp2 = FrameMap::G3_opr; |
duke@435 | 362 | LIR_Opr tmp3 = FrameMap::G5_opr; |
duke@435 | 363 | |
duke@435 | 364 | CodeEmitInfo* store_check_info = new CodeEmitInfo(range_check_info); |
duke@435 | 365 | __ store_check(value.result(), array.result(), tmp1, tmp2, tmp3, store_check_info); |
duke@435 | 366 | } |
duke@435 | 367 | |
ysr@777 | 368 | if (obj_store) { |
ysr@777 | 369 | // Needs GC write barriers. |
ysr@777 | 370 | pre_barrier(LIR_OprFact::address(array_addr), false, NULL); |
ysr@777 | 371 | } |
duke@435 | 372 | __ move(value.result(), array_addr, null_check_info); |
duke@435 | 373 | if (obj_store) { |
duke@435 | 374 | // Is this precise? |
duke@435 | 375 | post_barrier(LIR_OprFact::address(array_addr), value.result()); |
duke@435 | 376 | } |
duke@435 | 377 | } |
duke@435 | 378 | |
duke@435 | 379 | |
duke@435 | 380 | void LIRGenerator::do_MonitorEnter(MonitorEnter* x) { |
duke@435 | 381 | assert(x->is_root(),""); |
duke@435 | 382 | LIRItem obj(x->obj(), this); |
duke@435 | 383 | obj.load_item(); |
duke@435 | 384 | |
duke@435 | 385 | set_no_result(x); |
duke@435 | 386 | |
duke@435 | 387 | LIR_Opr lock = FrameMap::G1_opr; |
duke@435 | 388 | LIR_Opr scratch = FrameMap::G3_opr; |
duke@435 | 389 | LIR_Opr hdr = FrameMap::G4_opr; |
duke@435 | 390 | |
duke@435 | 391 | CodeEmitInfo* info_for_exception = NULL; |
duke@435 | 392 | if (x->needs_null_check()) { |
duke@435 | 393 | info_for_exception = state_for(x, x->lock_stack_before()); |
duke@435 | 394 | } |
duke@435 | 395 | |
duke@435 | 396 | // this CodeEmitInfo must not have the xhandlers because here the |
duke@435 | 397 | // object is already locked (xhandlers expects object to be unlocked) |
duke@435 | 398 | CodeEmitInfo* info = state_for(x, x->state(), true); |
duke@435 | 399 | monitor_enter(obj.result(), lock, hdr, scratch, x->monitor_no(), info_for_exception, info); |
duke@435 | 400 | } |
duke@435 | 401 | |
duke@435 | 402 | |
duke@435 | 403 | void LIRGenerator::do_MonitorExit(MonitorExit* x) { |
duke@435 | 404 | assert(x->is_root(),""); |
duke@435 | 405 | LIRItem obj(x->obj(), this); |
duke@435 | 406 | obj.dont_load_item(); |
duke@435 | 407 | |
duke@435 | 408 | set_no_result(x); |
duke@435 | 409 | LIR_Opr lock = FrameMap::G1_opr; |
duke@435 | 410 | LIR_Opr hdr = FrameMap::G3_opr; |
duke@435 | 411 | LIR_Opr obj_temp = FrameMap::G4_opr; |
duke@435 | 412 | monitor_exit(obj_temp, lock, hdr, x->monitor_no()); |
duke@435 | 413 | } |
duke@435 | 414 | |
duke@435 | 415 | |
duke@435 | 416 | // _ineg, _lneg, _fneg, _dneg |
duke@435 | 417 | void LIRGenerator::do_NegateOp(NegateOp* x) { |
duke@435 | 418 | LIRItem value(x->x(), this); |
duke@435 | 419 | value.load_item(); |
duke@435 | 420 | LIR_Opr reg = rlock_result(x); |
duke@435 | 421 | __ negate(value.result(), reg); |
duke@435 | 422 | } |
duke@435 | 423 | |
duke@435 | 424 | |
duke@435 | 425 | |
duke@435 | 426 | // for _fadd, _fmul, _fsub, _fdiv, _frem |
duke@435 | 427 | // _dadd, _dmul, _dsub, _ddiv, _drem |
duke@435 | 428 | void LIRGenerator::do_ArithmeticOp_FPU(ArithmeticOp* x) { |
duke@435 | 429 | switch (x->op()) { |
duke@435 | 430 | case Bytecodes::_fadd: |
duke@435 | 431 | case Bytecodes::_fmul: |
duke@435 | 432 | case Bytecodes::_fsub: |
duke@435 | 433 | case Bytecodes::_fdiv: |
duke@435 | 434 | case Bytecodes::_dadd: |
duke@435 | 435 | case Bytecodes::_dmul: |
duke@435 | 436 | case Bytecodes::_dsub: |
duke@435 | 437 | case Bytecodes::_ddiv: { |
duke@435 | 438 | LIRItem left(x->x(), this); |
duke@435 | 439 | LIRItem right(x->y(), this); |
duke@435 | 440 | left.load_item(); |
duke@435 | 441 | right.load_item(); |
duke@435 | 442 | rlock_result(x); |
duke@435 | 443 | arithmetic_op_fpu(x->op(), x->operand(), left.result(), right.result(), x->is_strictfp()); |
duke@435 | 444 | } |
duke@435 | 445 | break; |
duke@435 | 446 | |
duke@435 | 447 | case Bytecodes::_frem: |
duke@435 | 448 | case Bytecodes::_drem: { |
duke@435 | 449 | address entry; |
duke@435 | 450 | switch (x->op()) { |
duke@435 | 451 | case Bytecodes::_frem: |
duke@435 | 452 | entry = CAST_FROM_FN_PTR(address, SharedRuntime::frem); |
duke@435 | 453 | break; |
duke@435 | 454 | case Bytecodes::_drem: |
duke@435 | 455 | entry = CAST_FROM_FN_PTR(address, SharedRuntime::drem); |
duke@435 | 456 | break; |
duke@435 | 457 | default: |
duke@435 | 458 | ShouldNotReachHere(); |
duke@435 | 459 | } |
duke@435 | 460 | LIR_Opr result = call_runtime(x->x(), x->y(), entry, x->type(), NULL); |
duke@435 | 461 | set_result(x, result); |
duke@435 | 462 | } |
duke@435 | 463 | break; |
duke@435 | 464 | |
duke@435 | 465 | default: ShouldNotReachHere(); |
duke@435 | 466 | } |
duke@435 | 467 | } |
duke@435 | 468 | |
duke@435 | 469 | |
duke@435 | 470 | // for _ladd, _lmul, _lsub, _ldiv, _lrem |
duke@435 | 471 | void LIRGenerator::do_ArithmeticOp_Long(ArithmeticOp* x) { |
duke@435 | 472 | switch (x->op()) { |
duke@435 | 473 | case Bytecodes::_lrem: |
duke@435 | 474 | case Bytecodes::_lmul: |
duke@435 | 475 | case Bytecodes::_ldiv: { |
duke@435 | 476 | |
duke@435 | 477 | if (x->op() == Bytecodes::_ldiv || x->op() == Bytecodes::_lrem) { |
duke@435 | 478 | LIRItem right(x->y(), this); |
duke@435 | 479 | right.load_item(); |
duke@435 | 480 | |
duke@435 | 481 | CodeEmitInfo* info = state_for(x); |
duke@435 | 482 | LIR_Opr item = right.result(); |
duke@435 | 483 | assert(item->is_register(), "must be"); |
duke@435 | 484 | __ cmp(lir_cond_equal, item, LIR_OprFact::longConst(0)); |
duke@435 | 485 | __ branch(lir_cond_equal, T_LONG, new DivByZeroStub(info)); |
duke@435 | 486 | } |
duke@435 | 487 | |
duke@435 | 488 | address entry; |
duke@435 | 489 | switch (x->op()) { |
duke@435 | 490 | case Bytecodes::_lrem: |
duke@435 | 491 | entry = CAST_FROM_FN_PTR(address, SharedRuntime::lrem); |
duke@435 | 492 | break; // check if dividend is 0 is done elsewhere |
duke@435 | 493 | case Bytecodes::_ldiv: |
duke@435 | 494 | entry = CAST_FROM_FN_PTR(address, SharedRuntime::ldiv); |
duke@435 | 495 | break; // check if dividend is 0 is done elsewhere |
duke@435 | 496 | case Bytecodes::_lmul: |
duke@435 | 497 | entry = CAST_FROM_FN_PTR(address, SharedRuntime::lmul); |
duke@435 | 498 | break; |
duke@435 | 499 | default: |
duke@435 | 500 | ShouldNotReachHere(); |
duke@435 | 501 | } |
duke@435 | 502 | |
duke@435 | 503 | // order of arguments to runtime call is reversed. |
duke@435 | 504 | LIR_Opr result = call_runtime(x->y(), x->x(), entry, x->type(), NULL); |
duke@435 | 505 | set_result(x, result); |
duke@435 | 506 | break; |
duke@435 | 507 | } |
duke@435 | 508 | case Bytecodes::_ladd: |
duke@435 | 509 | case Bytecodes::_lsub: { |
duke@435 | 510 | LIRItem left(x->x(), this); |
duke@435 | 511 | LIRItem right(x->y(), this); |
duke@435 | 512 | left.load_item(); |
duke@435 | 513 | right.load_item(); |
duke@435 | 514 | rlock_result(x); |
duke@435 | 515 | |
duke@435 | 516 | arithmetic_op_long(x->op(), x->operand(), left.result(), right.result(), NULL); |
duke@435 | 517 | break; |
duke@435 | 518 | } |
duke@435 | 519 | default: ShouldNotReachHere(); |
duke@435 | 520 | } |
duke@435 | 521 | } |
duke@435 | 522 | |
duke@435 | 523 | |
duke@435 | 524 | // Returns if item is an int constant that can be represented by a simm13 |
duke@435 | 525 | static bool is_simm13(LIR_Opr item) { |
duke@435 | 526 | if (item->is_constant() && item->type() == T_INT) { |
duke@435 | 527 | return Assembler::is_simm13(item->as_constant_ptr()->as_jint()); |
duke@435 | 528 | } else { |
duke@435 | 529 | return false; |
duke@435 | 530 | } |
duke@435 | 531 | } |
duke@435 | 532 | |
duke@435 | 533 | |
duke@435 | 534 | // for: _iadd, _imul, _isub, _idiv, _irem |
duke@435 | 535 | void LIRGenerator::do_ArithmeticOp_Int(ArithmeticOp* x) { |
duke@435 | 536 | bool is_div_rem = x->op() == Bytecodes::_idiv || x->op() == Bytecodes::_irem; |
duke@435 | 537 | LIRItem left(x->x(), this); |
duke@435 | 538 | LIRItem right(x->y(), this); |
duke@435 | 539 | // missing test if instr is commutative and if we should swap |
duke@435 | 540 | right.load_nonconstant(); |
duke@435 | 541 | assert(right.is_constant() || right.is_register(), "wrong state of right"); |
duke@435 | 542 | left.load_item(); |
duke@435 | 543 | rlock_result(x); |
duke@435 | 544 | if (is_div_rem) { |
duke@435 | 545 | CodeEmitInfo* info = state_for(x); |
duke@435 | 546 | LIR_Opr tmp = FrameMap::G1_opr; |
duke@435 | 547 | if (x->op() == Bytecodes::_irem) { |
duke@435 | 548 | __ irem(left.result(), right.result(), x->operand(), tmp, info); |
duke@435 | 549 | } else if (x->op() == Bytecodes::_idiv) { |
duke@435 | 550 | __ idiv(left.result(), right.result(), x->operand(), tmp, info); |
duke@435 | 551 | } |
duke@435 | 552 | } else { |
duke@435 | 553 | arithmetic_op_int(x->op(), x->operand(), left.result(), right.result(), FrameMap::G1_opr); |
duke@435 | 554 | } |
duke@435 | 555 | } |
duke@435 | 556 | |
duke@435 | 557 | |
duke@435 | 558 | void LIRGenerator::do_ArithmeticOp(ArithmeticOp* x) { |
duke@435 | 559 | ValueTag tag = x->type()->tag(); |
duke@435 | 560 | assert(x->x()->type()->tag() == tag && x->y()->type()->tag() == tag, "wrong parameters"); |
duke@435 | 561 | switch (tag) { |
duke@435 | 562 | case floatTag: |
duke@435 | 563 | case doubleTag: do_ArithmeticOp_FPU(x); return; |
duke@435 | 564 | case longTag: do_ArithmeticOp_Long(x); return; |
duke@435 | 565 | case intTag: do_ArithmeticOp_Int(x); return; |
duke@435 | 566 | } |
duke@435 | 567 | ShouldNotReachHere(); |
duke@435 | 568 | } |
duke@435 | 569 | |
duke@435 | 570 | |
duke@435 | 571 | // _ishl, _lshl, _ishr, _lshr, _iushr, _lushr |
duke@435 | 572 | void LIRGenerator::do_ShiftOp(ShiftOp* x) { |
duke@435 | 573 | LIRItem value(x->x(), this); |
duke@435 | 574 | LIRItem count(x->y(), this); |
duke@435 | 575 | // Long shift destroys count register |
duke@435 | 576 | if (value.type()->is_long()) { |
duke@435 | 577 | count.set_destroys_register(); |
duke@435 | 578 | } |
duke@435 | 579 | value.load_item(); |
duke@435 | 580 | // the old backend doesn't support this |
duke@435 | 581 | if (count.is_constant() && count.type()->as_IntConstant() != NULL && value.type()->is_int()) { |
duke@435 | 582 | jint c = count.get_jint_constant() & 0x1f; |
duke@435 | 583 | assert(c >= 0 && c < 32, "should be small"); |
duke@435 | 584 | count.dont_load_item(); |
duke@435 | 585 | } else { |
duke@435 | 586 | count.load_item(); |
duke@435 | 587 | } |
duke@435 | 588 | LIR_Opr reg = rlock_result(x); |
duke@435 | 589 | shift_op(x->op(), reg, value.result(), count.result(), LIR_OprFact::illegalOpr); |
duke@435 | 590 | } |
duke@435 | 591 | |
duke@435 | 592 | |
duke@435 | 593 | // _iand, _land, _ior, _lor, _ixor, _lxor |
duke@435 | 594 | void LIRGenerator::do_LogicOp(LogicOp* x) { |
duke@435 | 595 | LIRItem left(x->x(), this); |
duke@435 | 596 | LIRItem right(x->y(), this); |
duke@435 | 597 | |
duke@435 | 598 | left.load_item(); |
duke@435 | 599 | right.load_nonconstant(); |
duke@435 | 600 | LIR_Opr reg = rlock_result(x); |
duke@435 | 601 | |
duke@435 | 602 | logic_op(x->op(), reg, left.result(), right.result()); |
duke@435 | 603 | } |
duke@435 | 604 | |
duke@435 | 605 | |
duke@435 | 606 | |
duke@435 | 607 | // _lcmp, _fcmpl, _fcmpg, _dcmpl, _dcmpg |
duke@435 | 608 | void LIRGenerator::do_CompareOp(CompareOp* x) { |
duke@435 | 609 | LIRItem left(x->x(), this); |
duke@435 | 610 | LIRItem right(x->y(), this); |
duke@435 | 611 | left.load_item(); |
duke@435 | 612 | right.load_item(); |
duke@435 | 613 | LIR_Opr reg = rlock_result(x); |
duke@435 | 614 | |
duke@435 | 615 | if (x->x()->type()->is_float_kind()) { |
duke@435 | 616 | Bytecodes::Code code = x->op(); |
duke@435 | 617 | __ fcmp2int(left.result(), right.result(), reg, (code == Bytecodes::_fcmpl || code == Bytecodes::_dcmpl)); |
duke@435 | 618 | } else if (x->x()->type()->tag() == longTag) { |
duke@435 | 619 | __ lcmp2int(left.result(), right.result(), reg); |
duke@435 | 620 | } else { |
duke@435 | 621 | Unimplemented(); |
duke@435 | 622 | } |
duke@435 | 623 | } |
duke@435 | 624 | |
duke@435 | 625 | |
duke@435 | 626 | void LIRGenerator::do_AttemptUpdate(Intrinsic* x) { |
duke@435 | 627 | assert(x->number_of_arguments() == 3, "wrong type"); |
duke@435 | 628 | LIRItem obj (x->argument_at(0), this); // AtomicLong object |
duke@435 | 629 | LIRItem cmp_value (x->argument_at(1), this); // value to compare with field |
duke@435 | 630 | LIRItem new_value (x->argument_at(2), this); // replace field with new_value if it matches cmp_value |
duke@435 | 631 | |
duke@435 | 632 | obj.load_item(); |
duke@435 | 633 | cmp_value.load_item(); |
duke@435 | 634 | new_value.load_item(); |
duke@435 | 635 | |
duke@435 | 636 | // generate compare-and-swap and produce zero condition if swap occurs |
duke@435 | 637 | int value_offset = sun_misc_AtomicLongCSImpl::value_offset(); |
duke@435 | 638 | LIR_Opr addr = FrameMap::O7_opr; |
duke@435 | 639 | __ add(obj.result(), LIR_OprFact::intConst(value_offset), addr); |
duke@435 | 640 | LIR_Opr t1 = FrameMap::G1_opr; // temp for 64-bit value |
duke@435 | 641 | LIR_Opr t2 = FrameMap::G3_opr; // temp for 64-bit value |
duke@435 | 642 | __ cas_long(addr, cmp_value.result(), new_value.result(), t1, t2); |
duke@435 | 643 | |
duke@435 | 644 | // generate conditional move of boolean result |
duke@435 | 645 | LIR_Opr result = rlock_result(x); |
duke@435 | 646 | __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result); |
duke@435 | 647 | } |
duke@435 | 648 | |
duke@435 | 649 | |
duke@435 | 650 | void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) { |
duke@435 | 651 | assert(x->number_of_arguments() == 4, "wrong type"); |
duke@435 | 652 | LIRItem obj (x->argument_at(0), this); // object |
duke@435 | 653 | LIRItem offset(x->argument_at(1), this); // offset of field |
duke@435 | 654 | LIRItem cmp (x->argument_at(2), this); // value to compare with field |
duke@435 | 655 | LIRItem val (x->argument_at(3), this); // replace field with val if matches cmp |
duke@435 | 656 | |
duke@435 | 657 | // Use temps to avoid kills |
duke@435 | 658 | LIR_Opr t1 = FrameMap::G1_opr; |
duke@435 | 659 | LIR_Opr t2 = FrameMap::G3_opr; |
duke@435 | 660 | LIR_Opr addr = new_pointer_register(); |
duke@435 | 661 | |
duke@435 | 662 | // get address of field |
duke@435 | 663 | obj.load_item(); |
duke@435 | 664 | offset.load_item(); |
duke@435 | 665 | cmp.load_item(); |
duke@435 | 666 | val.load_item(); |
duke@435 | 667 | |
duke@435 | 668 | __ add(obj.result(), offset.result(), addr); |
duke@435 | 669 | |
ysr@777 | 670 | if (type == objectType) { // Write-barrier needed for Object fields. |
ysr@777 | 671 | pre_barrier(obj.result(), false, NULL); |
ysr@777 | 672 | } |
ysr@777 | 673 | |
duke@435 | 674 | if (type == objectType) |
duke@435 | 675 | __ cas_obj(addr, cmp.result(), val.result(), t1, t2); |
duke@435 | 676 | else if (type == intType) |
duke@435 | 677 | __ cas_int(addr, cmp.result(), val.result(), t1, t2); |
duke@435 | 678 | else if (type == longType) |
duke@435 | 679 | __ cas_long(addr, cmp.result(), val.result(), t1, t2); |
duke@435 | 680 | else { |
duke@435 | 681 | ShouldNotReachHere(); |
duke@435 | 682 | } |
duke@435 | 683 | |
duke@435 | 684 | // generate conditional move of boolean result |
duke@435 | 685 | LIR_Opr result = rlock_result(x); |
duke@435 | 686 | __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result); |
duke@435 | 687 | if (type == objectType) { // Write-barrier needed for Object fields. |
ysr@777 | 688 | #ifdef PRECISE_CARDMARK |
ysr@777 | 689 | post_barrier(addr, val.result()); |
ysr@777 | 690 | #else |
duke@435 | 691 | post_barrier(obj.result(), val.result()); |
ysr@777 | 692 | #endif // PRECISE_CARDMARK |
duke@435 | 693 | } |
duke@435 | 694 | } |
duke@435 | 695 | |
duke@435 | 696 | |
duke@435 | 697 | void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { |
duke@435 | 698 | switch (x->id()) { |
duke@435 | 699 | case vmIntrinsics::_dabs: |
duke@435 | 700 | case vmIntrinsics::_dsqrt: { |
duke@435 | 701 | assert(x->number_of_arguments() == 1, "wrong type"); |
duke@435 | 702 | LIRItem value(x->argument_at(0), this); |
duke@435 | 703 | value.load_item(); |
duke@435 | 704 | LIR_Opr dst = rlock_result(x); |
duke@435 | 705 | |
duke@435 | 706 | switch (x->id()) { |
duke@435 | 707 | case vmIntrinsics::_dsqrt: { |
duke@435 | 708 | __ sqrt(value.result(), dst, LIR_OprFact::illegalOpr); |
duke@435 | 709 | break; |
duke@435 | 710 | } |
duke@435 | 711 | case vmIntrinsics::_dabs: { |
duke@435 | 712 | __ abs(value.result(), dst, LIR_OprFact::illegalOpr); |
duke@435 | 713 | break; |
duke@435 | 714 | } |
duke@435 | 715 | } |
duke@435 | 716 | break; |
duke@435 | 717 | } |
duke@435 | 718 | case vmIntrinsics::_dlog10: // fall through |
duke@435 | 719 | case vmIntrinsics::_dlog: // fall through |
duke@435 | 720 | case vmIntrinsics::_dsin: // fall through |
duke@435 | 721 | case vmIntrinsics::_dtan: // fall through |
duke@435 | 722 | case vmIntrinsics::_dcos: { |
duke@435 | 723 | assert(x->number_of_arguments() == 1, "wrong type"); |
duke@435 | 724 | |
duke@435 | 725 | address runtime_entry = NULL; |
duke@435 | 726 | switch (x->id()) { |
duke@435 | 727 | case vmIntrinsics::_dsin: |
duke@435 | 728 | runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dsin); |
duke@435 | 729 | break; |
duke@435 | 730 | case vmIntrinsics::_dcos: |
duke@435 | 731 | runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dcos); |
duke@435 | 732 | break; |
duke@435 | 733 | case vmIntrinsics::_dtan: |
duke@435 | 734 | runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dtan); |
duke@435 | 735 | break; |
duke@435 | 736 | case vmIntrinsics::_dlog: |
duke@435 | 737 | runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog); |
duke@435 | 738 | break; |
duke@435 | 739 | case vmIntrinsics::_dlog10: |
duke@435 | 740 | runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog10); |
duke@435 | 741 | break; |
duke@435 | 742 | default: |
duke@435 | 743 | ShouldNotReachHere(); |
duke@435 | 744 | } |
duke@435 | 745 | |
duke@435 | 746 | LIR_Opr result = call_runtime(x->argument_at(0), runtime_entry, x->type(), NULL); |
duke@435 | 747 | set_result(x, result); |
duke@435 | 748 | } |
duke@435 | 749 | } |
duke@435 | 750 | } |
duke@435 | 751 | |
duke@435 | 752 | |
duke@435 | 753 | void LIRGenerator::do_ArrayCopy(Intrinsic* x) { |
duke@435 | 754 | assert(x->number_of_arguments() == 5, "wrong type"); |
duke@435 | 755 | // Note: spill caller save before setting the item |
duke@435 | 756 | LIRItem src (x->argument_at(0), this); |
duke@435 | 757 | LIRItem src_pos (x->argument_at(1), this); |
duke@435 | 758 | LIRItem dst (x->argument_at(2), this); |
duke@435 | 759 | LIRItem dst_pos (x->argument_at(3), this); |
duke@435 | 760 | LIRItem length (x->argument_at(4), this); |
duke@435 | 761 | // load all values in callee_save_registers, as this makes the |
duke@435 | 762 | // parameter passing to the fast case simpler |
duke@435 | 763 | src.load_item_force (rlock_callee_saved(T_OBJECT)); |
duke@435 | 764 | src_pos.load_item_force (rlock_callee_saved(T_INT)); |
duke@435 | 765 | dst.load_item_force (rlock_callee_saved(T_OBJECT)); |
duke@435 | 766 | dst_pos.load_item_force (rlock_callee_saved(T_INT)); |
duke@435 | 767 | length.load_item_force (rlock_callee_saved(T_INT)); |
duke@435 | 768 | |
duke@435 | 769 | int flags; |
duke@435 | 770 | ciArrayKlass* expected_type; |
duke@435 | 771 | arraycopy_helper(x, &flags, &expected_type); |
duke@435 | 772 | |
duke@435 | 773 | CodeEmitInfo* info = state_for(x, x->state()); |
duke@435 | 774 | __ arraycopy(src.result(), src_pos.result(), dst.result(), dst_pos.result(), |
duke@435 | 775 | length.result(), rlock_callee_saved(T_INT), |
duke@435 | 776 | expected_type, flags, info); |
duke@435 | 777 | set_no_result(x); |
duke@435 | 778 | } |
duke@435 | 779 | |
duke@435 | 780 | // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f |
duke@435 | 781 | // _i2b, _i2c, _i2s |
duke@435 | 782 | void LIRGenerator::do_Convert(Convert* x) { |
duke@435 | 783 | |
duke@435 | 784 | switch (x->op()) { |
duke@435 | 785 | case Bytecodes::_f2l: |
duke@435 | 786 | case Bytecodes::_d2l: |
duke@435 | 787 | case Bytecodes::_d2i: |
duke@435 | 788 | case Bytecodes::_l2f: |
duke@435 | 789 | case Bytecodes::_l2d: { |
duke@435 | 790 | |
duke@435 | 791 | address entry; |
duke@435 | 792 | switch (x->op()) { |
duke@435 | 793 | case Bytecodes::_l2f: |
duke@435 | 794 | entry = CAST_FROM_FN_PTR(address, SharedRuntime::l2f); |
duke@435 | 795 | break; |
duke@435 | 796 | case Bytecodes::_l2d: |
duke@435 | 797 | entry = CAST_FROM_FN_PTR(address, SharedRuntime::l2d); |
duke@435 | 798 | break; |
duke@435 | 799 | case Bytecodes::_f2l: |
duke@435 | 800 | entry = CAST_FROM_FN_PTR(address, SharedRuntime::f2l); |
duke@435 | 801 | break; |
duke@435 | 802 | case Bytecodes::_d2l: |
duke@435 | 803 | entry = CAST_FROM_FN_PTR(address, SharedRuntime::d2l); |
duke@435 | 804 | break; |
duke@435 | 805 | case Bytecodes::_d2i: |
duke@435 | 806 | entry = CAST_FROM_FN_PTR(address, SharedRuntime::d2i); |
duke@435 | 807 | break; |
duke@435 | 808 | default: |
duke@435 | 809 | ShouldNotReachHere(); |
duke@435 | 810 | } |
duke@435 | 811 | LIR_Opr result = call_runtime(x->value(), entry, x->type(), NULL); |
duke@435 | 812 | set_result(x, result); |
duke@435 | 813 | break; |
duke@435 | 814 | } |
duke@435 | 815 | |
duke@435 | 816 | case Bytecodes::_i2f: |
duke@435 | 817 | case Bytecodes::_i2d: { |
duke@435 | 818 | LIRItem value(x->value(), this); |
duke@435 | 819 | |
duke@435 | 820 | LIR_Opr reg = rlock_result(x); |
duke@435 | 821 | // To convert an int to double, we need to load the 32-bit int |
duke@435 | 822 | // from memory into a single precision floating point register |
duke@435 | 823 | // (even numbered). Then the sparc fitod instruction takes care |
duke@435 | 824 | // of the conversion. This is a bit ugly, but is the best way to |
duke@435 | 825 | // get the int value in a single precision floating point register |
duke@435 | 826 | value.load_item(); |
duke@435 | 827 | LIR_Opr tmp = force_to_spill(value.result(), T_FLOAT); |
duke@435 | 828 | __ convert(x->op(), tmp, reg); |
duke@435 | 829 | break; |
duke@435 | 830 | } |
duke@435 | 831 | break; |
duke@435 | 832 | |
duke@435 | 833 | case Bytecodes::_i2l: |
duke@435 | 834 | case Bytecodes::_i2b: |
duke@435 | 835 | case Bytecodes::_i2c: |
duke@435 | 836 | case Bytecodes::_i2s: |
duke@435 | 837 | case Bytecodes::_l2i: |
duke@435 | 838 | case Bytecodes::_f2d: |
duke@435 | 839 | case Bytecodes::_d2f: { // inline code |
duke@435 | 840 | LIRItem value(x->value(), this); |
duke@435 | 841 | |
duke@435 | 842 | value.load_item(); |
duke@435 | 843 | LIR_Opr reg = rlock_result(x); |
duke@435 | 844 | __ convert(x->op(), value.result(), reg, false); |
duke@435 | 845 | } |
duke@435 | 846 | break; |
duke@435 | 847 | |
duke@435 | 848 | case Bytecodes::_f2i: { |
duke@435 | 849 | LIRItem value (x->value(), this); |
duke@435 | 850 | value.set_destroys_register(); |
duke@435 | 851 | value.load_item(); |
duke@435 | 852 | LIR_Opr reg = rlock_result(x); |
duke@435 | 853 | set_vreg_flag(reg, must_start_in_memory); |
duke@435 | 854 | __ convert(x->op(), value.result(), reg, false); |
duke@435 | 855 | } |
duke@435 | 856 | break; |
duke@435 | 857 | |
duke@435 | 858 | default: ShouldNotReachHere(); |
duke@435 | 859 | } |
duke@435 | 860 | } |
duke@435 | 861 | |
duke@435 | 862 | |
duke@435 | 863 | void LIRGenerator::do_NewInstance(NewInstance* x) { |
duke@435 | 864 | // This instruction can be deoptimized in the slow path : use |
duke@435 | 865 | // O0 as result register. |
duke@435 | 866 | const LIR_Opr reg = result_register_for(x->type()); |
duke@435 | 867 | |
duke@435 | 868 | if (PrintNotLoaded && !x->klass()->is_loaded()) { |
duke@435 | 869 | tty->print_cr(" ###class not loaded at new bci %d", x->bci()); |
duke@435 | 870 | } |
duke@435 | 871 | CodeEmitInfo* info = state_for(x, x->state()); |
duke@435 | 872 | LIR_Opr tmp1 = FrameMap::G1_oop_opr; |
duke@435 | 873 | LIR_Opr tmp2 = FrameMap::G3_oop_opr; |
duke@435 | 874 | LIR_Opr tmp3 = FrameMap::G4_oop_opr; |
duke@435 | 875 | LIR_Opr tmp4 = FrameMap::O1_oop_opr; |
duke@435 | 876 | LIR_Opr klass_reg = FrameMap::G5_oop_opr; |
duke@435 | 877 | new_instance(reg, x->klass(), tmp1, tmp2, tmp3, tmp4, klass_reg, info); |
duke@435 | 878 | LIR_Opr result = rlock_result(x); |
duke@435 | 879 | __ move(reg, result); |
duke@435 | 880 | } |
duke@435 | 881 | |
duke@435 | 882 | |
duke@435 | 883 | void LIRGenerator::do_NewTypeArray(NewTypeArray* x) { |
duke@435 | 884 | LIRItem length(x->length(), this); |
duke@435 | 885 | length.load_item(); |
duke@435 | 886 | |
duke@435 | 887 | LIR_Opr reg = result_register_for(x->type()); |
duke@435 | 888 | LIR_Opr tmp1 = FrameMap::G1_oop_opr; |
duke@435 | 889 | LIR_Opr tmp2 = FrameMap::G3_oop_opr; |
duke@435 | 890 | LIR_Opr tmp3 = FrameMap::G4_oop_opr; |
duke@435 | 891 | LIR_Opr tmp4 = FrameMap::O1_oop_opr; |
duke@435 | 892 | LIR_Opr klass_reg = FrameMap::G5_oop_opr; |
duke@435 | 893 | LIR_Opr len = length.result(); |
duke@435 | 894 | BasicType elem_type = x->elt_type(); |
duke@435 | 895 | |
duke@435 | 896 | __ oop2reg(ciTypeArrayKlass::make(elem_type)->encoding(), klass_reg); |
duke@435 | 897 | |
duke@435 | 898 | CodeEmitInfo* info = state_for(x, x->state()); |
duke@435 | 899 | CodeStub* slow_path = new NewTypeArrayStub(klass_reg, len, reg, info); |
duke@435 | 900 | __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, elem_type, klass_reg, slow_path); |
duke@435 | 901 | |
duke@435 | 902 | LIR_Opr result = rlock_result(x); |
duke@435 | 903 | __ move(reg, result); |
duke@435 | 904 | } |
duke@435 | 905 | |
duke@435 | 906 | |
duke@435 | 907 | void LIRGenerator::do_NewObjectArray(NewObjectArray* x) { |
duke@435 | 908 | LIRItem length(x->length(), this); |
duke@435 | 909 | // in case of patching (i.e., object class is not yet loaded), we need to reexecute the instruction |
duke@435 | 910 | // and therefore provide the state before the parameters have been consumed |
duke@435 | 911 | CodeEmitInfo* patching_info = NULL; |
duke@435 | 912 | if (!x->klass()->is_loaded() || PatchALot) { |
duke@435 | 913 | patching_info = state_for(x, x->state_before()); |
duke@435 | 914 | } |
duke@435 | 915 | |
duke@435 | 916 | length.load_item(); |
duke@435 | 917 | |
duke@435 | 918 | const LIR_Opr reg = result_register_for(x->type()); |
duke@435 | 919 | LIR_Opr tmp1 = FrameMap::G1_oop_opr; |
duke@435 | 920 | LIR_Opr tmp2 = FrameMap::G3_oop_opr; |
duke@435 | 921 | LIR_Opr tmp3 = FrameMap::G4_oop_opr; |
duke@435 | 922 | LIR_Opr tmp4 = FrameMap::O1_oop_opr; |
duke@435 | 923 | LIR_Opr klass_reg = FrameMap::G5_oop_opr; |
duke@435 | 924 | LIR_Opr len = length.result(); |
duke@435 | 925 | CodeEmitInfo* info = state_for(x, x->state()); |
duke@435 | 926 | |
duke@435 | 927 | CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info); |
duke@435 | 928 | ciObject* obj = (ciObject*) ciObjArrayKlass::make(x->klass()); |
duke@435 | 929 | if (obj == ciEnv::unloaded_ciobjarrayklass()) { |
duke@435 | 930 | BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error"); |
duke@435 | 931 | } |
duke@435 | 932 | jobject2reg_with_patching(klass_reg, obj, patching_info); |
duke@435 | 933 | __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path); |
duke@435 | 934 | |
duke@435 | 935 | LIR_Opr result = rlock_result(x); |
duke@435 | 936 | __ move(reg, result); |
duke@435 | 937 | } |
duke@435 | 938 | |
duke@435 | 939 | |
duke@435 | 940 | void LIRGenerator::do_NewMultiArray(NewMultiArray* x) { |
duke@435 | 941 | Values* dims = x->dims(); |
duke@435 | 942 | int i = dims->length(); |
duke@435 | 943 | LIRItemList* items = new LIRItemList(dims->length(), NULL); |
duke@435 | 944 | while (i-- > 0) { |
duke@435 | 945 | LIRItem* size = new LIRItem(dims->at(i), this); |
duke@435 | 946 | items->at_put(i, size); |
duke@435 | 947 | } |
duke@435 | 948 | |
duke@435 | 949 | // need to get the info before, as the items may become invalid through item_free |
duke@435 | 950 | CodeEmitInfo* patching_info = NULL; |
duke@435 | 951 | if (!x->klass()->is_loaded() || PatchALot) { |
duke@435 | 952 | patching_info = state_for(x, x->state_before()); |
duke@435 | 953 | |
duke@435 | 954 | // cannot re-use same xhandlers for multiple CodeEmitInfos, so |
duke@435 | 955 | // clone all handlers |
duke@435 | 956 | x->set_exception_handlers(new XHandlers(x->exception_handlers())); |
duke@435 | 957 | } |
duke@435 | 958 | |
duke@435 | 959 | i = dims->length(); |
duke@435 | 960 | while (i-- > 0) { |
duke@435 | 961 | LIRItem* size = items->at(i); |
duke@435 | 962 | // if a patching_info was generated above then debug information for the state before |
duke@435 | 963 | // the call is going to be emitted. The LIRGenerator calls above may have left some values |
duke@435 | 964 | // in registers and that's been recorded in the CodeEmitInfo. In that case the items |
duke@435 | 965 | // for those values can't simply be freed if they are registers because the values |
duke@435 | 966 | // might be destroyed by store_stack_parameter. So in the case of patching, delay the |
duke@435 | 967 | // freeing of the items that already were in registers |
duke@435 | 968 | size->load_item(); |
duke@435 | 969 | store_stack_parameter (size->result(), |
duke@435 | 970 | in_ByteSize(STACK_BIAS + |
never@739 | 971 | frame::memory_parameter_word_sp_offset * wordSize + |
never@739 | 972 | i * sizeof(jint))); |
duke@435 | 973 | } |
duke@435 | 974 | |
duke@435 | 975 | // This instruction can be deoptimized in the slow path : use |
duke@435 | 976 | // O0 as result register. |
duke@435 | 977 | const LIR_Opr reg = result_register_for(x->type()); |
duke@435 | 978 | CodeEmitInfo* info = state_for(x, x->state()); |
duke@435 | 979 | |
duke@435 | 980 | jobject2reg_with_patching(reg, x->klass(), patching_info); |
duke@435 | 981 | LIR_Opr rank = FrameMap::O1_opr; |
duke@435 | 982 | __ move(LIR_OprFact::intConst(x->rank()), rank); |
duke@435 | 983 | LIR_Opr varargs = FrameMap::as_pointer_opr(O2); |
duke@435 | 984 | int offset_from_sp = (frame::memory_parameter_word_sp_offset * wordSize) + STACK_BIAS; |
duke@435 | 985 | __ add(FrameMap::SP_opr, |
duke@435 | 986 | LIR_OprFact::intptrConst(offset_from_sp), |
duke@435 | 987 | varargs); |
duke@435 | 988 | LIR_OprList* args = new LIR_OprList(3); |
duke@435 | 989 | args->append(reg); |
duke@435 | 990 | args->append(rank); |
duke@435 | 991 | args->append(varargs); |
duke@435 | 992 | __ call_runtime(Runtime1::entry_for(Runtime1::new_multi_array_id), |
duke@435 | 993 | LIR_OprFact::illegalOpr, |
duke@435 | 994 | reg, args, info); |
duke@435 | 995 | |
duke@435 | 996 | LIR_Opr result = rlock_result(x); |
duke@435 | 997 | __ move(reg, result); |
duke@435 | 998 | } |
duke@435 | 999 | |
duke@435 | 1000 | |
duke@435 | 1001 | void LIRGenerator::do_BlockBegin(BlockBegin* x) { |
duke@435 | 1002 | } |
duke@435 | 1003 | |
duke@435 | 1004 | |
duke@435 | 1005 | void LIRGenerator::do_CheckCast(CheckCast* x) { |
duke@435 | 1006 | LIRItem obj(x->obj(), this); |
duke@435 | 1007 | CodeEmitInfo* patching_info = NULL; |
duke@435 | 1008 | if (!x->klass()->is_loaded() || (PatchALot && !x->is_incompatible_class_change_check())) { |
duke@435 | 1009 | // must do this before locking the destination register as an oop register, |
duke@435 | 1010 | // and before the obj is loaded (so x->obj()->item() is valid for creating a debug info location) |
duke@435 | 1011 | patching_info = state_for(x, x->state_before()); |
duke@435 | 1012 | } |
duke@435 | 1013 | obj.load_item(); |
duke@435 | 1014 | LIR_Opr out_reg = rlock_result(x); |
duke@435 | 1015 | CodeStub* stub; |
duke@435 | 1016 | CodeEmitInfo* info_for_exception = state_for(x, x->state()->copy_locks()); |
duke@435 | 1017 | |
duke@435 | 1018 | if (x->is_incompatible_class_change_check()) { |
duke@435 | 1019 | assert(patching_info == NULL, "can't patch this"); |
duke@435 | 1020 | stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); |
duke@435 | 1021 | } else { |
duke@435 | 1022 | stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception); |
duke@435 | 1023 | } |
duke@435 | 1024 | LIR_Opr tmp1 = FrameMap::G1_oop_opr; |
duke@435 | 1025 | LIR_Opr tmp2 = FrameMap::G3_oop_opr; |
duke@435 | 1026 | LIR_Opr tmp3 = FrameMap::G4_oop_opr; |
duke@435 | 1027 | __ checkcast(out_reg, obj.result(), x->klass(), tmp1, tmp2, tmp3, |
duke@435 | 1028 | x->direct_compare(), info_for_exception, patching_info, stub, |
duke@435 | 1029 | x->profiled_method(), x->profiled_bci()); |
duke@435 | 1030 | } |
duke@435 | 1031 | |
duke@435 | 1032 | |
duke@435 | 1033 | void LIRGenerator::do_InstanceOf(InstanceOf* x) { |
duke@435 | 1034 | LIRItem obj(x->obj(), this); |
duke@435 | 1035 | CodeEmitInfo* patching_info = NULL; |
duke@435 | 1036 | if (!x->klass()->is_loaded() || PatchALot) { |
duke@435 | 1037 | patching_info = state_for(x, x->state_before()); |
duke@435 | 1038 | } |
duke@435 | 1039 | // ensure the result register is not the input register because the result is initialized before the patching safepoint |
duke@435 | 1040 | obj.load_item(); |
duke@435 | 1041 | LIR_Opr out_reg = rlock_result(x); |
duke@435 | 1042 | LIR_Opr tmp1 = FrameMap::G1_oop_opr; |
duke@435 | 1043 | LIR_Opr tmp2 = FrameMap::G3_oop_opr; |
duke@435 | 1044 | LIR_Opr tmp3 = FrameMap::G4_oop_opr; |
duke@435 | 1045 | __ instanceof(out_reg, obj.result(), x->klass(), tmp1, tmp2, tmp3, x->direct_compare(), patching_info); |
duke@435 | 1046 | } |
duke@435 | 1047 | |
duke@435 | 1048 | |
duke@435 | 1049 | void LIRGenerator::do_If(If* x) { |
duke@435 | 1050 | assert(x->number_of_sux() == 2, "inconsistency"); |
duke@435 | 1051 | ValueTag tag = x->x()->type()->tag(); |
duke@435 | 1052 | LIRItem xitem(x->x(), this); |
duke@435 | 1053 | LIRItem yitem(x->y(), this); |
duke@435 | 1054 | LIRItem* xin = &xitem; |
duke@435 | 1055 | LIRItem* yin = &yitem; |
duke@435 | 1056 | If::Condition cond = x->cond(); |
duke@435 | 1057 | |
duke@435 | 1058 | if (tag == longTag) { |
duke@435 | 1059 | // for longs, only conditions "eql", "neq", "lss", "geq" are valid; |
duke@435 | 1060 | // mirror for other conditions |
duke@435 | 1061 | if (cond == If::gtr || cond == If::leq) { |
duke@435 | 1062 | // swap inputs |
duke@435 | 1063 | cond = Instruction::mirror(cond); |
duke@435 | 1064 | xin = &yitem; |
duke@435 | 1065 | yin = &xitem; |
duke@435 | 1066 | } |
duke@435 | 1067 | xin->set_destroys_register(); |
duke@435 | 1068 | } |
duke@435 | 1069 | |
duke@435 | 1070 | LIR_Opr left = LIR_OprFact::illegalOpr; |
duke@435 | 1071 | LIR_Opr right = LIR_OprFact::illegalOpr; |
duke@435 | 1072 | |
duke@435 | 1073 | xin->load_item(); |
duke@435 | 1074 | left = xin->result(); |
duke@435 | 1075 | |
duke@435 | 1076 | if (is_simm13(yin->result())) { |
duke@435 | 1077 | // inline int constants which are small enough to be immediate operands |
duke@435 | 1078 | right = LIR_OprFact::value_type(yin->value()->type()); |
duke@435 | 1079 | } else if (tag == longTag && yin->is_constant() && yin->get_jlong_constant() == 0 && |
duke@435 | 1080 | (cond == If::eql || cond == If::neq)) { |
duke@435 | 1081 | // inline long zero |
duke@435 | 1082 | right = LIR_OprFact::value_type(yin->value()->type()); |
duke@435 | 1083 | } else if (tag == objectTag && yin->is_constant() && (yin->get_jobject_constant()->is_null_object())) { |
duke@435 | 1084 | right = LIR_OprFact::value_type(yin->value()->type()); |
duke@435 | 1085 | } else { |
duke@435 | 1086 | yin->load_item(); |
duke@435 | 1087 | right = yin->result(); |
duke@435 | 1088 | } |
duke@435 | 1089 | set_no_result(x); |
duke@435 | 1090 | |
duke@435 | 1091 | // add safepoint before generating condition code so it can be recomputed |
duke@435 | 1092 | if (x->is_safepoint()) { |
duke@435 | 1093 | // increment backedge counter if needed |
duke@435 | 1094 | increment_backedge_counter(state_for(x, x->state_before())); |
duke@435 | 1095 | |
duke@435 | 1096 | __ safepoint(new_register(T_INT), state_for(x, x->state_before())); |
duke@435 | 1097 | } |
duke@435 | 1098 | |
duke@435 | 1099 | __ cmp(lir_cond(cond), left, right); |
duke@435 | 1100 | profile_branch(x, cond); |
duke@435 | 1101 | move_to_phi(x->state()); |
duke@435 | 1102 | if (x->x()->type()->is_float_kind()) { |
duke@435 | 1103 | __ branch(lir_cond(cond), right->type(), x->tsux(), x->usux()); |
duke@435 | 1104 | } else { |
duke@435 | 1105 | __ branch(lir_cond(cond), right->type(), x->tsux()); |
duke@435 | 1106 | } |
duke@435 | 1107 | assert(x->default_sux() == x->fsux(), "wrong destination above"); |
duke@435 | 1108 | __ jump(x->default_sux()); |
duke@435 | 1109 | } |
duke@435 | 1110 | |
duke@435 | 1111 | |
duke@435 | 1112 | LIR_Opr LIRGenerator::getThreadPointer() { |
duke@435 | 1113 | return FrameMap::as_pointer_opr(G2); |
duke@435 | 1114 | } |
duke@435 | 1115 | |
duke@435 | 1116 | |
duke@435 | 1117 | void LIRGenerator::trace_block_entry(BlockBegin* block) { |
duke@435 | 1118 | __ move(LIR_OprFact::intConst(block->block_id()), FrameMap::O0_opr); |
duke@435 | 1119 | LIR_OprList* args = new LIR_OprList(1); |
duke@435 | 1120 | args->append(FrameMap::O0_opr); |
duke@435 | 1121 | address func = CAST_FROM_FN_PTR(address, Runtime1::trace_block_entry); |
duke@435 | 1122 | __ call_runtime_leaf(func, rlock_callee_saved(T_INT), LIR_OprFact::illegalOpr, args); |
duke@435 | 1123 | } |
duke@435 | 1124 | |
duke@435 | 1125 | |
duke@435 | 1126 | void LIRGenerator::volatile_field_store(LIR_Opr value, LIR_Address* address, |
duke@435 | 1127 | CodeEmitInfo* info) { |
duke@435 | 1128 | #ifdef _LP64 |
duke@435 | 1129 | __ store(value, address, info); |
duke@435 | 1130 | #else |
duke@435 | 1131 | __ volatile_store_mem_reg(value, address, info); |
duke@435 | 1132 | #endif |
duke@435 | 1133 | } |
duke@435 | 1134 | |
duke@435 | 1135 | void LIRGenerator::volatile_field_load(LIR_Address* address, LIR_Opr result, |
duke@435 | 1136 | CodeEmitInfo* info) { |
duke@435 | 1137 | #ifdef _LP64 |
duke@435 | 1138 | __ load(address, result, info); |
duke@435 | 1139 | #else |
duke@435 | 1140 | __ volatile_load_mem_reg(address, result, info); |
duke@435 | 1141 | #endif |
duke@435 | 1142 | } |
duke@435 | 1143 | |
duke@435 | 1144 | |
duke@435 | 1145 | void LIRGenerator::put_Object_unsafe(LIR_Opr src, LIR_Opr offset, LIR_Opr data, |
duke@435 | 1146 | BasicType type, bool is_volatile) { |
duke@435 | 1147 | LIR_Opr base_op = src; |
duke@435 | 1148 | LIR_Opr index_op = offset; |
duke@435 | 1149 | |
duke@435 | 1150 | bool is_obj = (type == T_ARRAY || type == T_OBJECT); |
duke@435 | 1151 | #ifndef _LP64 |
duke@435 | 1152 | if (is_volatile && type == T_LONG) { |
duke@435 | 1153 | __ volatile_store_unsafe_reg(data, src, offset, type, NULL, lir_patch_none); |
duke@435 | 1154 | } else |
duke@435 | 1155 | #endif |
duke@435 | 1156 | { |
duke@435 | 1157 | if (type == T_BOOLEAN) { |
duke@435 | 1158 | type = T_BYTE; |
duke@435 | 1159 | } |
duke@435 | 1160 | LIR_Address* addr; |
duke@435 | 1161 | if (type == T_ARRAY || type == T_OBJECT) { |
duke@435 | 1162 | LIR_Opr tmp = new_pointer_register(); |
duke@435 | 1163 | __ add(base_op, index_op, tmp); |
duke@435 | 1164 | addr = new LIR_Address(tmp, 0, type); |
duke@435 | 1165 | } else { |
duke@435 | 1166 | addr = new LIR_Address(base_op, index_op, type); |
duke@435 | 1167 | } |
duke@435 | 1168 | |
ysr@777 | 1169 | if (is_obj) { |
ysr@777 | 1170 | pre_barrier(LIR_OprFact::address(addr), false, NULL); |
ysr@777 | 1171 | // _bs->c1_write_barrier_pre(this, LIR_OprFact::address(addr)); |
ysr@777 | 1172 | } |
duke@435 | 1173 | __ move(data, addr); |
duke@435 | 1174 | if (is_obj) { |
duke@435 | 1175 | // This address is precise |
duke@435 | 1176 | post_barrier(LIR_OprFact::address(addr), data); |
duke@435 | 1177 | } |
duke@435 | 1178 | } |
duke@435 | 1179 | } |
duke@435 | 1180 | |
duke@435 | 1181 | |
duke@435 | 1182 | void LIRGenerator::get_Object_unsafe(LIR_Opr dst, LIR_Opr src, LIR_Opr offset, |
duke@435 | 1183 | BasicType type, bool is_volatile) { |
duke@435 | 1184 | #ifndef _LP64 |
duke@435 | 1185 | if (is_volatile && type == T_LONG) { |
duke@435 | 1186 | __ volatile_load_unsafe_reg(src, offset, dst, type, NULL, lir_patch_none); |
duke@435 | 1187 | } else |
duke@435 | 1188 | #endif |
duke@435 | 1189 | { |
duke@435 | 1190 | LIR_Address* addr = new LIR_Address(src, offset, type); |
duke@435 | 1191 | __ load(addr, dst); |
duke@435 | 1192 | } |
duke@435 | 1193 | } |