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