src/share/vm/c1/c1_LIR.cpp

Mon, 11 Jun 2018 16:44:16 +0800

author
fujie
date
Mon, 11 Jun 2018 16:44:16 +0800
changeset 9142
87ee44a01d68
parent 9138
b56ab8e56604
child 9143
239e32ede77d
permissions
-rw-r--r--

#7180 Remove duplicated cas_* lir for MIPS only.

aoqi@0 1 /*
dlong@7598 2 * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@1 25 /*
aoqi@1 26 * This file has been modified by Loongson Technology in 2015. These
aoqi@1 27 * modifications are Copyright (c) 2015 Loongson Technology, and are made
aoqi@1 28 * available on the same license terms set forth above.
aoqi@1 29 */
aoqi@1 30
aoqi@0 31 #include "precompiled.hpp"
aoqi@0 32 #include "c1/c1_InstructionPrinter.hpp"
aoqi@0 33 #include "c1/c1_LIR.hpp"
aoqi@0 34 #include "c1/c1_LIRAssembler.hpp"
aoqi@0 35 #include "c1/c1_ValueStack.hpp"
aoqi@0 36 #include "ci/ciInstance.hpp"
aoqi@0 37 #include "runtime/sharedRuntime.hpp"
aoqi@0 38
aoqi@0 39 Register LIR_OprDesc::as_register() const {
aoqi@0 40 return FrameMap::cpu_rnr2reg(cpu_regnr());
aoqi@0 41 }
aoqi@0 42
aoqi@0 43 Register LIR_OprDesc::as_register_lo() const {
aoqi@0 44 return FrameMap::cpu_rnr2reg(cpu_regnrLo());
aoqi@0 45 }
aoqi@0 46
aoqi@0 47 Register LIR_OprDesc::as_register_hi() const {
aoqi@0 48 return FrameMap::cpu_rnr2reg(cpu_regnrHi());
aoqi@0 49 }
aoqi@0 50
aoqi@0 51 #if defined(X86)
aoqi@0 52
aoqi@0 53 XMMRegister LIR_OprDesc::as_xmm_float_reg() const {
aoqi@0 54 return FrameMap::nr2xmmreg(xmm_regnr());
aoqi@0 55 }
aoqi@0 56
aoqi@0 57 XMMRegister LIR_OprDesc::as_xmm_double_reg() const {
aoqi@0 58 assert(xmm_regnrLo() == xmm_regnrHi(), "assumed in calculation");
aoqi@0 59 return FrameMap::nr2xmmreg(xmm_regnrLo());
aoqi@0 60 }
aoqi@0 61
aoqi@0 62 #endif // X86
aoqi@0 63
fujie@9138 64 #if defined(SPARC) || defined(PPC) || defined(MIPS)
aoqi@0 65
aoqi@0 66 FloatRegister LIR_OprDesc::as_float_reg() const {
aoqi@0 67 return FrameMap::nr2floatreg(fpu_regnr());
aoqi@0 68 }
aoqi@0 69
aoqi@0 70 FloatRegister LIR_OprDesc::as_double_reg() const {
aoqi@0 71 return FrameMap::nr2floatreg(fpu_regnrHi());
aoqi@0 72 }
aoqi@0 73
aoqi@0 74 #endif
aoqi@0 75
aoqi@0 76 #ifdef ARM
aoqi@0 77
aoqi@0 78 FloatRegister LIR_OprDesc::as_float_reg() const {
aoqi@0 79 return as_FloatRegister(fpu_regnr());
aoqi@0 80 }
aoqi@0 81
aoqi@0 82 FloatRegister LIR_OprDesc::as_double_reg() const {
aoqi@0 83 return as_FloatRegister(fpu_regnrLo());
aoqi@0 84 }
aoqi@0 85
aoqi@0 86 #endif
aoqi@0 87
aoqi@0 88
aoqi@0 89 LIR_Opr LIR_OprFact::illegalOpr = LIR_OprFact::illegal();
aoqi@0 90
aoqi@0 91 LIR_Opr LIR_OprFact::value_type(ValueType* type) {
aoqi@0 92 ValueTag tag = type->tag();
aoqi@0 93 switch (tag) {
aoqi@0 94 case metaDataTag : {
aoqi@0 95 ClassConstant* c = type->as_ClassConstant();
aoqi@0 96 if (c != NULL && !c->value()->is_loaded()) {
aoqi@0 97 return LIR_OprFact::metadataConst(NULL);
aoqi@0 98 } else if (c != NULL) {
aoqi@0 99 return LIR_OprFact::metadataConst(c->value()->constant_encoding());
aoqi@0 100 } else {
aoqi@0 101 MethodConstant* m = type->as_MethodConstant();
aoqi@0 102 assert (m != NULL, "not a class or a method?");
aoqi@0 103 return LIR_OprFact::metadataConst(m->value()->constant_encoding());
aoqi@0 104 }
aoqi@0 105 }
aoqi@0 106 case objectTag : {
aoqi@0 107 return LIR_OprFact::oopConst(type->as_ObjectType()->encoding());
aoqi@0 108 }
aoqi@0 109 case addressTag: return LIR_OprFact::addressConst(type->as_AddressConstant()->value());
aoqi@0 110 case intTag : return LIR_OprFact::intConst(type->as_IntConstant()->value());
aoqi@0 111 case floatTag : return LIR_OprFact::floatConst(type->as_FloatConstant()->value());
aoqi@0 112 case longTag : return LIR_OprFact::longConst(type->as_LongConstant()->value());
aoqi@0 113 case doubleTag : return LIR_OprFact::doubleConst(type->as_DoubleConstant()->value());
aoqi@0 114 default: ShouldNotReachHere(); return LIR_OprFact::intConst(-1);
aoqi@0 115 }
aoqi@0 116 }
aoqi@0 117
aoqi@0 118
aoqi@0 119 LIR_Opr LIR_OprFact::dummy_value_type(ValueType* type) {
aoqi@0 120 switch (type->tag()) {
aoqi@0 121 case objectTag: return LIR_OprFact::oopConst(NULL);
aoqi@0 122 case addressTag:return LIR_OprFact::addressConst(0);
aoqi@0 123 case intTag: return LIR_OprFact::intConst(0);
aoqi@0 124 case floatTag: return LIR_OprFact::floatConst(0.0);
aoqi@0 125 case longTag: return LIR_OprFact::longConst(0);
aoqi@0 126 case doubleTag: return LIR_OprFact::doubleConst(0.0);
aoqi@0 127 default: ShouldNotReachHere(); return LIR_OprFact::intConst(-1);
aoqi@0 128 }
aoqi@0 129 return illegalOpr;
aoqi@0 130 }
aoqi@0 131
aoqi@0 132
aoqi@0 133
aoqi@0 134 //---------------------------------------------------
aoqi@0 135
aoqi@0 136
aoqi@0 137 LIR_Address::Scale LIR_Address::scale(BasicType type) {
aoqi@0 138 int elem_size = type2aelembytes(type);
aoqi@0 139 switch (elem_size) {
aoqi@0 140 case 1: return LIR_Address::times_1;
aoqi@0 141 case 2: return LIR_Address::times_2;
aoqi@0 142 case 4: return LIR_Address::times_4;
aoqi@0 143 case 8: return LIR_Address::times_8;
aoqi@0 144 }
aoqi@0 145 ShouldNotReachHere();
aoqi@0 146 return LIR_Address::times_1;
aoqi@0 147 }
aoqi@0 148
aoqi@0 149
aoqi@0 150 #ifndef PRODUCT
dlong@7598 151 void LIR_Address::verify0() const {
fujie@9138 152 #if defined(SPARC) || defined(PPC) || defined(MIPS)
aoqi@0 153 assert(scale() == times_1, "Scaled addressing mode not available on SPARC/PPC and should not be used");
aoqi@0 154 assert(disp() == 0 || index()->is_illegal(), "can't have both");
aoqi@0 155 #endif
aoqi@0 156 #ifdef _LP64
aoqi@0 157 assert(base()->is_cpu_register(), "wrong base operand");
aoqi@0 158 assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand");
fujie@9138 159 #ifndef MIPS
aoqi@0 160 assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA,
aoqi@0 161 "wrong type for addresses");
aoqi@1 162 #endif
aoqi@0 163 #else
aoqi@0 164 assert(base()->is_single_cpu(), "wrong base operand");
aoqi@0 165 assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand");
aoqi@0 166 assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA,
aoqi@0 167 "wrong type for addresses");
aoqi@0 168 #endif
aoqi@0 169 }
aoqi@0 170 #endif
aoqi@0 171
aoqi@0 172
aoqi@0 173 //---------------------------------------------------
aoqi@0 174
aoqi@0 175 char LIR_OprDesc::type_char(BasicType t) {
aoqi@0 176 switch (t) {
aoqi@0 177 case T_ARRAY:
aoqi@0 178 t = T_OBJECT;
aoqi@0 179 case T_BOOLEAN:
aoqi@0 180 case T_CHAR:
aoqi@0 181 case T_FLOAT:
aoqi@0 182 case T_DOUBLE:
aoqi@0 183 case T_BYTE:
aoqi@0 184 case T_SHORT:
aoqi@0 185 case T_INT:
aoqi@0 186 case T_LONG:
aoqi@0 187 case T_OBJECT:
aoqi@0 188 case T_ADDRESS:
aoqi@0 189 case T_VOID:
aoqi@0 190 return ::type2char(t);
aoqi@0 191 case T_METADATA:
aoqi@0 192 return 'M';
aoqi@0 193 case T_ILLEGAL:
aoqi@0 194 return '?';
aoqi@0 195
aoqi@0 196 default:
aoqi@0 197 ShouldNotReachHere();
aoqi@0 198 return '?';
aoqi@0 199 }
aoqi@0 200 }
aoqi@0 201
aoqi@0 202 #ifndef PRODUCT
aoqi@0 203 void LIR_OprDesc::validate_type() const {
aoqi@0 204
aoqi@0 205 #ifdef ASSERT
aoqi@0 206 if (!is_pointer() && !is_illegal()) {
aoqi@0 207 OprKind kindfield = kind_field(); // Factored out because of compiler bug, see 8002160
aoqi@0 208 switch (as_BasicType(type_field())) {
aoqi@0 209 case T_LONG:
aoqi@0 210 assert((kindfield == cpu_register || kindfield == stack_value) &&
aoqi@0 211 size_field() == double_size, "must match");
aoqi@0 212 break;
aoqi@0 213 case T_FLOAT:
aoqi@0 214 // FP return values can be also in CPU registers on ARM and PPC (softfp ABI)
aoqi@0 215 assert((kindfield == fpu_register || kindfield == stack_value
aoqi@0 216 ARM_ONLY(|| kindfield == cpu_register)
aoqi@0 217 PPC_ONLY(|| kindfield == cpu_register) ) &&
aoqi@0 218 size_field() == single_size, "must match");
aoqi@0 219 break;
aoqi@0 220 case T_DOUBLE:
aoqi@0 221 // FP return values can be also in CPU registers on ARM and PPC (softfp ABI)
aoqi@0 222 assert((kindfield == fpu_register || kindfield == stack_value
aoqi@0 223 ARM_ONLY(|| kindfield == cpu_register)
aoqi@0 224 PPC_ONLY(|| kindfield == cpu_register) ) &&
aoqi@0 225 size_field() == double_size, "must match");
aoqi@0 226 break;
aoqi@0 227 case T_BOOLEAN:
aoqi@0 228 case T_CHAR:
aoqi@0 229 case T_BYTE:
aoqi@0 230 case T_SHORT:
aoqi@0 231 case T_INT:
aoqi@0 232 case T_ADDRESS:
aoqi@0 233 case T_OBJECT:
aoqi@0 234 case T_METADATA:
aoqi@0 235 case T_ARRAY:
aoqi@0 236 assert((kindfield == cpu_register || kindfield == stack_value) &&
aoqi@0 237 size_field() == single_size, "must match");
aoqi@0 238 break;
aoqi@0 239
aoqi@0 240 case T_ILLEGAL:
aoqi@0 241 // XXX TKR also means unknown right now
aoqi@0 242 // assert(is_illegal(), "must match");
aoqi@0 243 break;
aoqi@0 244
aoqi@0 245 default:
aoqi@0 246 ShouldNotReachHere();
aoqi@0 247 }
aoqi@0 248 }
aoqi@0 249 #endif
aoqi@0 250
aoqi@0 251 }
aoqi@0 252 #endif // PRODUCT
aoqi@0 253
aoqi@0 254
aoqi@0 255 bool LIR_OprDesc::is_oop() const {
aoqi@0 256 if (is_pointer()) {
aoqi@0 257 return pointer()->is_oop_pointer();
aoqi@0 258 } else {
aoqi@0 259 OprType t= type_field();
aoqi@0 260 assert(t != unknown_type, "not set");
aoqi@0 261 return t == object_type;
aoqi@0 262 }
aoqi@0 263 }
aoqi@0 264
aoqi@0 265
aoqi@0 266
aoqi@0 267 void LIR_Op2::verify() const {
aoqi@0 268 #ifdef ASSERT
aoqi@0 269 switch (code()) {
aoqi@0 270 case lir_cmove:
aoqi@0 271 case lir_xchg:
aoqi@0 272 break;
aoqi@0 273
aoqi@0 274 default:
aoqi@0 275 assert(!result_opr()->is_register() || !result_opr()->is_oop_register(),
aoqi@0 276 "can't produce oops from arith");
aoqi@0 277 }
aoqi@0 278
aoqi@0 279 if (TwoOperandLIRForm) {
aoqi@0 280 switch (code()) {
aoqi@0 281 case lir_add:
aoqi@0 282 case lir_sub:
aoqi@0 283 case lir_mul:
aoqi@0 284 case lir_mul_strictfp:
aoqi@0 285 case lir_div:
aoqi@0 286 case lir_div_strictfp:
aoqi@0 287 case lir_rem:
aoqi@0 288 case lir_logic_and:
aoqi@0 289 case lir_logic_or:
aoqi@0 290 case lir_logic_xor:
aoqi@0 291 case lir_shl:
aoqi@0 292 case lir_shr:
aoqi@0 293 assert(in_opr1() == result_opr(), "opr1 and result must match");
aoqi@0 294 assert(in_opr1()->is_valid() && in_opr2()->is_valid(), "must be valid");
aoqi@0 295 break;
aoqi@0 296
aoqi@0 297 // special handling for lir_ushr because of write barriers
aoqi@0 298 case lir_ushr:
aoqi@0 299 assert(in_opr1() == result_opr() || in_opr2()->is_constant(), "opr1 and result must match or shift count is constant");
aoqi@0 300 assert(in_opr1()->is_valid() && in_opr2()->is_valid(), "must be valid");
aoqi@0 301 break;
aoqi@0 302
aoqi@0 303 }
aoqi@0 304 }
aoqi@0 305 #endif
aoqi@0 306 }
aoqi@0 307
aoqi@0 308
fujie@9138 309 #ifndef MIPS
aoqi@0 310 LIR_OpBranch::LIR_OpBranch(LIR_Condition cond, BasicType type, BlockBegin* block)
aoqi@0 311 : LIR_Op(lir_branch, LIR_OprFact::illegalOpr, (CodeEmitInfo*)NULL)
aoqi@0 312 , _cond(cond)
aoqi@0 313 , _type(type)
aoqi@0 314 , _label(block->label())
aoqi@0 315 , _block(block)
aoqi@0 316 , _ublock(NULL)
aoqi@0 317 , _stub(NULL) {
aoqi@0 318 }
aoqi@0 319
aoqi@0 320 LIR_OpBranch::LIR_OpBranch(LIR_Condition cond, BasicType type, CodeStub* stub) :
aoqi@0 321 LIR_Op(lir_branch, LIR_OprFact::illegalOpr, (CodeEmitInfo*)NULL)
aoqi@0 322 , _cond(cond)
aoqi@0 323 , _type(type)
aoqi@0 324 , _label(stub->entry())
aoqi@0 325 , _block(NULL)
aoqi@0 326 , _ublock(NULL)
aoqi@0 327 , _stub(stub) {
aoqi@0 328 }
aoqi@0 329
aoqi@0 330 LIR_OpBranch::LIR_OpBranch(LIR_Condition cond, BasicType type, BlockBegin* block, BlockBegin* ublock)
aoqi@0 331 : LIR_Op(lir_cond_float_branch, LIR_OprFact::illegalOpr, (CodeEmitInfo*)NULL)
aoqi@0 332 , _cond(cond)
aoqi@0 333 , _type(type)
aoqi@0 334 , _label(block->label())
aoqi@0 335 , _block(block)
aoqi@0 336 , _ublock(ublock)
aoqi@0 337 , _stub(NULL)
aoqi@0 338 {
aoqi@0 339 }
aoqi@0 340
aoqi@1 341 #else
aoqi@1 342 LIR_OpBranch::LIR_OpBranch(LIR_Condition cond, LIR_Opr left, LIR_Opr right, BasicType type,
aoqi@1 343 BlockBegin* block):
aoqi@1 344 LIR_Op2(lir_branch, left, right, LIR_OprFact::illegalOpr, (CodeEmitInfo *)(NULL)),
aoqi@1 345 _cond(cond),
aoqi@1 346 _type(type),
aoqi@1 347 _label(block->label()),
aoqi@1 348 _block(block),
aoqi@1 349 _ublock(NULL),
aoqi@1 350 _stub(NULL) {
aoqi@1 351 }
aoqi@1 352
aoqi@1 353 LIR_OpBranch::LIR_OpBranch(LIR_Condition cond, LIR_Opr left, LIR_Opr right, BasicType type,
aoqi@1 354 CodeStub* stub):
aoqi@1 355 LIR_Op2(lir_branch, left, right, LIR_OprFact::illegalOpr, (CodeEmitInfo *)(NULL)),
aoqi@1 356 _cond(cond),
aoqi@1 357 _type(type),
aoqi@1 358 _label(stub->entry()),
aoqi@1 359 _block(NULL),
aoqi@1 360 _ublock(NULL),
aoqi@1 361 _stub(stub) {
aoqi@1 362 }
aoqi@1 363
aoqi@1 364
aoqi@1 365 LIR_OpBranch::LIR_OpBranch(LIR_Condition cond, LIR_Opr left, LIR_Opr right, BasicType type,
aoqi@1 366 BlockBegin *block, BlockBegin *ublock):
aoqi@1 367 LIR_Op2(lir_branch, left, right, LIR_OprFact::illegalOpr, (CodeEmitInfo *)(NULL)),
aoqi@1 368 _cond(cond),
aoqi@1 369 _type(type),
aoqi@1 370 _label(block->label()),
aoqi@1 371 _block(block),
aoqi@1 372 _ublock(ublock),
aoqi@1 373 _stub(NULL) {
aoqi@1 374 }
aoqi@1 375
aoqi@8865 376 #endif
aoqi@0 377 void LIR_OpBranch::change_block(BlockBegin* b) {
aoqi@0 378 assert(_block != NULL, "must have old block");
aoqi@0 379 assert(_block->label() == label(), "must be equal");
aoqi@0 380
aoqi@0 381 _block = b;
aoqi@0 382 _label = b->label();
aoqi@0 383 }
aoqi@0 384
aoqi@0 385 void LIR_OpBranch::change_ublock(BlockBegin* b) {
aoqi@0 386 assert(_ublock != NULL, "must have old block");
aoqi@0 387 _ublock = b;
aoqi@0 388 }
aoqi@0 389
aoqi@0 390 void LIR_OpBranch::negate_cond() {
aoqi@0 391 switch (_cond) {
aoqi@0 392 case lir_cond_equal: _cond = lir_cond_notEqual; break;
aoqi@0 393 case lir_cond_notEqual: _cond = lir_cond_equal; break;
aoqi@0 394 case lir_cond_less: _cond = lir_cond_greaterEqual; break;
aoqi@0 395 case lir_cond_lessEqual: _cond = lir_cond_greater; break;
aoqi@0 396 case lir_cond_greaterEqual: _cond = lir_cond_less; break;
aoqi@0 397 case lir_cond_greater: _cond = lir_cond_lessEqual; break;
aoqi@0 398 default: ShouldNotReachHere();
aoqi@0 399 }
aoqi@0 400 }
aoqi@0 401
aoqi@0 402
aoqi@0 403 LIR_OpTypeCheck::LIR_OpTypeCheck(LIR_Code code, LIR_Opr result, LIR_Opr object, ciKlass* klass,
aoqi@0 404 LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3,
aoqi@0 405 bool fast_check, CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch,
aoqi@0 406 CodeStub* stub)
aoqi@0 407
aoqi@0 408 : LIR_Op(code, result, NULL)
aoqi@0 409 , _object(object)
aoqi@0 410 , _array(LIR_OprFact::illegalOpr)
aoqi@0 411 , _klass(klass)
aoqi@0 412 , _tmp1(tmp1)
aoqi@0 413 , _tmp2(tmp2)
aoqi@0 414 , _tmp3(tmp3)
aoqi@0 415 , _fast_check(fast_check)
aoqi@0 416 , _stub(stub)
aoqi@0 417 , _info_for_patch(info_for_patch)
aoqi@0 418 , _info_for_exception(info_for_exception)
aoqi@0 419 , _profiled_method(NULL)
aoqi@0 420 , _profiled_bci(-1)
aoqi@0 421 , _should_profile(false)
aoqi@0 422 {
aoqi@0 423 if (code == lir_checkcast) {
aoqi@0 424 assert(info_for_exception != NULL, "checkcast throws exceptions");
aoqi@0 425 } else if (code == lir_instanceof) {
aoqi@0 426 assert(info_for_exception == NULL, "instanceof throws no exceptions");
aoqi@0 427 } else {
aoqi@0 428 ShouldNotReachHere();
aoqi@0 429 }
aoqi@0 430 }
aoqi@0 431
aoqi@0 432
aoqi@0 433
aoqi@0 434 LIR_OpTypeCheck::LIR_OpTypeCheck(LIR_Code code, LIR_Opr object, LIR_Opr array, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception)
aoqi@0 435 : LIR_Op(code, LIR_OprFact::illegalOpr, NULL)
aoqi@0 436 , _object(object)
aoqi@0 437 , _array(array)
aoqi@0 438 , _klass(NULL)
aoqi@0 439 , _tmp1(tmp1)
aoqi@0 440 , _tmp2(tmp2)
aoqi@0 441 , _tmp3(tmp3)
aoqi@0 442 , _fast_check(false)
aoqi@0 443 , _stub(NULL)
aoqi@0 444 , _info_for_patch(NULL)
aoqi@0 445 , _info_for_exception(info_for_exception)
aoqi@0 446 , _profiled_method(NULL)
aoqi@0 447 , _profiled_bci(-1)
aoqi@0 448 , _should_profile(false)
aoqi@0 449 {
aoqi@0 450 if (code == lir_store_check) {
aoqi@0 451 _stub = new ArrayStoreExceptionStub(object, info_for_exception);
aoqi@0 452 assert(info_for_exception != NULL, "store_check throws exceptions");
aoqi@0 453 } else {
aoqi@0 454 ShouldNotReachHere();
aoqi@0 455 }
aoqi@0 456 }
aoqi@0 457
aoqi@0 458
aoqi@0 459 LIR_OpArrayCopy::LIR_OpArrayCopy(LIR_Opr src, LIR_Opr src_pos, LIR_Opr dst, LIR_Opr dst_pos, LIR_Opr length,
aoqi@0 460 LIR_Opr tmp, ciArrayKlass* expected_type, int flags, CodeEmitInfo* info)
aoqi@0 461 : LIR_Op(lir_arraycopy, LIR_OprFact::illegalOpr, info)
aoqi@0 462 , _tmp(tmp)
aoqi@0 463 , _src(src)
aoqi@0 464 , _src_pos(src_pos)
aoqi@0 465 , _dst(dst)
aoqi@0 466 , _dst_pos(dst_pos)
aoqi@0 467 , _flags(flags)
aoqi@0 468 , _expected_type(expected_type)
aoqi@0 469 , _length(length) {
aoqi@0 470 _stub = new ArrayCopyStub(this);
aoqi@0 471 }
aoqi@0 472
aoqi@0 473 LIR_OpUpdateCRC32::LIR_OpUpdateCRC32(LIR_Opr crc, LIR_Opr val, LIR_Opr res)
aoqi@0 474 : LIR_Op(lir_updatecrc32, res, NULL)
aoqi@0 475 , _crc(crc)
aoqi@0 476 , _val(val) {
aoqi@0 477 }
aoqi@0 478
aoqi@0 479 //-------------------verify--------------------------
aoqi@0 480
aoqi@0 481 void LIR_Op1::verify() const {
aoqi@0 482 switch(code()) {
aoqi@0 483 case lir_move:
aoqi@0 484 assert(in_opr()->is_valid() && result_opr()->is_valid(), "must be");
aoqi@0 485 break;
aoqi@0 486 case lir_null_check:
aoqi@0 487 assert(in_opr()->is_register(), "must be");
aoqi@0 488 break;
aoqi@0 489 case lir_return:
aoqi@0 490 assert(in_opr()->is_register() || in_opr()->is_illegal(), "must be");
aoqi@0 491 break;
aoqi@0 492 }
aoqi@0 493 }
aoqi@0 494
aoqi@0 495 void LIR_OpRTCall::verify() const {
aoqi@0 496 assert(strcmp(Runtime1::name_for_address(addr()), "<unknown function>") != 0, "unknown function");
aoqi@0 497 }
aoqi@0 498
aoqi@0 499 //-------------------visits--------------------------
aoqi@0 500
aoqi@0 501 // complete rework of LIR instruction visitor.
zmajo@7854 502 // The virtual call for each instruction type is replaced by a big
aoqi@0 503 // switch that adds the operands for each instruction
aoqi@0 504
aoqi@0 505 void LIR_OpVisitState::visit(LIR_Op* op) {
aoqi@0 506 // copy information from the LIR_Op
aoqi@0 507 reset();
aoqi@0 508 set_op(op);
aoqi@0 509
aoqi@0 510 switch (op->code()) {
aoqi@0 511
aoqi@0 512 // LIR_Op0
aoqi@0 513 case lir_word_align: // result and info always invalid
aoqi@0 514 case lir_backwardbranch_target: // result and info always invalid
aoqi@0 515 case lir_build_frame: // result and info always invalid
aoqi@0 516 case lir_fpop_raw: // result and info always invalid
aoqi@0 517 case lir_24bit_FPU: // result and info always invalid
aoqi@0 518 case lir_reset_FPU: // result and info always invalid
aoqi@0 519 case lir_breakpoint: // result and info always invalid
aoqi@0 520 case lir_membar: // result and info always invalid
aoqi@0 521 case lir_membar_acquire: // result and info always invalid
aoqi@0 522 case lir_membar_release: // result and info always invalid
aoqi@0 523 case lir_membar_loadload: // result and info always invalid
aoqi@0 524 case lir_membar_storestore: // result and info always invalid
aoqi@0 525 case lir_membar_loadstore: // result and info always invalid
aoqi@0 526 case lir_membar_storeload: // result and info always invalid
aoqi@0 527 {
aoqi@0 528 assert(op->as_Op0() != NULL, "must be");
aoqi@0 529 assert(op->_info == NULL, "info not used by this instruction");
aoqi@0 530 assert(op->_result->is_illegal(), "not used");
aoqi@0 531 break;
aoqi@0 532 }
aoqi@0 533
aoqi@0 534 case lir_nop: // may have info, result always invalid
aoqi@0 535 case lir_std_entry: // may have result, info always invalid
aoqi@0 536 case lir_osr_entry: // may have result, info always invalid
aoqi@0 537 case lir_get_thread: // may have result, info always invalid
aoqi@0 538 {
aoqi@0 539 assert(op->as_Op0() != NULL, "must be");
aoqi@0 540 if (op->_info != NULL) do_info(op->_info);
aoqi@0 541 if (op->_result->is_valid()) do_output(op->_result);
aoqi@0 542 break;
aoqi@0 543 }
aoqi@0 544
aoqi@0 545
aoqi@0 546 // LIR_OpLabel
aoqi@0 547 case lir_label: // result and info always invalid
aoqi@0 548 {
aoqi@0 549 assert(op->as_OpLabel() != NULL, "must be");
aoqi@0 550 assert(op->_info == NULL, "info not used by this instruction");
aoqi@0 551 assert(op->_result->is_illegal(), "not used");
aoqi@0 552 break;
aoqi@0 553 }
aoqi@0 554
aoqi@0 555
aoqi@0 556 // LIR_Op1
aoqi@0 557 case lir_fxch: // input always valid, result and info always invalid
aoqi@0 558 case lir_fld: // input always valid, result and info always invalid
aoqi@0 559 case lir_ffree: // input always valid, result and info always invalid
aoqi@0 560 case lir_push: // input always valid, result and info always invalid
aoqi@0 561 case lir_pop: // input always valid, result and info always invalid
aoqi@0 562 case lir_return: // input always valid, result and info always invalid
aoqi@0 563 case lir_leal: // input and result always valid, info always invalid
aoqi@0 564 case lir_neg: // input and result always valid, info always invalid
aoqi@0 565 case lir_monaddr: // input and result always valid, info always invalid
aoqi@0 566 case lir_null_check: // input and info always valid, result always invalid
aoqi@0 567 case lir_move: // input and result always valid, may have info
aoqi@0 568 case lir_pack64: // input and result always valid
aoqi@0 569 case lir_unpack64: // input and result always valid
aoqi@0 570 case lir_prefetchr: // input always valid, result and info always invalid
aoqi@0 571 case lir_prefetchw: // input always valid, result and info always invalid
aoqi@0 572 {
aoqi@0 573 assert(op->as_Op1() != NULL, "must be");
aoqi@0 574 LIR_Op1* op1 = (LIR_Op1*)op;
aoqi@0 575
aoqi@0 576 if (op1->_info) do_info(op1->_info);
aoqi@0 577 if (op1->_opr->is_valid()) do_input(op1->_opr);
aoqi@0 578 if (op1->_result->is_valid()) do_output(op1->_result);
aoqi@0 579
aoqi@0 580 break;
aoqi@0 581 }
aoqi@0 582
aoqi@0 583 case lir_safepoint:
aoqi@0 584 {
aoqi@0 585 assert(op->as_Op1() != NULL, "must be");
aoqi@0 586 LIR_Op1* op1 = (LIR_Op1*)op;
aoqi@0 587
aoqi@0 588 assert(op1->_info != NULL, ""); do_info(op1->_info);
aoqi@0 589 if (op1->_opr->is_valid()) do_temp(op1->_opr); // safepoints on SPARC need temporary register
aoqi@0 590 assert(op1->_result->is_illegal(), "safepoint does not produce value");
aoqi@0 591
aoqi@0 592 break;
aoqi@0 593 }
aoqi@0 594
aoqi@0 595 // LIR_OpConvert;
aoqi@0 596 case lir_convert: // input and result always valid, info always invalid
aoqi@0 597 {
aoqi@0 598 assert(op->as_OpConvert() != NULL, "must be");
aoqi@0 599 LIR_OpConvert* opConvert = (LIR_OpConvert*)op;
aoqi@0 600
aoqi@0 601 assert(opConvert->_info == NULL, "must be");
aoqi@0 602 if (opConvert->_opr->is_valid()) do_input(opConvert->_opr);
aoqi@0 603 if (opConvert->_result->is_valid()) do_output(opConvert->_result);
aoqi@0 604 #ifdef PPC
aoqi@0 605 if (opConvert->_tmp1->is_valid()) do_temp(opConvert->_tmp1);
aoqi@0 606 if (opConvert->_tmp2->is_valid()) do_temp(opConvert->_tmp2);
aoqi@0 607 #endif
aoqi@0 608 do_stub(opConvert->_stub);
aoqi@0 609
aoqi@0 610 break;
aoqi@0 611 }
aoqi@0 612
aoqi@0 613 // LIR_OpBranch;
aoqi@0 614 case lir_branch: // may have info, input and result register always invalid
aoqi@0 615 case lir_cond_float_branch: // may have info, input and result register always invalid
aoqi@0 616 {
aoqi@0 617 assert(op->as_OpBranch() != NULL, "must be");
aoqi@0 618 LIR_OpBranch* opBranch = (LIR_OpBranch*)op;
aoqi@0 619
fujie@9138 620 #ifdef MIPS
aoqi@1 621 if (opBranch->_opr1->is_valid()) do_input(opBranch->_opr1);
aoqi@1 622 if (opBranch->_opr2->is_valid()) do_input(opBranch->_opr2);
aoqi@1 623 if (opBranch->_tmp1->is_valid()) do_temp(opBranch->_tmp1);
aoqi@1 624 if (opBranch->_tmp2->is_valid()) do_temp(opBranch->_tmp2);
aoqi@1 625 if (opBranch->_tmp3->is_valid()) do_temp(opBranch->_tmp3);
aoqi@1 626 if (opBranch->_tmp4->is_valid()) do_temp(opBranch->_tmp4);
aoqi@1 627 if (opBranch->_tmp5->is_valid()) do_temp(opBranch->_tmp5);
aoqi@1 628 #endif
aoqi@0 629 if (opBranch->_info != NULL) do_info(opBranch->_info);
aoqi@0 630 assert(opBranch->_result->is_illegal(), "not used");
aoqi@0 631 if (opBranch->_stub != NULL) opBranch->stub()->visit(this);
aoqi@0 632
aoqi@0 633 break;
aoqi@0 634 }
aoqi@0 635
aoqi@0 636
aoqi@0 637 // LIR_OpAllocObj
aoqi@0 638 case lir_alloc_object:
aoqi@0 639 {
aoqi@0 640 assert(op->as_OpAllocObj() != NULL, "must be");
aoqi@0 641 LIR_OpAllocObj* opAllocObj = (LIR_OpAllocObj*)op;
aoqi@0 642
aoqi@0 643 if (opAllocObj->_info) do_info(opAllocObj->_info);
aoqi@0 644 if (opAllocObj->_opr->is_valid()) { do_input(opAllocObj->_opr);
aoqi@0 645 do_temp(opAllocObj->_opr);
aoqi@0 646 }
aoqi@0 647 if (opAllocObj->_tmp1->is_valid()) do_temp(opAllocObj->_tmp1);
aoqi@0 648 if (opAllocObj->_tmp2->is_valid()) do_temp(opAllocObj->_tmp2);
aoqi@0 649 if (opAllocObj->_tmp3->is_valid()) do_temp(opAllocObj->_tmp3);
aoqi@0 650 if (opAllocObj->_tmp4->is_valid()) do_temp(opAllocObj->_tmp4);
fujie@9138 651 #ifdef MIPS
aoqi@1 652 if (opAllocObj->_tmp5->is_valid()) do_temp(opAllocObj->_tmp5);
aoqi@1 653 if (opAllocObj->_tmp6->is_valid()) do_temp(opAllocObj->_tmp6);
aoqi@1 654 #endif
aoqi@0 655 if (opAllocObj->_result->is_valid()) do_output(opAllocObj->_result);
aoqi@0 656 do_stub(opAllocObj->_stub);
aoqi@0 657 break;
aoqi@0 658 }
aoqi@0 659
aoqi@0 660
aoqi@0 661 // LIR_OpRoundFP;
aoqi@0 662 case lir_roundfp: {
aoqi@0 663 assert(op->as_OpRoundFP() != NULL, "must be");
aoqi@0 664 LIR_OpRoundFP* opRoundFP = (LIR_OpRoundFP*)op;
aoqi@0 665
aoqi@0 666 assert(op->_info == NULL, "info not used by this instruction");
aoqi@0 667 assert(opRoundFP->_tmp->is_illegal(), "not used");
aoqi@0 668 do_input(opRoundFP->_opr);
aoqi@0 669 do_output(opRoundFP->_result);
aoqi@0 670
aoqi@0 671 break;
aoqi@0 672 }
aoqi@0 673
aoqi@0 674
aoqi@0 675 // LIR_Op2
fujie@9138 676 #ifdef MIPS
aoqi@1 677 case lir_null_check_for_branch:
aoqi@1 678 #else
aoqi@0 679 case lir_cmp:
aoqi@1 680 #endif
aoqi@0 681 case lir_cmp_l2i:
aoqi@0 682 case lir_ucmp_fd2i:
aoqi@0 683 case lir_cmp_fd2i:
aoqi@0 684 case lir_add:
aoqi@0 685 case lir_sub:
aoqi@0 686 case lir_mul:
aoqi@0 687 case lir_div:
aoqi@0 688 case lir_rem:
aoqi@0 689 case lir_sqrt:
aoqi@0 690 case lir_abs:
aoqi@0 691 case lir_logic_and:
aoqi@0 692 case lir_logic_or:
aoqi@0 693 case lir_logic_xor:
aoqi@0 694 case lir_shl:
aoqi@0 695 case lir_shr:
aoqi@0 696 case lir_ushr:
aoqi@0 697 case lir_xadd:
aoqi@0 698 case lir_xchg:
aoqi@0 699 case lir_assert:
aoqi@0 700 {
aoqi@0 701 assert(op->as_Op2() != NULL, "must be");
aoqi@0 702 LIR_Op2* op2 = (LIR_Op2*)op;
aoqi@0 703 assert(op2->_tmp2->is_illegal() && op2->_tmp3->is_illegal() &&
aoqi@0 704 op2->_tmp4->is_illegal() && op2->_tmp5->is_illegal(), "not used");
aoqi@0 705
aoqi@0 706 if (op2->_info) do_info(op2->_info);
aoqi@0 707 if (op2->_opr1->is_valid()) do_input(op2->_opr1);
aoqi@0 708 if (op2->_opr2->is_valid()) do_input(op2->_opr2);
aoqi@0 709 if (op2->_tmp1->is_valid()) do_temp(op2->_tmp1);
aoqi@0 710 if (op2->_result->is_valid()) do_output(op2->_result);
aoqi@0 711 if (op->code() == lir_xchg || op->code() == lir_xadd) {
aoqi@0 712 // on ARM and PPC, return value is loaded first so could
aoqi@0 713 // destroy inputs. On other platforms that implement those
aoqi@0 714 // (x86, sparc), the extra constrainsts are harmless.
aoqi@0 715 if (op2->_opr1->is_valid()) do_temp(op2->_opr1);
aoqi@0 716 if (op2->_opr2->is_valid()) do_temp(op2->_opr2);
aoqi@0 717 }
aoqi@0 718
aoqi@0 719 break;
aoqi@0 720 }
aoqi@0 721
aoqi@0 722 // special handling for cmove: right input operand must not be equal
aoqi@0 723 // to the result operand, otherwise the backend fails
aoqi@0 724 case lir_cmove:
aoqi@0 725 {
aoqi@0 726 assert(op->as_Op2() != NULL, "must be");
aoqi@0 727 LIR_Op2* op2 = (LIR_Op2*)op;
aoqi@0 728
aoqi@0 729 assert(op2->_info == NULL && op2->_tmp1->is_illegal() && op2->_tmp2->is_illegal() &&
aoqi@0 730 op2->_tmp3->is_illegal() && op2->_tmp4->is_illegal() && op2->_tmp5->is_illegal(), "not used");
aoqi@0 731 assert(op2->_opr1->is_valid() && op2->_opr2->is_valid() && op2->_result->is_valid(), "used");
aoqi@0 732
aoqi@0 733 do_input(op2->_opr1);
aoqi@0 734 do_input(op2->_opr2);
aoqi@0 735 do_temp(op2->_opr2);
aoqi@0 736 do_output(op2->_result);
aoqi@0 737
aoqi@0 738 break;
aoqi@0 739 }
aoqi@0 740
aoqi@0 741 // vspecial handling for strict operations: register input operands
aoqi@0 742 // as temp to guarantee that they do not overlap with other
aoqi@0 743 // registers
aoqi@0 744 case lir_mul_strictfp:
aoqi@0 745 case lir_div_strictfp:
aoqi@0 746 {
aoqi@0 747 assert(op->as_Op2() != NULL, "must be");
aoqi@0 748 LIR_Op2* op2 = (LIR_Op2*)op;
aoqi@0 749
aoqi@0 750 assert(op2->_info == NULL, "not used");
aoqi@0 751 assert(op2->_opr1->is_valid(), "used");
aoqi@0 752 assert(op2->_opr2->is_valid(), "used");
aoqi@0 753 assert(op2->_result->is_valid(), "used");
aoqi@0 754 assert(op2->_tmp2->is_illegal() && op2->_tmp3->is_illegal() &&
aoqi@0 755 op2->_tmp4->is_illegal() && op2->_tmp5->is_illegal(), "not used");
aoqi@0 756
aoqi@0 757 do_input(op2->_opr1); do_temp(op2->_opr1);
aoqi@0 758 do_input(op2->_opr2); do_temp(op2->_opr2);
aoqi@0 759 if (op2->_tmp1->is_valid()) do_temp(op2->_tmp1);
aoqi@0 760 do_output(op2->_result);
aoqi@0 761
aoqi@0 762 break;
aoqi@0 763 }
aoqi@0 764
aoqi@0 765 case lir_throw: {
aoqi@0 766 assert(op->as_Op2() != NULL, "must be");
aoqi@0 767 LIR_Op2* op2 = (LIR_Op2*)op;
aoqi@0 768
aoqi@0 769 if (op2->_info) do_info(op2->_info);
aoqi@0 770 if (op2->_opr1->is_valid()) do_temp(op2->_opr1);
aoqi@0 771 if (op2->_opr2->is_valid()) do_input(op2->_opr2); // exception object is input parameter
aoqi@0 772 assert(op2->_result->is_illegal(), "no result");
aoqi@0 773 assert(op2->_tmp2->is_illegal() && op2->_tmp3->is_illegal() &&
aoqi@0 774 op2->_tmp4->is_illegal() && op2->_tmp5->is_illegal(), "not used");
aoqi@0 775
aoqi@0 776 break;
aoqi@0 777 }
aoqi@0 778
aoqi@0 779 case lir_unwind: {
aoqi@0 780 assert(op->as_Op1() != NULL, "must be");
aoqi@0 781 LIR_Op1* op1 = (LIR_Op1*)op;
aoqi@0 782
aoqi@0 783 assert(op1->_info == NULL, "no info");
aoqi@0 784 assert(op1->_opr->is_valid(), "exception oop"); do_input(op1->_opr);
aoqi@0 785 assert(op1->_result->is_illegal(), "no result");
aoqi@0 786
aoqi@0 787 break;
aoqi@0 788 }
aoqi@0 789
aoqi@0 790
aoqi@0 791 case lir_tan:
aoqi@0 792 case lir_sin:
aoqi@0 793 case lir_cos:
aoqi@0 794 case lir_log:
aoqi@0 795 case lir_log10:
aoqi@0 796 case lir_exp: {
aoqi@0 797 assert(op->as_Op2() != NULL, "must be");
aoqi@0 798 LIR_Op2* op2 = (LIR_Op2*)op;
aoqi@0 799
aoqi@0 800 // On x86 tan/sin/cos need two temporary fpu stack slots and
aoqi@0 801 // log/log10 need one so handle opr2 and tmp as temp inputs.
aoqi@0 802 // Register input operand as temp to guarantee that it doesn't
aoqi@0 803 // overlap with the input.
aoqi@0 804 assert(op2->_info == NULL, "not used");
aoqi@0 805 assert(op2->_tmp5->is_illegal(), "not used");
aoqi@0 806 assert(op2->_tmp2->is_valid() == (op->code() == lir_exp), "not used");
aoqi@0 807 assert(op2->_tmp3->is_valid() == (op->code() == lir_exp), "not used");
aoqi@0 808 assert(op2->_tmp4->is_valid() == (op->code() == lir_exp), "not used");
aoqi@0 809 assert(op2->_opr1->is_valid(), "used");
aoqi@0 810 do_input(op2->_opr1); do_temp(op2->_opr1);
aoqi@0 811
aoqi@0 812 if (op2->_opr2->is_valid()) do_temp(op2->_opr2);
aoqi@0 813 if (op2->_tmp1->is_valid()) do_temp(op2->_tmp1);
aoqi@0 814 if (op2->_tmp2->is_valid()) do_temp(op2->_tmp2);
aoqi@0 815 if (op2->_tmp3->is_valid()) do_temp(op2->_tmp3);
aoqi@0 816 if (op2->_tmp4->is_valid()) do_temp(op2->_tmp4);
aoqi@0 817 if (op2->_result->is_valid()) do_output(op2->_result);
aoqi@0 818
aoqi@0 819 break;
aoqi@0 820 }
aoqi@0 821
aoqi@0 822 case lir_pow: {
aoqi@0 823 assert(op->as_Op2() != NULL, "must be");
aoqi@0 824 LIR_Op2* op2 = (LIR_Op2*)op;
aoqi@0 825
aoqi@0 826 // On x86 pow needs two temporary fpu stack slots: tmp1 and
aoqi@0 827 // tmp2. Register input operands as temps to guarantee that it
aoqi@0 828 // doesn't overlap with the temporary slots.
aoqi@0 829 assert(op2->_info == NULL, "not used");
aoqi@0 830 assert(op2->_opr1->is_valid() && op2->_opr2->is_valid(), "used");
aoqi@0 831 assert(op2->_tmp1->is_valid() && op2->_tmp2->is_valid() && op2->_tmp3->is_valid()
aoqi@0 832 && op2->_tmp4->is_valid() && op2->_tmp5->is_valid(), "used");
aoqi@0 833 assert(op2->_result->is_valid(), "used");
aoqi@0 834
aoqi@0 835 do_input(op2->_opr1); do_temp(op2->_opr1);
aoqi@0 836 do_input(op2->_opr2); do_temp(op2->_opr2);
aoqi@0 837 do_temp(op2->_tmp1);
aoqi@0 838 do_temp(op2->_tmp2);
aoqi@0 839 do_temp(op2->_tmp3);
aoqi@0 840 do_temp(op2->_tmp4);
aoqi@0 841 do_temp(op2->_tmp5);
aoqi@0 842 do_output(op2->_result);
aoqi@0 843
aoqi@0 844 break;
aoqi@0 845 }
aoqi@0 846
aoqi@0 847 // LIR_Op3
fujie@9138 848 #ifdef MIPS
aoqi@1 849 case lir_frem:
aoqi@1 850 #endif
aoqi@0 851 case lir_idiv:
aoqi@0 852 case lir_irem: {
aoqi@0 853 assert(op->as_Op3() != NULL, "must be");
aoqi@0 854 LIR_Op3* op3= (LIR_Op3*)op;
aoqi@0 855
aoqi@0 856 if (op3->_info) do_info(op3->_info);
aoqi@0 857 if (op3->_opr1->is_valid()) do_input(op3->_opr1);
aoqi@0 858
aoqi@0 859 // second operand is input and temp, so ensure that second operand
aoqi@0 860 // and third operand get not the same register
aoqi@0 861 if (op3->_opr2->is_valid()) do_input(op3->_opr2);
aoqi@0 862 if (op3->_opr2->is_valid()) do_temp(op3->_opr2);
aoqi@0 863 if (op3->_opr3->is_valid()) do_temp(op3->_opr3);
aoqi@0 864
aoqi@0 865 if (op3->_result->is_valid()) do_output(op3->_result);
aoqi@0 866
aoqi@0 867 break;
aoqi@0 868 }
aoqi@0 869
aoqi@0 870
aoqi@0 871 // LIR_OpJavaCall
aoqi@0 872 case lir_static_call:
aoqi@0 873 case lir_optvirtual_call:
aoqi@0 874 case lir_icvirtual_call:
aoqi@0 875 case lir_virtual_call:
aoqi@0 876 case lir_dynamic_call: {
aoqi@0 877 LIR_OpJavaCall* opJavaCall = op->as_OpJavaCall();
aoqi@0 878 assert(opJavaCall != NULL, "must be");
aoqi@0 879
aoqi@0 880 if (opJavaCall->_receiver->is_valid()) do_input(opJavaCall->_receiver);
aoqi@0 881
aoqi@0 882 // only visit register parameters
aoqi@0 883 int n = opJavaCall->_arguments->length();
aoqi@0 884 for (int i = opJavaCall->_receiver->is_valid() ? 1 : 0; i < n; i++) {
aoqi@0 885 if (!opJavaCall->_arguments->at(i)->is_pointer()) {
aoqi@0 886 do_input(*opJavaCall->_arguments->adr_at(i));
aoqi@0 887 }
aoqi@0 888 }
aoqi@0 889
aoqi@0 890 if (opJavaCall->_info) do_info(opJavaCall->_info);
zmajo@7854 891 if (FrameMap::method_handle_invoke_SP_save_opr() != LIR_OprFact::illegalOpr &&
zmajo@7854 892 opJavaCall->is_method_handle_invoke()) {
aoqi@0 893 opJavaCall->_method_handle_invoke_SP_save_opr = FrameMap::method_handle_invoke_SP_save_opr();
aoqi@0 894 do_temp(opJavaCall->_method_handle_invoke_SP_save_opr);
aoqi@0 895 }
aoqi@0 896 do_call();
aoqi@0 897 if (opJavaCall->_result->is_valid()) do_output(opJavaCall->_result);
aoqi@0 898
aoqi@0 899 break;
aoqi@0 900 }
aoqi@0 901
aoqi@0 902
aoqi@0 903 // LIR_OpRTCall
aoqi@0 904 case lir_rtcall: {
aoqi@0 905 assert(op->as_OpRTCall() != NULL, "must be");
aoqi@0 906 LIR_OpRTCall* opRTCall = (LIR_OpRTCall*)op;
aoqi@0 907
aoqi@0 908 // only visit register parameters
aoqi@0 909 int n = opRTCall->_arguments->length();
aoqi@0 910 for (int i = 0; i < n; i++) {
aoqi@0 911 if (!opRTCall->_arguments->at(i)->is_pointer()) {
aoqi@0 912 do_input(*opRTCall->_arguments->adr_at(i));
aoqi@0 913 }
aoqi@0 914 }
aoqi@0 915 if (opRTCall->_info) do_info(opRTCall->_info);
aoqi@0 916 if (opRTCall->_tmp->is_valid()) do_temp(opRTCall->_tmp);
aoqi@0 917 do_call();
aoqi@0 918 if (opRTCall->_result->is_valid()) do_output(opRTCall->_result);
aoqi@0 919
aoqi@0 920 break;
aoqi@0 921 }
aoqi@0 922
aoqi@0 923
aoqi@0 924 // LIR_OpArrayCopy
aoqi@0 925 case lir_arraycopy: {
aoqi@0 926 assert(op->as_OpArrayCopy() != NULL, "must be");
aoqi@0 927 LIR_OpArrayCopy* opArrayCopy = (LIR_OpArrayCopy*)op;
aoqi@0 928
aoqi@0 929 assert(opArrayCopy->_result->is_illegal(), "unused");
aoqi@0 930 assert(opArrayCopy->_src->is_valid(), "used"); do_input(opArrayCopy->_src); do_temp(opArrayCopy->_src);
aoqi@0 931 assert(opArrayCopy->_src_pos->is_valid(), "used"); do_input(opArrayCopy->_src_pos); do_temp(opArrayCopy->_src_pos);
aoqi@0 932 assert(opArrayCopy->_dst->is_valid(), "used"); do_input(opArrayCopy->_dst); do_temp(opArrayCopy->_dst);
aoqi@0 933 assert(opArrayCopy->_dst_pos->is_valid(), "used"); do_input(opArrayCopy->_dst_pos); do_temp(opArrayCopy->_dst_pos);
aoqi@0 934 assert(opArrayCopy->_length->is_valid(), "used"); do_input(opArrayCopy->_length); do_temp(opArrayCopy->_length);
fujie@9138 935 #ifndef MIPS
aoqi@0 936 assert(opArrayCopy->_tmp->is_valid(), "used"); do_temp(opArrayCopy->_tmp);
aoqi@1 937 #endif
aoqi@0 938 if (opArrayCopy->_info) do_info(opArrayCopy->_info);
aoqi@0 939
aoqi@0 940 // the implementation of arraycopy always has a call into the runtime
aoqi@0 941 do_call();
aoqi@0 942
aoqi@0 943 break;
aoqi@0 944 }
aoqi@0 945
aoqi@0 946
aoqi@0 947 // LIR_OpUpdateCRC32
aoqi@0 948 case lir_updatecrc32: {
aoqi@0 949 assert(op->as_OpUpdateCRC32() != NULL, "must be");
aoqi@0 950 LIR_OpUpdateCRC32* opUp = (LIR_OpUpdateCRC32*)op;
aoqi@0 951
aoqi@0 952 assert(opUp->_crc->is_valid(), "used"); do_input(opUp->_crc); do_temp(opUp->_crc);
aoqi@0 953 assert(opUp->_val->is_valid(), "used"); do_input(opUp->_val); do_temp(opUp->_val);
aoqi@0 954 assert(opUp->_result->is_valid(), "used"); do_output(opUp->_result);
aoqi@0 955 assert(opUp->_info == NULL, "no info for LIR_OpUpdateCRC32");
aoqi@0 956
aoqi@0 957 break;
aoqi@0 958 }
aoqi@0 959
aoqi@0 960
aoqi@0 961 // LIR_OpLock
aoqi@0 962 case lir_lock:
aoqi@0 963 case lir_unlock: {
aoqi@0 964 assert(op->as_OpLock() != NULL, "must be");
aoqi@0 965 LIR_OpLock* opLock = (LIR_OpLock*)op;
aoqi@0 966
aoqi@0 967 if (opLock->_info) do_info(opLock->_info);
aoqi@0 968
aoqi@0 969 // TODO: check if these operands really have to be temp
aoqi@0 970 // (or if input is sufficient). This may have influence on the oop map!
aoqi@0 971 assert(opLock->_lock->is_valid(), "used"); do_temp(opLock->_lock);
aoqi@0 972 assert(opLock->_hdr->is_valid(), "used"); do_temp(opLock->_hdr);
aoqi@0 973 assert(opLock->_obj->is_valid(), "used"); do_temp(opLock->_obj);
aoqi@0 974
aoqi@0 975 if (opLock->_scratch->is_valid()) do_temp(opLock->_scratch);
aoqi@0 976 assert(opLock->_result->is_illegal(), "unused");
aoqi@0 977
aoqi@0 978 do_stub(opLock->_stub);
aoqi@0 979
aoqi@0 980 break;
aoqi@0 981 }
aoqi@0 982
aoqi@0 983
aoqi@0 984 // LIR_OpDelay
aoqi@0 985 case lir_delay_slot: {
aoqi@0 986 assert(op->as_OpDelay() != NULL, "must be");
aoqi@0 987 LIR_OpDelay* opDelay = (LIR_OpDelay*)op;
aoqi@0 988
aoqi@0 989 visit(opDelay->delay_op());
aoqi@0 990 break;
aoqi@0 991 }
aoqi@0 992
aoqi@0 993 // LIR_OpTypeCheck
aoqi@0 994 case lir_instanceof:
aoqi@0 995 case lir_checkcast:
aoqi@0 996 case lir_store_check: {
aoqi@0 997 assert(op->as_OpTypeCheck() != NULL, "must be");
aoqi@0 998 LIR_OpTypeCheck* opTypeCheck = (LIR_OpTypeCheck*)op;
aoqi@0 999
aoqi@0 1000 if (opTypeCheck->_info_for_exception) do_info(opTypeCheck->_info_for_exception);
aoqi@0 1001 if (opTypeCheck->_info_for_patch) do_info(opTypeCheck->_info_for_patch);
aoqi@0 1002 if (opTypeCheck->_object->is_valid()) do_input(opTypeCheck->_object);
aoqi@0 1003 if (op->code() == lir_store_check && opTypeCheck->_object->is_valid()) {
aoqi@0 1004 do_temp(opTypeCheck->_object);
aoqi@0 1005 }
aoqi@0 1006 if (opTypeCheck->_array->is_valid()) do_input(opTypeCheck->_array);
aoqi@0 1007 if (opTypeCheck->_tmp1->is_valid()) do_temp(opTypeCheck->_tmp1);
aoqi@0 1008 if (opTypeCheck->_tmp2->is_valid()) do_temp(opTypeCheck->_tmp2);
aoqi@0 1009 if (opTypeCheck->_tmp3->is_valid()) do_temp(opTypeCheck->_tmp3);
aoqi@0 1010 if (opTypeCheck->_result->is_valid()) do_output(opTypeCheck->_result);
aoqi@0 1011 do_stub(opTypeCheck->_stub);
aoqi@0 1012 break;
aoqi@0 1013 }
aoqi@0 1014
aoqi@0 1015 // LIR_OpCompareAndSwap
aoqi@0 1016 case lir_cas_long:
aoqi@0 1017 case lir_cas_obj:
aoqi@0 1018 case lir_cas_int: {
aoqi@0 1019 assert(op->as_OpCompareAndSwap() != NULL, "must be");
aoqi@0 1020 LIR_OpCompareAndSwap* opCompareAndSwap = (LIR_OpCompareAndSwap*)op;
aoqi@0 1021
aoqi@0 1022 assert(opCompareAndSwap->_addr->is_valid(), "used");
aoqi@0 1023 assert(opCompareAndSwap->_cmp_value->is_valid(), "used");
aoqi@0 1024 assert(opCompareAndSwap->_new_value->is_valid(), "used");
aoqi@0 1025 if (opCompareAndSwap->_info) do_info(opCompareAndSwap->_info);
aoqi@0 1026 do_input(opCompareAndSwap->_addr);
aoqi@0 1027 do_temp(opCompareAndSwap->_addr);
aoqi@0 1028 do_input(opCompareAndSwap->_cmp_value);
aoqi@0 1029 do_temp(opCompareAndSwap->_cmp_value);
aoqi@0 1030 do_input(opCompareAndSwap->_new_value);
aoqi@0 1031 do_temp(opCompareAndSwap->_new_value);
aoqi@0 1032 if (opCompareAndSwap->_tmp1->is_valid()) do_temp(opCompareAndSwap->_tmp1);
aoqi@0 1033 if (opCompareAndSwap->_tmp2->is_valid()) do_temp(opCompareAndSwap->_tmp2);
aoqi@0 1034 if (opCompareAndSwap->_result->is_valid()) do_output(opCompareAndSwap->_result);
aoqi@0 1035
aoqi@0 1036 break;
aoqi@0 1037 }
aoqi@0 1038
aoqi@0 1039
aoqi@0 1040 // LIR_OpAllocArray;
aoqi@0 1041 case lir_alloc_array: {
aoqi@0 1042 assert(op->as_OpAllocArray() != NULL, "must be");
aoqi@0 1043 LIR_OpAllocArray* opAllocArray = (LIR_OpAllocArray*)op;
aoqi@0 1044
aoqi@0 1045 if (opAllocArray->_info) do_info(opAllocArray->_info);
aoqi@0 1046 if (opAllocArray->_klass->is_valid()) do_input(opAllocArray->_klass); do_temp(opAllocArray->_klass);
aoqi@0 1047 if (opAllocArray->_len->is_valid()) do_input(opAllocArray->_len); do_temp(opAllocArray->_len);
aoqi@0 1048 if (opAllocArray->_tmp1->is_valid()) do_temp(opAllocArray->_tmp1);
aoqi@0 1049 if (opAllocArray->_tmp2->is_valid()) do_temp(opAllocArray->_tmp2);
aoqi@0 1050 if (opAllocArray->_tmp3->is_valid()) do_temp(opAllocArray->_tmp3);
aoqi@0 1051 if (opAllocArray->_tmp4->is_valid()) do_temp(opAllocArray->_tmp4);
fujie@9138 1052 #ifdef MIPS
aoqi@1 1053 if (opAllocArray->_tmp5->is_valid()) do_temp(opAllocArray->_tmp5);
aoqi@1 1054 #endif
aoqi@0 1055 if (opAllocArray->_result->is_valid()) do_output(opAllocArray->_result);
aoqi@0 1056 do_stub(opAllocArray->_stub);
aoqi@0 1057 break;
aoqi@0 1058 }
aoqi@0 1059
aoqi@0 1060 // LIR_OpProfileCall:
aoqi@0 1061 case lir_profile_call: {
aoqi@0 1062 assert(op->as_OpProfileCall() != NULL, "must be");
aoqi@0 1063 LIR_OpProfileCall* opProfileCall = (LIR_OpProfileCall*)op;
aoqi@0 1064
aoqi@0 1065 if (opProfileCall->_recv->is_valid()) do_temp(opProfileCall->_recv);
aoqi@0 1066 assert(opProfileCall->_mdo->is_valid(), "used"); do_temp(opProfileCall->_mdo);
aoqi@0 1067 assert(opProfileCall->_tmp1->is_valid(), "used"); do_temp(opProfileCall->_tmp1);
aoqi@0 1068 break;
aoqi@0 1069 }
aoqi@0 1070
aoqi@0 1071 // LIR_OpProfileType:
aoqi@0 1072 case lir_profile_type: {
aoqi@0 1073 assert(op->as_OpProfileType() != NULL, "must be");
aoqi@0 1074 LIR_OpProfileType* opProfileType = (LIR_OpProfileType*)op;
aoqi@0 1075
aoqi@0 1076 do_input(opProfileType->_mdp); do_temp(opProfileType->_mdp);
aoqi@0 1077 do_input(opProfileType->_obj);
aoqi@0 1078 do_temp(opProfileType->_tmp);
aoqi@0 1079 break;
aoqi@0 1080 }
aoqi@0 1081 default:
aoqi@0 1082 ShouldNotReachHere();
aoqi@0 1083 }
aoqi@0 1084 }
aoqi@0 1085
aoqi@0 1086
aoqi@0 1087 void LIR_OpVisitState::do_stub(CodeStub* stub) {
aoqi@0 1088 if (stub != NULL) {
aoqi@0 1089 stub->visit(this);
aoqi@0 1090 }
aoqi@0 1091 }
aoqi@0 1092
aoqi@0 1093 XHandlers* LIR_OpVisitState::all_xhandler() {
aoqi@0 1094 XHandlers* result = NULL;
aoqi@0 1095
aoqi@0 1096 int i;
aoqi@0 1097 for (i = 0; i < info_count(); i++) {
aoqi@0 1098 if (info_at(i)->exception_handlers() != NULL) {
aoqi@0 1099 result = info_at(i)->exception_handlers();
aoqi@0 1100 break;
aoqi@0 1101 }
aoqi@0 1102 }
aoqi@0 1103
aoqi@0 1104 #ifdef ASSERT
aoqi@0 1105 for (i = 0; i < info_count(); i++) {
aoqi@0 1106 assert(info_at(i)->exception_handlers() == NULL ||
aoqi@0 1107 info_at(i)->exception_handlers() == result,
aoqi@0 1108 "only one xhandler list allowed per LIR-operation");
aoqi@0 1109 }
aoqi@0 1110 #endif
aoqi@0 1111
aoqi@0 1112 if (result != NULL) {
aoqi@0 1113 return result;
aoqi@0 1114 } else {
aoqi@0 1115 return new XHandlers();
aoqi@0 1116 }
aoqi@0 1117
aoqi@0 1118 return result;
aoqi@0 1119 }
aoqi@0 1120
aoqi@0 1121
aoqi@0 1122 #ifdef ASSERT
aoqi@0 1123 bool LIR_OpVisitState::no_operands(LIR_Op* op) {
aoqi@0 1124 visit(op);
aoqi@0 1125
aoqi@0 1126 return opr_count(inputMode) == 0 &&
aoqi@0 1127 opr_count(outputMode) == 0 &&
aoqi@0 1128 opr_count(tempMode) == 0 &&
aoqi@0 1129 info_count() == 0 &&
aoqi@0 1130 !has_call() &&
aoqi@0 1131 !has_slow_case();
aoqi@0 1132 }
aoqi@0 1133 #endif
aoqi@0 1134
aoqi@0 1135 //---------------------------------------------------
aoqi@0 1136
aoqi@0 1137
aoqi@0 1138 void LIR_OpJavaCall::emit_code(LIR_Assembler* masm) {
aoqi@0 1139 masm->emit_call(this);
aoqi@0 1140 }
aoqi@0 1141
aoqi@0 1142 void LIR_OpRTCall::emit_code(LIR_Assembler* masm) {
aoqi@0 1143 masm->emit_rtcall(this);
aoqi@0 1144 }
aoqi@0 1145
aoqi@0 1146 void LIR_OpLabel::emit_code(LIR_Assembler* masm) {
aoqi@0 1147 masm->emit_opLabel(this);
aoqi@0 1148 }
aoqi@0 1149
aoqi@0 1150 void LIR_OpArrayCopy::emit_code(LIR_Assembler* masm) {
aoqi@0 1151 masm->emit_arraycopy(this);
aoqi@0 1152 masm->append_code_stub(stub());
aoqi@0 1153 }
aoqi@0 1154
aoqi@0 1155 void LIR_OpUpdateCRC32::emit_code(LIR_Assembler* masm) {
aoqi@0 1156 masm->emit_updatecrc32(this);
aoqi@0 1157 }
aoqi@0 1158
aoqi@0 1159 void LIR_Op0::emit_code(LIR_Assembler* masm) {
aoqi@0 1160 masm->emit_op0(this);
aoqi@0 1161 }
aoqi@0 1162
aoqi@0 1163 void LIR_Op1::emit_code(LIR_Assembler* masm) {
aoqi@0 1164 masm->emit_op1(this);
aoqi@0 1165 }
aoqi@0 1166
aoqi@0 1167 void LIR_OpAllocObj::emit_code(LIR_Assembler* masm) {
aoqi@0 1168 masm->emit_alloc_obj(this);
aoqi@0 1169 masm->append_code_stub(stub());
aoqi@0 1170 }
aoqi@0 1171
aoqi@0 1172 void LIR_OpBranch::emit_code(LIR_Assembler* masm) {
aoqi@0 1173 masm->emit_opBranch(this);
aoqi@0 1174 if (stub()) {
aoqi@0 1175 masm->append_code_stub(stub());
aoqi@0 1176 }
aoqi@0 1177 }
aoqi@0 1178
aoqi@0 1179 void LIR_OpConvert::emit_code(LIR_Assembler* masm) {
aoqi@0 1180 masm->emit_opConvert(this);
aoqi@0 1181 if (stub() != NULL) {
aoqi@0 1182 masm->append_code_stub(stub());
aoqi@0 1183 }
aoqi@0 1184 }
aoqi@0 1185
aoqi@0 1186 void LIR_Op2::emit_code(LIR_Assembler* masm) {
aoqi@0 1187 masm->emit_op2(this);
aoqi@0 1188 }
aoqi@0 1189
aoqi@0 1190 void LIR_OpAllocArray::emit_code(LIR_Assembler* masm) {
aoqi@0 1191 masm->emit_alloc_array(this);
aoqi@0 1192 masm->append_code_stub(stub());
aoqi@0 1193 }
aoqi@0 1194
aoqi@0 1195 void LIR_OpTypeCheck::emit_code(LIR_Assembler* masm) {
aoqi@0 1196 masm->emit_opTypeCheck(this);
aoqi@0 1197 if (stub()) {
aoqi@0 1198 masm->append_code_stub(stub());
aoqi@0 1199 }
aoqi@0 1200 }
aoqi@0 1201
aoqi@0 1202 void LIR_OpCompareAndSwap::emit_code(LIR_Assembler* masm) {
aoqi@0 1203 masm->emit_compare_and_swap(this);
aoqi@0 1204 }
aoqi@0 1205
aoqi@0 1206 void LIR_Op3::emit_code(LIR_Assembler* masm) {
aoqi@0 1207 masm->emit_op3(this);
aoqi@0 1208 }
aoqi@0 1209
aoqi@0 1210 void LIR_OpLock::emit_code(LIR_Assembler* masm) {
aoqi@0 1211 masm->emit_lock(this);
aoqi@0 1212 if (stub()) {
aoqi@0 1213 masm->append_code_stub(stub());
aoqi@0 1214 }
aoqi@0 1215 }
aoqi@0 1216
aoqi@0 1217 #ifdef ASSERT
aoqi@0 1218 void LIR_OpAssert::emit_code(LIR_Assembler* masm) {
aoqi@0 1219 masm->emit_assert(this);
aoqi@0 1220 }
aoqi@0 1221 #endif
aoqi@0 1222
aoqi@0 1223 void LIR_OpDelay::emit_code(LIR_Assembler* masm) {
aoqi@0 1224 masm->emit_delay(this);
aoqi@0 1225 }
aoqi@0 1226
aoqi@0 1227 void LIR_OpProfileCall::emit_code(LIR_Assembler* masm) {
aoqi@0 1228 masm->emit_profile_call(this);
aoqi@0 1229 }
aoqi@0 1230
aoqi@0 1231 void LIR_OpProfileType::emit_code(LIR_Assembler* masm) {
aoqi@0 1232 masm->emit_profile_type(this);
aoqi@0 1233 }
aoqi@0 1234
aoqi@0 1235 // LIR_List
aoqi@0 1236 LIR_List::LIR_List(Compilation* compilation, BlockBegin* block)
aoqi@0 1237 : _operations(8)
aoqi@0 1238 , _compilation(compilation)
aoqi@0 1239 #ifndef PRODUCT
aoqi@0 1240 , _block(block)
aoqi@0 1241 #endif
aoqi@0 1242 #ifdef ASSERT
aoqi@0 1243 , _file(NULL)
aoqi@0 1244 , _line(0)
aoqi@0 1245 #endif
aoqi@0 1246 { }
aoqi@0 1247
aoqi@0 1248
aoqi@0 1249 #ifdef ASSERT
aoqi@0 1250 void LIR_List::set_file_and_line(const char * file, int line) {
aoqi@0 1251 const char * f = strrchr(file, '/');
aoqi@0 1252 if (f == NULL) f = strrchr(file, '\\');
aoqi@0 1253 if (f == NULL) {
aoqi@0 1254 f = file;
aoqi@0 1255 } else {
aoqi@0 1256 f++;
aoqi@0 1257 }
aoqi@0 1258 _file = f;
aoqi@0 1259 _line = line;
aoqi@0 1260 }
aoqi@0 1261 #endif
aoqi@0 1262
aoqi@0 1263
aoqi@0 1264 void LIR_List::append(LIR_InsertionBuffer* buffer) {
aoqi@0 1265 assert(this == buffer->lir_list(), "wrong lir list");
aoqi@0 1266 const int n = _operations.length();
aoqi@0 1267
aoqi@0 1268 if (buffer->number_of_ops() > 0) {
aoqi@0 1269 // increase size of instructions list
aoqi@0 1270 _operations.at_grow(n + buffer->number_of_ops() - 1, NULL);
aoqi@0 1271 // insert ops from buffer into instructions list
aoqi@0 1272 int op_index = buffer->number_of_ops() - 1;
aoqi@0 1273 int ip_index = buffer->number_of_insertion_points() - 1;
aoqi@0 1274 int from_index = n - 1;
aoqi@0 1275 int to_index = _operations.length() - 1;
aoqi@0 1276 for (; ip_index >= 0; ip_index --) {
aoqi@0 1277 int index = buffer->index_at(ip_index);
aoqi@0 1278 // make room after insertion point
aoqi@0 1279 while (index < from_index) {
aoqi@0 1280 _operations.at_put(to_index --, _operations.at(from_index --));
aoqi@0 1281 }
aoqi@0 1282 // insert ops from buffer
aoqi@0 1283 for (int i = buffer->count_at(ip_index); i > 0; i --) {
aoqi@0 1284 _operations.at_put(to_index --, buffer->op_at(op_index --));
aoqi@0 1285 }
aoqi@0 1286 }
aoqi@0 1287 }
aoqi@0 1288
aoqi@0 1289 buffer->finish();
aoqi@0 1290 }
aoqi@0 1291
aoqi@0 1292
aoqi@0 1293 void LIR_List::oop2reg_patch(jobject o, LIR_Opr reg, CodeEmitInfo* info) {
aoqi@0 1294 assert(reg->type() == T_OBJECT, "bad reg");
aoqi@0 1295 append(new LIR_Op1(lir_move, LIR_OprFact::oopConst(o), reg, T_OBJECT, lir_patch_normal, info));
aoqi@0 1296 }
aoqi@0 1297
aoqi@0 1298 void LIR_List::klass2reg_patch(Metadata* o, LIR_Opr reg, CodeEmitInfo* info) {
aoqi@0 1299 assert(reg->type() == T_METADATA, "bad reg");
aoqi@0 1300 append(new LIR_Op1(lir_move, LIR_OprFact::metadataConst(o), reg, T_METADATA, lir_patch_normal, info));
aoqi@0 1301 }
aoqi@0 1302
aoqi@0 1303 void LIR_List::load(LIR_Address* addr, LIR_Opr src, CodeEmitInfo* info, LIR_PatchCode patch_code) {
aoqi@0 1304 append(new LIR_Op1(
aoqi@0 1305 lir_move,
aoqi@0 1306 LIR_OprFact::address(addr),
aoqi@0 1307 src,
aoqi@0 1308 addr->type(),
aoqi@0 1309 patch_code,
aoqi@0 1310 info));
aoqi@0 1311 }
aoqi@0 1312
aoqi@0 1313
aoqi@0 1314 void LIR_List::volatile_load_mem_reg(LIR_Address* address, LIR_Opr dst, CodeEmitInfo* info, LIR_PatchCode patch_code) {
aoqi@0 1315 append(new LIR_Op1(
aoqi@0 1316 lir_move,
aoqi@0 1317 LIR_OprFact::address(address),
aoqi@0 1318 dst,
aoqi@0 1319 address->type(),
aoqi@0 1320 patch_code,
aoqi@0 1321 info, lir_move_volatile));
aoqi@0 1322 }
aoqi@0 1323
aoqi@0 1324 void LIR_List::volatile_load_unsafe_reg(LIR_Opr base, LIR_Opr offset, LIR_Opr dst, BasicType type, CodeEmitInfo* info, LIR_PatchCode patch_code) {
fujie@9138 1325 #ifdef MIPS
aoqi@8865 1326 add(base, offset, base);
aoqi@8865 1327 offset = 0;
aoqi@8865 1328 #endif
aoqi@0 1329 append(new LIR_Op1(
aoqi@0 1330 lir_move,
aoqi@0 1331 LIR_OprFact::address(new LIR_Address(base, offset, type)),
aoqi@0 1332 dst,
aoqi@0 1333 type,
aoqi@0 1334 patch_code,
aoqi@0 1335 info, lir_move_volatile));
aoqi@0 1336 }
aoqi@0 1337
aoqi@0 1338
aoqi@0 1339 void LIR_List::prefetch(LIR_Address* addr, bool is_store) {
aoqi@0 1340 append(new LIR_Op1(
aoqi@0 1341 is_store ? lir_prefetchw : lir_prefetchr,
aoqi@0 1342 LIR_OprFact::address(addr)));
aoqi@0 1343 }
aoqi@0 1344
aoqi@0 1345
aoqi@0 1346 void LIR_List::store_mem_int(jint v, LIR_Opr base, int offset_in_bytes, BasicType type, CodeEmitInfo* info, LIR_PatchCode patch_code) {
aoqi@0 1347 append(new LIR_Op1(
aoqi@0 1348 lir_move,
aoqi@0 1349 LIR_OprFact::intConst(v),
aoqi@0 1350 LIR_OprFact::address(new LIR_Address(base, offset_in_bytes, type)),
aoqi@0 1351 type,
aoqi@0 1352 patch_code,
aoqi@0 1353 info));
aoqi@0 1354 }
aoqi@0 1355
aoqi@0 1356
aoqi@0 1357 void LIR_List::store_mem_oop(jobject o, LIR_Opr base, int offset_in_bytes, BasicType type, CodeEmitInfo* info, LIR_PatchCode patch_code) {
aoqi@0 1358 append(new LIR_Op1(
aoqi@0 1359 lir_move,
aoqi@0 1360 LIR_OprFact::oopConst(o),
aoqi@0 1361 LIR_OprFact::address(new LIR_Address(base, offset_in_bytes, type)),
aoqi@0 1362 type,
aoqi@0 1363 patch_code,
aoqi@0 1364 info));
aoqi@0 1365 }
aoqi@0 1366
aoqi@0 1367
aoqi@0 1368 void LIR_List::store(LIR_Opr src, LIR_Address* addr, CodeEmitInfo* info, LIR_PatchCode patch_code) {
aoqi@0 1369 append(new LIR_Op1(
aoqi@0 1370 lir_move,
aoqi@0 1371 src,
aoqi@0 1372 LIR_OprFact::address(addr),
aoqi@0 1373 addr->type(),
aoqi@0 1374 patch_code,
aoqi@0 1375 info));
aoqi@0 1376 }
aoqi@0 1377
aoqi@0 1378
aoqi@0 1379 void LIR_List::volatile_store_mem_reg(LIR_Opr src, LIR_Address* addr, CodeEmitInfo* info, LIR_PatchCode patch_code) {
aoqi@0 1380 append(new LIR_Op1(
aoqi@0 1381 lir_move,
aoqi@0 1382 src,
aoqi@0 1383 LIR_OprFact::address(addr),
aoqi@0 1384 addr->type(),
aoqi@0 1385 patch_code,
aoqi@0 1386 info,
aoqi@0 1387 lir_move_volatile));
aoqi@0 1388 }
aoqi@0 1389
aoqi@0 1390 void LIR_List::volatile_store_unsafe_reg(LIR_Opr src, LIR_Opr base, LIR_Opr offset, BasicType type, CodeEmitInfo* info, LIR_PatchCode patch_code) {
fujie@9138 1391 #ifdef MIPS
aoqi@8865 1392 add(base, offset, base);
aoqi@8865 1393 offset = 0;
aoqi@8865 1394 #endif
aoqi@0 1395 append(new LIR_Op1(
aoqi@0 1396 lir_move,
aoqi@0 1397 src,
aoqi@0 1398 LIR_OprFact::address(new LIR_Address(base, offset, type)),
aoqi@0 1399 type,
aoqi@0 1400 patch_code,
aoqi@0 1401 info, lir_move_volatile));
aoqi@0 1402 }
aoqi@0 1403
fujie@9138 1404 #ifdef MIPS
aoqi@1 1405 void LIR_List::frem(LIR_Opr left, LIR_Opr right, LIR_Opr res, LIR_Opr tmp, CodeEmitInfo* info) {
aoqi@1 1406 append(new LIR_Op3(
aoqi@1 1407 lir_frem,
aoqi@1 1408 left,
aoqi@1 1409 right,
aoqi@1 1410 tmp,
aoqi@1 1411 res,
aoqi@1 1412 info));
aoqi@1 1413 }
aoqi@1 1414 #endif
aoqi@0 1415
aoqi@0 1416 void LIR_List::idiv(LIR_Opr left, LIR_Opr right, LIR_Opr res, LIR_Opr tmp, CodeEmitInfo* info) {
aoqi@0 1417 append(new LIR_Op3(
aoqi@0 1418 lir_idiv,
aoqi@0 1419 left,
aoqi@0 1420 right,
aoqi@0 1421 tmp,
aoqi@0 1422 res,
aoqi@0 1423 info));
aoqi@0 1424 }
aoqi@0 1425
aoqi@0 1426
aoqi@0 1427 void LIR_List::idiv(LIR_Opr left, int right, LIR_Opr res, LIR_Opr tmp, CodeEmitInfo* info) {
aoqi@0 1428 append(new LIR_Op3(
aoqi@0 1429 lir_idiv,
aoqi@0 1430 left,
aoqi@0 1431 LIR_OprFact::intConst(right),
aoqi@0 1432 tmp,
aoqi@0 1433 res,
aoqi@0 1434 info));
aoqi@0 1435 }
aoqi@0 1436
aoqi@0 1437
aoqi@0 1438 void LIR_List::irem(LIR_Opr left, LIR_Opr right, LIR_Opr res, LIR_Opr tmp, CodeEmitInfo* info) {
aoqi@0 1439 append(new LIR_Op3(
aoqi@0 1440 lir_irem,
aoqi@0 1441 left,
aoqi@0 1442 right,
aoqi@0 1443 tmp,
aoqi@0 1444 res,
aoqi@0 1445 info));
aoqi@0 1446 }
aoqi@0 1447
aoqi@0 1448
aoqi@0 1449 void LIR_List::irem(LIR_Opr left, int right, LIR_Opr res, LIR_Opr tmp, CodeEmitInfo* info) {
aoqi@0 1450 append(new LIR_Op3(
aoqi@0 1451 lir_irem,
aoqi@0 1452 left,
aoqi@0 1453 LIR_OprFact::intConst(right),
aoqi@0 1454 tmp,
aoqi@0 1455 res,
aoqi@0 1456 info));
aoqi@0 1457 }
aoqi@0 1458
aoqi@0 1459
fujie@9138 1460 #ifndef MIPS
aoqi@0 1461 void LIR_List::cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info) {
aoqi@0 1462 append(new LIR_Op2(
aoqi@0 1463 lir_cmp,
aoqi@0 1464 condition,
aoqi@0 1465 LIR_OprFact::address(new LIR_Address(base, disp, T_INT)),
aoqi@0 1466 LIR_OprFact::intConst(c),
aoqi@0 1467 info));
aoqi@0 1468 }
aoqi@0 1469
aoqi@0 1470 void LIR_List::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Address* addr, CodeEmitInfo* info) {
aoqi@0 1471 append(new LIR_Op2(
aoqi@0 1472 lir_cmp,
aoqi@0 1473 condition,
aoqi@0 1474 reg,
aoqi@0 1475 LIR_OprFact::address(addr),
aoqi@0 1476 info));
aoqi@0 1477 }
aoqi@8865 1478 #endif
aoqi@0 1479
aoqi@8865 1480 void LIR_List::null_check(LIR_Opr opr, CodeEmitInfo* info, bool deoptimize_on_null) {
aoqi@8865 1481 if (deoptimize_on_null) {
aoqi@8865 1482 // Emit an explicit null check and deoptimize if opr is null
aoqi@8865 1483 CodeStub* deopt = new DeoptimizeStub(info);
fujie@9138 1484 #ifndef MIPS
aoqi@8865 1485 cmp(lir_cond_equal, opr, LIR_OprFact::oopConst(NULL));
aoqi@8865 1486 branch(lir_cond_equal, T_OBJECT, deopt);
aoqi@8865 1487 #else
aoqi@8865 1488 null_check_for_branch(lir_cond_equal, opr, LIR_OprFact::oopConst(NULL));
aoqi@8865 1489 branch(lir_cond_equal, opr, LIR_OprFact::oopConst(NULL), T_OBJECT, deopt);
aoqi@8865 1490 #endif
aoqi@8865 1491 } else {
aoqi@8865 1492 // Emit an implicit null check
aoqi@8865 1493 append(new LIR_Op1(lir_null_check, opr, info));
aoqi@8865 1494 }
aoqi@8865 1495 }
aoqi@8865 1496
fujie@9138 1497 #ifndef MIPS
aoqi@0 1498 void LIR_List::allocate_object(LIR_Opr dst, LIR_Opr t1, LIR_Opr t2, LIR_Opr t3, LIR_Opr t4,
aoqi@0 1499 int header_size, int object_size, LIR_Opr klass, bool init_check, CodeStub* stub) {
aoqi@0 1500 append(new LIR_OpAllocObj(
aoqi@0 1501 klass,
aoqi@0 1502 dst,
aoqi@0 1503 t1,
aoqi@0 1504 t2,
aoqi@0 1505 t3,
aoqi@0 1506 t4,
aoqi@0 1507 header_size,
aoqi@0 1508 object_size,
aoqi@0 1509 init_check,
aoqi@0 1510 stub));
aoqi@0 1511 }
aoqi@0 1512
aoqi@0 1513 void LIR_List::allocate_array(LIR_Opr dst, LIR_Opr len, LIR_Opr t1,LIR_Opr t2, LIR_Opr t3,LIR_Opr t4, BasicType type, LIR_Opr klass, CodeStub* stub) {
aoqi@0 1514 append(new LIR_OpAllocArray(
aoqi@0 1515 klass,
aoqi@0 1516 len,
aoqi@0 1517 dst,
aoqi@0 1518 t1,
aoqi@0 1519 t2,
aoqi@0 1520 t3,
aoqi@0 1521 t4,
aoqi@0 1522 type,
aoqi@0 1523 stub));
aoqi@0 1524 }
aoqi@1 1525 #else
aoqi@8865 1526 void LIR_List::allocate_object(LIR_Opr dst, LIR_Opr t1, LIR_Opr t2, LIR_Opr t3, LIR_Opr t4, LIR_Opr t5, LIR_Opr t6,
aoqi@1 1527 int header_size, int object_size, LIR_Opr klass, bool init_check, CodeStub* stub) {
aoqi@1 1528 append(new LIR_OpAllocObj(
aoqi@1 1529 klass,
aoqi@1 1530 dst,
aoqi@1 1531 t1,
aoqi@1 1532 t2,
aoqi@1 1533 t3,
aoqi@1 1534 t4,
aoqi@1 1535 t5,
aoqi@1 1536 t6,
aoqi@1 1537 header_size,
aoqi@1 1538 object_size,
aoqi@1 1539 init_check,
aoqi@1 1540 stub));
aoqi@1 1541 }
aoqi@1 1542 void LIR_List::allocate_array(LIR_Opr dst, LIR_Opr len, LIR_Opr t1,LIR_Opr t2, LIR_Opr t3,LIR_Opr t4, LIR_Opr t5,
aoqi@1 1543 BasicType type, LIR_Opr klass, CodeStub* stub) {
aoqi@1 1544 append(new LIR_OpAllocArray(
aoqi@1 1545 klass,
aoqi@1 1546 len,
aoqi@1 1547 dst,
aoqi@1 1548 t1,
aoqi@1 1549 t2,
aoqi@1 1550 t3,
aoqi@1 1551 t4,
aoqi@1 1552 t5,
aoqi@1 1553 type,
aoqi@1 1554 stub));
aoqi@1 1555 }
aoqi@1 1556
aoqi@1 1557 #endif
aoqi@0 1558
aoqi@0 1559 void LIR_List::shift_left(LIR_Opr value, LIR_Opr count, LIR_Opr dst, LIR_Opr tmp) {
aoqi@0 1560 append(new LIR_Op2(
aoqi@0 1561 lir_shl,
aoqi@0 1562 value,
aoqi@0 1563 count,
aoqi@0 1564 dst,
aoqi@0 1565 tmp));
aoqi@0 1566 }
aoqi@0 1567
aoqi@0 1568 void LIR_List::shift_right(LIR_Opr value, LIR_Opr count, LIR_Opr dst, LIR_Opr tmp) {
aoqi@0 1569 append(new LIR_Op2(
aoqi@0 1570 lir_shr,
aoqi@0 1571 value,
aoqi@0 1572 count,
aoqi@0 1573 dst,
aoqi@0 1574 tmp));
aoqi@0 1575 }
aoqi@0 1576
aoqi@0 1577
aoqi@0 1578 void LIR_List::unsigned_shift_right(LIR_Opr value, LIR_Opr count, LIR_Opr dst, LIR_Opr tmp) {
aoqi@0 1579 append(new LIR_Op2(
aoqi@0 1580 lir_ushr,
aoqi@0 1581 value,
aoqi@0 1582 count,
aoqi@0 1583 dst,
aoqi@0 1584 tmp));
aoqi@0 1585 }
aoqi@0 1586
aoqi@0 1587 void LIR_List::fcmp2int(LIR_Opr left, LIR_Opr right, LIR_Opr dst, bool is_unordered_less) {
aoqi@0 1588 append(new LIR_Op2(is_unordered_less ? lir_ucmp_fd2i : lir_cmp_fd2i,
aoqi@0 1589 left,
aoqi@0 1590 right,
aoqi@0 1591 dst));
aoqi@0 1592 }
aoqi@0 1593
aoqi@0 1594 void LIR_List::lock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub, CodeEmitInfo* info) {
aoqi@0 1595 append(new LIR_OpLock(
aoqi@0 1596 lir_lock,
aoqi@0 1597 hdr,
aoqi@0 1598 obj,
aoqi@0 1599 lock,
aoqi@0 1600 scratch,
aoqi@0 1601 stub,
aoqi@0 1602 info));
aoqi@0 1603 }
aoqi@0 1604
aoqi@0 1605 void LIR_List::unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub) {
aoqi@0 1606 append(new LIR_OpLock(
aoqi@0 1607 lir_unlock,
aoqi@0 1608 hdr,
aoqi@0 1609 obj,
aoqi@0 1610 lock,
aoqi@0 1611 scratch,
aoqi@0 1612 stub,
aoqi@0 1613 NULL));
aoqi@0 1614 }
aoqi@0 1615
aoqi@0 1616
aoqi@0 1617 void check_LIR() {
aoqi@0 1618 // cannot do the proper checking as PRODUCT and other modes return different results
aoqi@0 1619 // guarantee(sizeof(LIR_OprDesc) == wordSize, "may not have a v-table");
aoqi@0 1620 }
aoqi@0 1621
aoqi@0 1622
aoqi@0 1623
aoqi@0 1624 void LIR_List::checkcast (LIR_Opr result, LIR_Opr object, ciKlass* klass,
aoqi@0 1625 LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
aoqi@0 1626 CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub,
aoqi@0 1627 ciMethod* profiled_method, int profiled_bci) {
aoqi@0 1628 LIR_OpTypeCheck* c = new LIR_OpTypeCheck(lir_checkcast, result, object, klass,
aoqi@0 1629 tmp1, tmp2, tmp3, fast_check, info_for_exception, info_for_patch, stub);
aoqi@0 1630 if (profiled_method != NULL) {
aoqi@0 1631 c->set_profiled_method(profiled_method);
aoqi@0 1632 c->set_profiled_bci(profiled_bci);
aoqi@0 1633 c->set_should_profile(true);
aoqi@0 1634 }
aoqi@0 1635 append(c);
aoqi@0 1636 }
aoqi@0 1637
aoqi@0 1638 void LIR_List::instanceof(LIR_Opr result, LIR_Opr object, ciKlass* klass, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check, CodeEmitInfo* info_for_patch, ciMethod* profiled_method, int profiled_bci) {
aoqi@0 1639 LIR_OpTypeCheck* c = new LIR_OpTypeCheck(lir_instanceof, result, object, klass, tmp1, tmp2, tmp3, fast_check, NULL, info_for_patch, NULL);
aoqi@0 1640 if (profiled_method != NULL) {
aoqi@0 1641 c->set_profiled_method(profiled_method);
aoqi@0 1642 c->set_profiled_bci(profiled_bci);
aoqi@0 1643 c->set_should_profile(true);
aoqi@0 1644 }
aoqi@0 1645 append(c);
aoqi@0 1646 }
aoqi@0 1647
aoqi@8865 1648
aoqi@0 1649 void LIR_List::store_check(LIR_Opr object, LIR_Opr array, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3,
aoqi@0 1650 CodeEmitInfo* info_for_exception, ciMethod* profiled_method, int profiled_bci) {
aoqi@0 1651 LIR_OpTypeCheck* c = new LIR_OpTypeCheck(lir_store_check, object, array, tmp1, tmp2, tmp3, info_for_exception);
aoqi@0 1652 if (profiled_method != NULL) {
aoqi@0 1653 c->set_profiled_method(profiled_method);
aoqi@0 1654 c->set_profiled_bci(profiled_bci);
aoqi@0 1655 c->set_should_profile(true);
aoqi@0 1656 }
aoqi@0 1657 append(c);
aoqi@0 1658 }
aoqi@0 1659
aoqi@0 1660 void LIR_List::cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
aoqi@0 1661 LIR_Opr t1, LIR_Opr t2, LIR_Opr result) {
aoqi@0 1662 append(new LIR_OpCompareAndSwap(lir_cas_long, addr, cmp_value, new_value, t1, t2, result));
aoqi@0 1663 }
aoqi@0 1664
aoqi@0 1665 void LIR_List::cas_obj(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
aoqi@0 1666 LIR_Opr t1, LIR_Opr t2, LIR_Opr result) {
aoqi@0 1667 append(new LIR_OpCompareAndSwap(lir_cas_obj, addr, cmp_value, new_value, t1, t2, result));
aoqi@0 1668 }
aoqi@0 1669
aoqi@0 1670 void LIR_List::cas_int(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
aoqi@0 1671 LIR_Opr t1, LIR_Opr t2, LIR_Opr result) {
aoqi@0 1672 append(new LIR_OpCompareAndSwap(lir_cas_int, addr, cmp_value, new_value, t1, t2, result));
aoqi@0 1673 }
aoqi@0 1674
aoqi@0 1675
aoqi@0 1676 #ifdef PRODUCT
aoqi@0 1677
aoqi@0 1678 void print_LIR(BlockList* blocks) {
aoqi@0 1679 }
aoqi@0 1680
aoqi@0 1681 #else
aoqi@0 1682 // LIR_OprDesc
aoqi@0 1683 void LIR_OprDesc::print() const {
aoqi@0 1684 print(tty);
aoqi@0 1685 }
aoqi@0 1686
aoqi@0 1687 void LIR_OprDesc::print(outputStream* out) const {
aoqi@0 1688 if (is_illegal()) {
aoqi@0 1689 return;
aoqi@0 1690 }
aoqi@0 1691
aoqi@0 1692 out->print("[");
aoqi@0 1693 if (is_pointer()) {
aoqi@0 1694 pointer()->print_value_on(out);
aoqi@0 1695 } else if (is_single_stack()) {
aoqi@0 1696 out->print("stack:%d", single_stack_ix());
aoqi@0 1697 } else if (is_double_stack()) {
aoqi@0 1698 out->print("dbl_stack:%d",double_stack_ix());
aoqi@0 1699 } else if (is_virtual()) {
aoqi@0 1700 out->print("R%d", vreg_number());
aoqi@0 1701 } else if (is_single_cpu()) {
aoqi@0 1702 out->print("%s", as_register()->name());
aoqi@0 1703 } else if (is_double_cpu()) {
aoqi@0 1704 out->print("%s", as_register_hi()->name());
aoqi@0 1705 out->print("%s", as_register_lo()->name());
aoqi@0 1706 #if defined(X86)
aoqi@0 1707 } else if (is_single_xmm()) {
aoqi@0 1708 out->print("%s", as_xmm_float_reg()->name());
aoqi@0 1709 } else if (is_double_xmm()) {
aoqi@0 1710 out->print("%s", as_xmm_double_reg()->name());
aoqi@0 1711 } else if (is_single_fpu()) {
aoqi@0 1712 out->print("fpu%d", fpu_regnr());
aoqi@0 1713 } else if (is_double_fpu()) {
aoqi@0 1714 out->print("fpu%d", fpu_regnrLo());
aoqi@0 1715 #elif defined(ARM)
aoqi@0 1716 } else if (is_single_fpu()) {
aoqi@0 1717 out->print("s%d", fpu_regnr());
aoqi@0 1718 } else if (is_double_fpu()) {
aoqi@0 1719 out->print("d%d", fpu_regnrLo() >> 1);
aoqi@0 1720 #else
aoqi@0 1721 } else if (is_single_fpu()) {
aoqi@0 1722 out->print("%s", as_float_reg()->name());
aoqi@0 1723 } else if (is_double_fpu()) {
aoqi@0 1724 out->print("%s", as_double_reg()->name());
aoqi@0 1725 #endif
aoqi@0 1726
aoqi@0 1727 } else if (is_illegal()) {
aoqi@0 1728 out->print("-");
aoqi@0 1729 } else {
aoqi@0 1730 out->print("Unknown Operand");
aoqi@0 1731 }
aoqi@0 1732 if (!is_illegal()) {
aoqi@0 1733 out->print("|%c", type_char());
aoqi@0 1734 }
aoqi@0 1735 if (is_register() && is_last_use()) {
aoqi@0 1736 out->print("(last_use)");
aoqi@0 1737 }
aoqi@0 1738 out->print("]");
aoqi@0 1739 }
aoqi@0 1740
aoqi@0 1741
aoqi@0 1742 // LIR_Address
aoqi@0 1743 void LIR_Const::print_value_on(outputStream* out) const {
aoqi@0 1744 switch (type()) {
aoqi@0 1745 case T_ADDRESS:out->print("address:%d",as_jint()); break;
aoqi@0 1746 case T_INT: out->print("int:%d", as_jint()); break;
aoqi@0 1747 case T_LONG: out->print("lng:" JLONG_FORMAT, as_jlong()); break;
aoqi@0 1748 case T_FLOAT: out->print("flt:%f", as_jfloat()); break;
aoqi@0 1749 case T_DOUBLE: out->print("dbl:%f", as_jdouble()); break;
aoqi@0 1750 case T_OBJECT: out->print("obj:" INTPTR_FORMAT, p2i(as_jobject())); break;
aoqi@0 1751 case T_METADATA: out->print("metadata:" INTPTR_FORMAT, p2i(as_metadata()));break;
aoqi@0 1752 default: out->print("%3d:0x" UINT64_FORMAT_X, type(), (uint64_t)as_jlong()); break;
aoqi@0 1753 }
aoqi@0 1754 }
aoqi@0 1755
aoqi@0 1756 // LIR_Address
aoqi@0 1757 void LIR_Address::print_value_on(outputStream* out) const {
aoqi@0 1758 out->print("Base:"); _base->print(out);
fujie@9138 1759 #ifndef MIPS
aoqi@0 1760 if (!_index->is_illegal()) {
aoqi@0 1761 out->print(" Index:"); _index->print(out);
aoqi@0 1762 switch (scale()) {
aoqi@0 1763 case times_1: break;
aoqi@0 1764 case times_2: out->print(" * 2"); break;
aoqi@0 1765 case times_4: out->print(" * 4"); break;
aoqi@0 1766 case times_8: out->print(" * 8"); break;
aoqi@0 1767 }
aoqi@0 1768 }
aoqi@1 1769 #endif
aoqi@0 1770 out->print(" Disp: " INTX_FORMAT, _disp);
aoqi@0 1771 }
aoqi@0 1772
aoqi@0 1773 // debug output of block header without InstructionPrinter
aoqi@0 1774 // (because phi functions are not necessary for LIR)
aoqi@0 1775 static void print_block(BlockBegin* x) {
aoqi@0 1776 // print block id
aoqi@0 1777 BlockEnd* end = x->end();
aoqi@0 1778 tty->print("B%d ", x->block_id());
aoqi@0 1779
aoqi@0 1780 // print flags
aoqi@0 1781 if (x->is_set(BlockBegin::std_entry_flag)) tty->print("std ");
aoqi@0 1782 if (x->is_set(BlockBegin::osr_entry_flag)) tty->print("osr ");
aoqi@0 1783 if (x->is_set(BlockBegin::exception_entry_flag)) tty->print("ex ");
aoqi@0 1784 if (x->is_set(BlockBegin::subroutine_entry_flag)) tty->print("jsr ");
aoqi@0 1785 if (x->is_set(BlockBegin::backward_branch_target_flag)) tty->print("bb ");
aoqi@0 1786 if (x->is_set(BlockBegin::linear_scan_loop_header_flag)) tty->print("lh ");
aoqi@0 1787 if (x->is_set(BlockBegin::linear_scan_loop_end_flag)) tty->print("le ");
aoqi@0 1788
aoqi@0 1789 // print block bci range
aoqi@0 1790 tty->print("[%d, %d] ", x->bci(), (end == NULL ? -1 : end->printable_bci()));
aoqi@0 1791
aoqi@0 1792 // print predecessors and successors
aoqi@0 1793 if (x->number_of_preds() > 0) {
aoqi@0 1794 tty->print("preds: ");
aoqi@0 1795 for (int i = 0; i < x->number_of_preds(); i ++) {
aoqi@0 1796 tty->print("B%d ", x->pred_at(i)->block_id());
aoqi@0 1797 }
aoqi@0 1798 }
aoqi@0 1799
aoqi@0 1800 if (x->number_of_sux() > 0) {
aoqi@0 1801 tty->print("sux: ");
aoqi@0 1802 for (int i = 0; i < x->number_of_sux(); i ++) {
aoqi@0 1803 tty->print("B%d ", x->sux_at(i)->block_id());
aoqi@0 1804 }
aoqi@0 1805 }
aoqi@0 1806
aoqi@0 1807 // print exception handlers
aoqi@0 1808 if (x->number_of_exception_handlers() > 0) {
aoqi@0 1809 tty->print("xhandler: ");
aoqi@0 1810 for (int i = 0; i < x->number_of_exception_handlers(); i++) {
aoqi@0 1811 tty->print("B%d ", x->exception_handler_at(i)->block_id());
aoqi@0 1812 }
aoqi@0 1813 }
aoqi@0 1814
aoqi@0 1815 tty->cr();
aoqi@0 1816 }
aoqi@0 1817
aoqi@0 1818 void print_LIR(BlockList* blocks) {
aoqi@0 1819 tty->print_cr("LIR:");
aoqi@0 1820 int i;
aoqi@0 1821 for (i = 0; i < blocks->length(); i++) {
aoqi@0 1822 BlockBegin* bb = blocks->at(i);
aoqi@0 1823 print_block(bb);
aoqi@0 1824 tty->print("__id_Instruction___________________________________________"); tty->cr();
aoqi@0 1825 bb->lir()->print_instructions();
aoqi@0 1826 }
aoqi@0 1827 }
aoqi@0 1828
aoqi@0 1829 void LIR_List::print_instructions() {
aoqi@0 1830 for (int i = 0; i < _operations.length(); i++) {
aoqi@0 1831 _operations.at(i)->print(); tty->cr();
aoqi@0 1832 }
aoqi@0 1833 tty->cr();
aoqi@0 1834 }
aoqi@0 1835
aoqi@0 1836 // LIR_Ops printing routines
aoqi@0 1837 // LIR_Op
aoqi@0 1838 void LIR_Op::print_on(outputStream* out) const {
aoqi@0 1839 if (id() != -1 || PrintCFGToFile) {
aoqi@0 1840 out->print("%4d ", id());
aoqi@0 1841 } else {
aoqi@0 1842 out->print(" ");
aoqi@0 1843 }
aoqi@0 1844 out->print("%s ", name());
aoqi@0 1845 print_instr(out);
aoqi@0 1846 if (info() != NULL) out->print(" [bci:%d]", info()->stack()->bci());
aoqi@0 1847 #ifdef ASSERT
aoqi@0 1848 if (Verbose && _file != NULL) {
aoqi@0 1849 out->print(" (%s:%d)", _file, _line);
aoqi@0 1850 }
aoqi@0 1851 #endif
aoqi@0 1852 }
aoqi@0 1853
aoqi@0 1854 const char * LIR_Op::name() const {
aoqi@0 1855 const char* s = NULL;
aoqi@0 1856 switch(code()) {
aoqi@0 1857 // LIR_Op0
aoqi@0 1858 case lir_membar: s = "membar"; break;
aoqi@0 1859 case lir_membar_acquire: s = "membar_acquire"; break;
aoqi@0 1860 case lir_membar_release: s = "membar_release"; break;
aoqi@0 1861 case lir_membar_loadload: s = "membar_loadload"; break;
aoqi@0 1862 case lir_membar_storestore: s = "membar_storestore"; break;
aoqi@0 1863 case lir_membar_loadstore: s = "membar_loadstore"; break;
aoqi@0 1864 case lir_membar_storeload: s = "membar_storeload"; break;
aoqi@0 1865 case lir_word_align: s = "word_align"; break;
aoqi@0 1866 case lir_label: s = "label"; break;
aoqi@0 1867 case lir_nop: s = "nop"; break;
aoqi@0 1868 case lir_backwardbranch_target: s = "backbranch"; break;
aoqi@0 1869 case lir_std_entry: s = "std_entry"; break;
aoqi@0 1870 case lir_osr_entry: s = "osr_entry"; break;
aoqi@0 1871 case lir_build_frame: s = "build_frm"; break;
aoqi@0 1872 case lir_fpop_raw: s = "fpop_raw"; break;
aoqi@0 1873 case lir_24bit_FPU: s = "24bit_FPU"; break;
aoqi@0 1874 case lir_reset_FPU: s = "reset_FPU"; break;
aoqi@0 1875 case lir_breakpoint: s = "breakpoint"; break;
aoqi@0 1876 case lir_get_thread: s = "get_thread"; break;
aoqi@0 1877 // LIR_Op1
aoqi@0 1878 case lir_fxch: s = "fxch"; break;
aoqi@0 1879 case lir_fld: s = "fld"; break;
aoqi@0 1880 case lir_ffree: s = "ffree"; break;
aoqi@0 1881 case lir_push: s = "push"; break;
aoqi@0 1882 case lir_pop: s = "pop"; break;
aoqi@0 1883 case lir_null_check: s = "null_check"; break;
aoqi@0 1884 case lir_return: s = "return"; break;
aoqi@0 1885 case lir_safepoint: s = "safepoint"; break;
aoqi@0 1886 case lir_neg: s = "neg"; break;
aoqi@0 1887 case lir_leal: s = "leal"; break;
aoqi@0 1888 case lir_branch: s = "branch"; break;
aoqi@0 1889 case lir_cond_float_branch: s = "flt_cond_br"; break;
aoqi@0 1890 case lir_move: s = "move"; break;
aoqi@0 1891 case lir_roundfp: s = "roundfp"; break;
aoqi@0 1892 case lir_rtcall: s = "rtcall"; break;
aoqi@0 1893 case lir_throw: s = "throw"; break;
aoqi@0 1894 case lir_unwind: s = "unwind"; break;
aoqi@0 1895 case lir_convert: s = "convert"; break;
aoqi@0 1896 case lir_alloc_object: s = "alloc_obj"; break;
aoqi@0 1897 case lir_monaddr: s = "mon_addr"; break;
aoqi@0 1898 case lir_pack64: s = "pack64"; break;
aoqi@0 1899 case lir_unpack64: s = "unpack64"; break;
aoqi@0 1900 // LIR_Op2
fujie@9138 1901 #ifdef MIPS
aoqi@1 1902 case lir_null_check_for_branch: s = "null_check_for_branch"; break;
aoqi@1 1903 #else
aoqi@0 1904 case lir_cmp: s = "cmp"; break;
aoqi@1 1905 #endif
aoqi@0 1906 case lir_cmp_l2i: s = "cmp_l2i"; break;
aoqi@0 1907 case lir_ucmp_fd2i: s = "ucomp_fd2i"; break;
aoqi@0 1908 case lir_cmp_fd2i: s = "comp_fd2i"; break;
aoqi@0 1909 case lir_cmove: s = "cmove"; break;
aoqi@0 1910 case lir_add: s = "add"; break;
aoqi@0 1911 case lir_sub: s = "sub"; break;
aoqi@0 1912 case lir_mul: s = "mul"; break;
aoqi@0 1913 case lir_mul_strictfp: s = "mul_strictfp"; break;
aoqi@0 1914 case lir_div: s = "div"; break;
aoqi@0 1915 case lir_div_strictfp: s = "div_strictfp"; break;
aoqi@0 1916 case lir_rem: s = "rem"; break;
aoqi@0 1917 case lir_abs: s = "abs"; break;
aoqi@0 1918 case lir_sqrt: s = "sqrt"; break;
aoqi@0 1919 case lir_sin: s = "sin"; break;
aoqi@0 1920 case lir_cos: s = "cos"; break;
aoqi@0 1921 case lir_tan: s = "tan"; break;
aoqi@0 1922 case lir_log: s = "log"; break;
aoqi@0 1923 case lir_log10: s = "log10"; break;
aoqi@0 1924 case lir_exp: s = "exp"; break;
aoqi@0 1925 case lir_pow: s = "pow"; break;
aoqi@0 1926 case lir_logic_and: s = "logic_and"; break;
aoqi@0 1927 case lir_logic_or: s = "logic_or"; break;
aoqi@0 1928 case lir_logic_xor: s = "logic_xor"; break;
aoqi@0 1929 case lir_shl: s = "shift_left"; break;
aoqi@0 1930 case lir_shr: s = "shift_right"; break;
aoqi@0 1931 case lir_ushr: s = "ushift_right"; break;
aoqi@0 1932 case lir_alloc_array: s = "alloc_array"; break;
aoqi@0 1933 case lir_xadd: s = "xadd"; break;
aoqi@0 1934 case lir_xchg: s = "xchg"; break;
aoqi@0 1935 // LIR_Op3
fujie@9138 1936 #ifdef MIPS
aoqi@1 1937 case lir_frem: s = "frem"; break;
aoqi@1 1938 #endif
aoqi@0 1939 case lir_idiv: s = "idiv"; break;
aoqi@0 1940 case lir_irem: s = "irem"; break;
aoqi@0 1941 // LIR_OpJavaCall
aoqi@0 1942 case lir_static_call: s = "static"; break;
aoqi@0 1943 case lir_optvirtual_call: s = "optvirtual"; break;
aoqi@0 1944 case lir_icvirtual_call: s = "icvirtual"; break;
aoqi@0 1945 case lir_virtual_call: s = "virtual"; break;
aoqi@0 1946 case lir_dynamic_call: s = "dynamic"; break;
aoqi@0 1947 // LIR_OpArrayCopy
aoqi@0 1948 case lir_arraycopy: s = "arraycopy"; break;
aoqi@0 1949 // LIR_OpUpdateCRC32
aoqi@0 1950 case lir_updatecrc32: s = "updatecrc32"; break;
aoqi@0 1951 // LIR_OpLock
aoqi@0 1952 case lir_lock: s = "lock"; break;
aoqi@0 1953 case lir_unlock: s = "unlock"; break;
aoqi@0 1954 // LIR_OpDelay
aoqi@0 1955 case lir_delay_slot: s = "delay"; break;
aoqi@0 1956 // LIR_OpTypeCheck
aoqi@0 1957 case lir_instanceof: s = "instanceof"; break;
aoqi@0 1958 case lir_checkcast: s = "checkcast"; break;
aoqi@0 1959 case lir_store_check: s = "store_check"; break;
aoqi@0 1960 // LIR_OpCompareAndSwap
aoqi@0 1961 case lir_cas_long: s = "cas_long"; break;
aoqi@0 1962 case lir_cas_obj: s = "cas_obj"; break;
aoqi@0 1963 case lir_cas_int: s = "cas_int"; break;
aoqi@0 1964 // LIR_OpProfileCall
aoqi@0 1965 case lir_profile_call: s = "profile_call"; break;
aoqi@0 1966 // LIR_OpProfileType
aoqi@0 1967 case lir_profile_type: s = "profile_type"; break;
aoqi@0 1968 // LIR_OpAssert
aoqi@0 1969 #ifdef ASSERT
aoqi@0 1970 case lir_assert: s = "assert"; break;
aoqi@0 1971 #endif
aoqi@0 1972 case lir_none: ShouldNotReachHere();break;
aoqi@0 1973 default: s = "illegal_op"; break;
aoqi@0 1974 }
aoqi@0 1975 return s;
aoqi@0 1976 }
aoqi@0 1977
aoqi@0 1978 // LIR_OpJavaCall
aoqi@0 1979 void LIR_OpJavaCall::print_instr(outputStream* out) const {
aoqi@0 1980 out->print("call: ");
aoqi@0 1981 out->print("[addr: " INTPTR_FORMAT "]", p2i(address()));
aoqi@0 1982 if (receiver()->is_valid()) {
aoqi@0 1983 out->print(" [recv: "); receiver()->print(out); out->print("]");
aoqi@0 1984 }
aoqi@0 1985 if (result_opr()->is_valid()) {
aoqi@0 1986 out->print(" [result: "); result_opr()->print(out); out->print("]");
aoqi@0 1987 }
aoqi@0 1988 }
aoqi@0 1989
aoqi@0 1990 // LIR_OpLabel
aoqi@0 1991 void LIR_OpLabel::print_instr(outputStream* out) const {
aoqi@0 1992 out->print("[label:" INTPTR_FORMAT "]", p2i(_label));
aoqi@0 1993 }
aoqi@0 1994
aoqi@0 1995 // LIR_OpArrayCopy
aoqi@0 1996 void LIR_OpArrayCopy::print_instr(outputStream* out) const {
aoqi@0 1997 src()->print(out); out->print(" ");
aoqi@0 1998 src_pos()->print(out); out->print(" ");
aoqi@0 1999 dst()->print(out); out->print(" ");
aoqi@0 2000 dst_pos()->print(out); out->print(" ");
aoqi@0 2001 length()->print(out); out->print(" ");
aoqi@0 2002 tmp()->print(out); out->print(" ");
aoqi@0 2003 }
aoqi@0 2004
aoqi@0 2005 // LIR_OpUpdateCRC32
aoqi@0 2006 void LIR_OpUpdateCRC32::print_instr(outputStream* out) const {
aoqi@0 2007 crc()->print(out); out->print(" ");
aoqi@0 2008 val()->print(out); out->print(" ");
aoqi@0 2009 result_opr()->print(out); out->print(" ");
aoqi@0 2010 }
aoqi@0 2011
aoqi@0 2012 // LIR_OpCompareAndSwap
aoqi@0 2013 void LIR_OpCompareAndSwap::print_instr(outputStream* out) const {
aoqi@0 2014 addr()->print(out); out->print(" ");
aoqi@0 2015 cmp_value()->print(out); out->print(" ");
aoqi@0 2016 new_value()->print(out); out->print(" ");
aoqi@0 2017 tmp1()->print(out); out->print(" ");
aoqi@0 2018 tmp2()->print(out); out->print(" ");
aoqi@0 2019
aoqi@0 2020 }
aoqi@0 2021
aoqi@0 2022 // LIR_Op0
aoqi@0 2023 void LIR_Op0::print_instr(outputStream* out) const {
aoqi@0 2024 result_opr()->print(out);
aoqi@0 2025 }
aoqi@0 2026
aoqi@0 2027 // LIR_Op1
aoqi@0 2028 const char * LIR_Op1::name() const {
aoqi@0 2029 if (code() == lir_move) {
aoqi@0 2030 switch (move_kind()) {
aoqi@0 2031 case lir_move_normal:
aoqi@0 2032 return "move";
aoqi@0 2033 case lir_move_unaligned:
aoqi@0 2034 return "unaligned move";
aoqi@0 2035 case lir_move_volatile:
aoqi@0 2036 return "volatile_move";
aoqi@0 2037 case lir_move_wide:
aoqi@0 2038 return "wide_move";
aoqi@0 2039 default:
aoqi@0 2040 ShouldNotReachHere();
aoqi@0 2041 return "illegal_op";
aoqi@0 2042 }
aoqi@0 2043 } else {
aoqi@0 2044 return LIR_Op::name();
aoqi@0 2045 }
aoqi@0 2046 }
aoqi@0 2047
aoqi@0 2048
aoqi@0 2049 void LIR_Op1::print_instr(outputStream* out) const {
aoqi@0 2050 _opr->print(out); out->print(" ");
aoqi@0 2051 result_opr()->print(out); out->print(" ");
aoqi@0 2052 print_patch_code(out, patch_code());
aoqi@0 2053 }
aoqi@0 2054
aoqi@0 2055
aoqi@0 2056 // LIR_Op1
aoqi@0 2057 void LIR_OpRTCall::print_instr(outputStream* out) const {
aoqi@0 2058 intx a = (intx)addr();
aoqi@0 2059 out->print("%s", Runtime1::name_for_address(addr()));
aoqi@0 2060 out->print(" ");
aoqi@0 2061 tmp()->print(out);
aoqi@0 2062 }
aoqi@0 2063
aoqi@0 2064 void LIR_Op1::print_patch_code(outputStream* out, LIR_PatchCode code) {
aoqi@0 2065 switch(code) {
aoqi@0 2066 case lir_patch_none: break;
aoqi@0 2067 case lir_patch_low: out->print("[patch_low]"); break;
aoqi@0 2068 case lir_patch_high: out->print("[patch_high]"); break;
aoqi@0 2069 case lir_patch_normal: out->print("[patch_normal]"); break;
aoqi@0 2070 default: ShouldNotReachHere();
aoqi@0 2071 }
aoqi@0 2072 }
aoqi@0 2073
aoqi@0 2074 // LIR_OpBranch
aoqi@0 2075 void LIR_OpBranch::print_instr(outputStream* out) const {
aoqi@0 2076 print_condition(out, cond()); out->print(" ");
fujie@9138 2077 #ifdef MIPS
aoqi@1 2078 in_opr1()->print(out); out->print(" ");
aoqi@1 2079 in_opr2()->print(out); out->print(" ");
aoqi@1 2080 #endif
aoqi@0 2081 if (block() != NULL) {
aoqi@0 2082 out->print("[B%d] ", block()->block_id());
aoqi@0 2083 } else if (stub() != NULL) {
aoqi@0 2084 out->print("[");
aoqi@0 2085 stub()->print_name(out);
aoqi@0 2086 out->print(": " INTPTR_FORMAT "]", p2i(stub()));
aoqi@0 2087 if (stub()->info() != NULL) out->print(" [bci:%d]", stub()->info()->stack()->bci());
aoqi@0 2088 } else {
aoqi@0 2089 out->print("[label:" INTPTR_FORMAT "] ", p2i(label()));
aoqi@0 2090 }
aoqi@0 2091 if (ublock() != NULL) {
aoqi@0 2092 out->print("unordered: [B%d] ", ublock()->block_id());
aoqi@0 2093 }
aoqi@0 2094 }
aoqi@0 2095
aoqi@0 2096 void LIR_Op::print_condition(outputStream* out, LIR_Condition cond) {
aoqi@0 2097 switch(cond) {
aoqi@0 2098 case lir_cond_equal: out->print("[EQ]"); break;
aoqi@0 2099 case lir_cond_notEqual: out->print("[NE]"); break;
aoqi@0 2100 case lir_cond_less: out->print("[LT]"); break;
aoqi@0 2101 case lir_cond_lessEqual: out->print("[LE]"); break;
aoqi@0 2102 case lir_cond_greaterEqual: out->print("[GE]"); break;
aoqi@0 2103 case lir_cond_greater: out->print("[GT]"); break;
aoqi@0 2104 case lir_cond_belowEqual: out->print("[BE]"); break;
aoqi@0 2105 case lir_cond_aboveEqual: out->print("[AE]"); break;
aoqi@0 2106 case lir_cond_always: out->print("[AL]"); break;
aoqi@0 2107 default: out->print("[%d]",cond); break;
aoqi@0 2108 }
aoqi@0 2109 }
aoqi@0 2110
aoqi@0 2111 // LIR_OpConvert
aoqi@0 2112 void LIR_OpConvert::print_instr(outputStream* out) const {
aoqi@0 2113 print_bytecode(out, bytecode());
aoqi@0 2114 in_opr()->print(out); out->print(" ");
aoqi@0 2115 result_opr()->print(out); out->print(" ");
aoqi@0 2116 #ifdef PPC
aoqi@0 2117 if(tmp1()->is_valid()) {
aoqi@0 2118 tmp1()->print(out); out->print(" ");
aoqi@0 2119 tmp2()->print(out); out->print(" ");
aoqi@0 2120 }
aoqi@0 2121 #endif
aoqi@0 2122 }
aoqi@0 2123
aoqi@0 2124 void LIR_OpConvert::print_bytecode(outputStream* out, Bytecodes::Code code) {
aoqi@0 2125 switch(code) {
aoqi@0 2126 case Bytecodes::_d2f: out->print("[d2f] "); break;
aoqi@0 2127 case Bytecodes::_d2i: out->print("[d2i] "); break;
aoqi@0 2128 case Bytecodes::_d2l: out->print("[d2l] "); break;
aoqi@0 2129 case Bytecodes::_f2d: out->print("[f2d] "); break;
aoqi@0 2130 case Bytecodes::_f2i: out->print("[f2i] "); break;
aoqi@0 2131 case Bytecodes::_f2l: out->print("[f2l] "); break;
aoqi@0 2132 case Bytecodes::_i2b: out->print("[i2b] "); break;
aoqi@0 2133 case Bytecodes::_i2c: out->print("[i2c] "); break;
aoqi@0 2134 case Bytecodes::_i2d: out->print("[i2d] "); break;
aoqi@0 2135 case Bytecodes::_i2f: out->print("[i2f] "); break;
aoqi@0 2136 case Bytecodes::_i2l: out->print("[i2l] "); break;
aoqi@0 2137 case Bytecodes::_i2s: out->print("[i2s] "); break;
aoqi@0 2138 case Bytecodes::_l2i: out->print("[l2i] "); break;
aoqi@0 2139 case Bytecodes::_l2f: out->print("[l2f] "); break;
aoqi@0 2140 case Bytecodes::_l2d: out->print("[l2d] "); break;
aoqi@0 2141 default:
aoqi@0 2142 out->print("[?%d]",code);
aoqi@0 2143 break;
aoqi@0 2144 }
aoqi@0 2145 }
aoqi@0 2146
aoqi@0 2147 void LIR_OpAllocObj::print_instr(outputStream* out) const {
aoqi@0 2148 klass()->print(out); out->print(" ");
aoqi@0 2149 obj()->print(out); out->print(" ");
aoqi@0 2150 tmp1()->print(out); out->print(" ");
aoqi@0 2151 tmp2()->print(out); out->print(" ");
aoqi@0 2152 tmp3()->print(out); out->print(" ");
aoqi@0 2153 tmp4()->print(out); out->print(" ");
fujie@9138 2154 #ifdef MIPS
aoqi@1 2155 tmp5()->print(out); out->print(" ");
aoqi@1 2156 tmp6()->print(out); out->print(" ");
aoqi@1 2157 #endif
aoqi@0 2158 out->print("[hdr:%d]", header_size()); out->print(" ");
aoqi@0 2159 out->print("[obj:%d]", object_size()); out->print(" ");
aoqi@0 2160 out->print("[lbl:" INTPTR_FORMAT "]", p2i(stub()->entry()));
aoqi@0 2161 }
aoqi@0 2162
aoqi@0 2163 void LIR_OpRoundFP::print_instr(outputStream* out) const {
aoqi@0 2164 _opr->print(out); out->print(" ");
aoqi@0 2165 tmp()->print(out); out->print(" ");
aoqi@0 2166 result_opr()->print(out); out->print(" ");
aoqi@0 2167 }
aoqi@0 2168
aoqi@0 2169 // LIR_Op2
aoqi@0 2170 void LIR_Op2::print_instr(outputStream* out) const {
fujie@9138 2171 #ifndef MIPS
aoqi@0 2172 if (code() == lir_cmove) {
aoqi@0 2173 print_condition(out, condition()); out->print(" ");
aoqi@0 2174 }
aoqi@1 2175 #endif
aoqi@0 2176 in_opr1()->print(out); out->print(" ");
aoqi@0 2177 in_opr2()->print(out); out->print(" ");
aoqi@0 2178 if (tmp1_opr()->is_valid()) { tmp1_opr()->print(out); out->print(" "); }
aoqi@0 2179 if (tmp2_opr()->is_valid()) { tmp2_opr()->print(out); out->print(" "); }
aoqi@0 2180 if (tmp3_opr()->is_valid()) { tmp3_opr()->print(out); out->print(" "); }
aoqi@0 2181 if (tmp4_opr()->is_valid()) { tmp4_opr()->print(out); out->print(" "); }
aoqi@0 2182 if (tmp5_opr()->is_valid()) { tmp5_opr()->print(out); out->print(" "); }
aoqi@0 2183 result_opr()->print(out);
aoqi@0 2184 }
aoqi@0 2185
aoqi@0 2186 void LIR_OpAllocArray::print_instr(outputStream* out) const {
aoqi@0 2187 klass()->print(out); out->print(" ");
aoqi@0 2188 len()->print(out); out->print(" ");
aoqi@0 2189 obj()->print(out); out->print(" ");
aoqi@0 2190 tmp1()->print(out); out->print(" ");
aoqi@0 2191 tmp2()->print(out); out->print(" ");
aoqi@0 2192 tmp3()->print(out); out->print(" ");
aoqi@0 2193 tmp4()->print(out); out->print(" ");
fujie@9138 2194 #ifdef MIPS
aoqi@1 2195 tmp5()->print(out); out->print(" ");
aoqi@1 2196 #endif
aoqi@0 2197 out->print("[type:0x%x]", type()); out->print(" ");
aoqi@0 2198 out->print("[label:" INTPTR_FORMAT "]", p2i(stub()->entry()));
aoqi@0 2199 }
aoqi@0 2200
aoqi@0 2201
aoqi@0 2202 void LIR_OpTypeCheck::print_instr(outputStream* out) const {
aoqi@0 2203 object()->print(out); out->print(" ");
aoqi@0 2204 if (code() == lir_store_check) {
aoqi@0 2205 array()->print(out); out->print(" ");
aoqi@0 2206 }
aoqi@0 2207 if (code() != lir_store_check) {
aoqi@0 2208 klass()->print_name_on(out); out->print(" ");
aoqi@0 2209 if (fast_check()) out->print("fast_check ");
aoqi@0 2210 }
aoqi@0 2211 tmp1()->print(out); out->print(" ");
aoqi@0 2212 tmp2()->print(out); out->print(" ");
aoqi@0 2213 tmp3()->print(out); out->print(" ");
aoqi@0 2214 result_opr()->print(out); out->print(" ");
aoqi@0 2215 if (info_for_exception() != NULL) out->print(" [bci:%d]", info_for_exception()->stack()->bci());
aoqi@0 2216 }
aoqi@0 2217
aoqi@0 2218
aoqi@0 2219 // LIR_Op3
aoqi@0 2220 void LIR_Op3::print_instr(outputStream* out) const {
aoqi@0 2221 in_opr1()->print(out); out->print(" ");
aoqi@0 2222 in_opr2()->print(out); out->print(" ");
aoqi@0 2223 in_opr3()->print(out); out->print(" ");
aoqi@0 2224 result_opr()->print(out);
aoqi@0 2225 }
aoqi@0 2226
aoqi@0 2227
aoqi@0 2228 void LIR_OpLock::print_instr(outputStream* out) const {
aoqi@0 2229 hdr_opr()->print(out); out->print(" ");
aoqi@0 2230 obj_opr()->print(out); out->print(" ");
aoqi@0 2231 lock_opr()->print(out); out->print(" ");
aoqi@0 2232 if (_scratch->is_valid()) {
aoqi@0 2233 _scratch->print(out); out->print(" ");
aoqi@0 2234 }
aoqi@0 2235 out->print("[lbl:" INTPTR_FORMAT "]", p2i(stub()->entry()));
aoqi@0 2236 }
aoqi@0 2237
aoqi@0 2238 #ifdef ASSERT
aoqi@0 2239 void LIR_OpAssert::print_instr(outputStream* out) const {
aoqi@1 2240 tty->print_cr("function LIR_OpAssert::print_instr unimplemented yet! ");
aoqi@1 2241 Unimplemented();
aoqi@1 2242 /*
aoqi@0 2243 print_condition(out, condition()); out->print(" ");
aoqi@0 2244 in_opr1()->print(out); out->print(" ");
aoqi@0 2245 in_opr2()->print(out); out->print(", \"");
aoqi@0 2246 out->print("%s", msg()); out->print("\"");
aoqi@1 2247 */
aoqi@0 2248 }
aoqi@0 2249 #endif
aoqi@0 2250
aoqi@0 2251
aoqi@0 2252 void LIR_OpDelay::print_instr(outputStream* out) const {
aoqi@0 2253 _op->print_on(out);
aoqi@0 2254 }
aoqi@0 2255
aoqi@0 2256
aoqi@0 2257 // LIR_OpProfileCall
aoqi@0 2258 void LIR_OpProfileCall::print_instr(outputStream* out) const {
aoqi@0 2259 profiled_method()->name()->print_symbol_on(out);
aoqi@0 2260 out->print(".");
aoqi@0 2261 profiled_method()->holder()->name()->print_symbol_on(out);
aoqi@0 2262 out->print(" @ %d ", profiled_bci());
aoqi@0 2263 mdo()->print(out); out->print(" ");
aoqi@0 2264 recv()->print(out); out->print(" ");
aoqi@0 2265 tmp1()->print(out); out->print(" ");
aoqi@0 2266 }
aoqi@0 2267
aoqi@0 2268 // LIR_OpProfileType
aoqi@0 2269 void LIR_OpProfileType::print_instr(outputStream* out) const {
aoqi@0 2270 out->print("exact = "); exact_klass()->print_name_on(out);
aoqi@0 2271 out->print("current = "); ciTypeEntries::print_ciklass(out, current_klass());
aoqi@0 2272 mdp()->print(out); out->print(" ");
aoqi@0 2273 obj()->print(out); out->print(" ");
aoqi@0 2274 tmp()->print(out); out->print(" ");
aoqi@0 2275 }
aoqi@0 2276
aoqi@0 2277 #endif // PRODUCT
aoqi@0 2278
aoqi@0 2279 // Implementation of LIR_InsertionBuffer
aoqi@0 2280
aoqi@0 2281 void LIR_InsertionBuffer::append(int index, LIR_Op* op) {
aoqi@0 2282 assert(_index_and_count.length() % 2 == 0, "must have a count for each index");
aoqi@0 2283
aoqi@0 2284 int i = number_of_insertion_points() - 1;
aoqi@0 2285 if (i < 0 || index_at(i) < index) {
aoqi@0 2286 append_new(index, 1);
aoqi@0 2287 } else {
aoqi@0 2288 assert(index_at(i) == index, "can append LIR_Ops in ascending order only");
aoqi@0 2289 assert(count_at(i) > 0, "check");
aoqi@0 2290 set_count_at(i, count_at(i) + 1);
aoqi@0 2291 }
aoqi@0 2292 _ops.push(op);
aoqi@0 2293
aoqi@0 2294 DEBUG_ONLY(verify());
aoqi@0 2295 }
aoqi@0 2296
aoqi@0 2297 #ifdef ASSERT
aoqi@0 2298 void LIR_InsertionBuffer::verify() {
aoqi@0 2299 int sum = 0;
aoqi@0 2300 int prev_idx = -1;
aoqi@0 2301
aoqi@0 2302 for (int i = 0; i < number_of_insertion_points(); i++) {
aoqi@0 2303 assert(prev_idx < index_at(i), "index must be ordered ascending");
aoqi@0 2304 sum += count_at(i);
aoqi@0 2305 }
aoqi@0 2306 assert(sum == number_of_ops(), "wrong total sum");
aoqi@0 2307 }
aoqi@0 2308 #endif

mercurial