src/share/vm/c1/c1_Instruction.cpp

Tue, 18 Jun 2013 12:31:07 -0700

author
johnc
date
Tue, 18 Jun 2013 12:31:07 -0700
changeset 5277
01522ca68fc7
parent 4860
46f6f063b272
child 5914
d13d7aba8c12
permissions
-rw-r--r--

8015237: Parallelize string table scanning during strong root processing
Summary: Parallelize the scanning of the intern string table by having each GC worker claim a given number of buckets. Changes were also reviewed by Per Liden <per.liden@oracle.com>.
Reviewed-by: tschatzl, stefank, twisti

duke@435 1 /*
coleenp@4037 2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
stefank@2314 26 #include "c1/c1_IR.hpp"
stefank@2314 27 #include "c1/c1_Instruction.hpp"
stefank@2314 28 #include "c1/c1_InstructionPrinter.hpp"
stefank@2314 29 #include "c1/c1_ValueStack.hpp"
stefank@2314 30 #include "ci/ciObjArrayKlass.hpp"
stefank@2314 31 #include "ci/ciTypeArrayKlass.hpp"
duke@435 32
duke@435 33
duke@435 34 // Implementation of Instruction
duke@435 35
duke@435 36
roland@4860 37 int Instruction::dominator_depth() {
roland@4860 38 int result = -1;
roland@4860 39 if (block()) {
roland@4860 40 result = block()->dominator_depth();
roland@4860 41 }
roland@4860 42 assert(result != -1 || this->as_Local(), "Only locals have dominator depth -1");
roland@4860 43 return result;
roland@4860 44 }
roland@4860 45
duke@435 46 Instruction::Condition Instruction::mirror(Condition cond) {
duke@435 47 switch (cond) {
duke@435 48 case eql: return eql;
duke@435 49 case neq: return neq;
duke@435 50 case lss: return gtr;
duke@435 51 case leq: return geq;
duke@435 52 case gtr: return lss;
duke@435 53 case geq: return leq;
roland@4860 54 case aeq: return beq;
roland@4860 55 case beq: return aeq;
duke@435 56 }
duke@435 57 ShouldNotReachHere();
duke@435 58 return eql;
duke@435 59 }
duke@435 60
duke@435 61
duke@435 62 Instruction::Condition Instruction::negate(Condition cond) {
duke@435 63 switch (cond) {
duke@435 64 case eql: return neq;
duke@435 65 case neq: return eql;
duke@435 66 case lss: return geq;
duke@435 67 case leq: return gtr;
duke@435 68 case gtr: return leq;
duke@435 69 case geq: return lss;
roland@4860 70 case aeq: assert(false, "Above equal cannot be negated");
roland@4860 71 case beq: assert(false, "Below equal cannot be negated");
duke@435 72 }
duke@435 73 ShouldNotReachHere();
duke@435 74 return eql;
duke@435 75 }
duke@435 76
roland@2174 77 void Instruction::update_exception_state(ValueStack* state) {
roland@2174 78 if (state != NULL && (state->kind() == ValueStack::EmptyExceptionState || state->kind() == ValueStack::ExceptionState)) {
roland@2174 79 assert(state->kind() == ValueStack::EmptyExceptionState || Compilation::current()->env()->jvmti_can_access_local_variables(), "unexpected state kind");
roland@2174 80 _exception_state = state;
roland@2174 81 } else {
roland@2174 82 _exception_state = NULL;
roland@2174 83 }
roland@2174 84 }
roland@2174 85
roland@4860 86 // Prev without need to have BlockBegin
roland@4860 87 Instruction* Instruction::prev() {
duke@435 88 Instruction* p = NULL;
roland@4860 89 Instruction* q = block();
duke@435 90 while (q != this) {
duke@435 91 assert(q != NULL, "this is not in the block's instruction list");
duke@435 92 p = q; q = q->next();
duke@435 93 }
duke@435 94 return p;
duke@435 95 }
duke@435 96
duke@435 97
roland@2174 98 void Instruction::state_values_do(ValueVisitor* f) {
roland@2174 99 if (state_before() != NULL) {
roland@2174 100 state_before()->values_do(f);
roland@2174 101 }
roland@2174 102 if (exception_state() != NULL){
roland@2174 103 exception_state()->values_do(f);
roland@2174 104 }
roland@2174 105 }
roland@2174 106
roland@2174 107
duke@435 108 #ifndef PRODUCT
roland@2174 109 void Instruction::check_state(ValueStack* state) {
roland@2174 110 if (state != NULL) {
roland@2174 111 state->verify();
roland@2174 112 }
roland@2174 113 }
roland@2174 114
roland@2174 115
duke@435 116 void Instruction::print() {
duke@435 117 InstructionPrinter ip;
duke@435 118 print(ip);
duke@435 119 }
duke@435 120
duke@435 121
duke@435 122 void Instruction::print_line() {
duke@435 123 InstructionPrinter ip;
duke@435 124 ip.print_line(this);
duke@435 125 }
duke@435 126
duke@435 127
duke@435 128 void Instruction::print(InstructionPrinter& ip) {
duke@435 129 ip.print_head();
duke@435 130 ip.print_line(this);
duke@435 131 tty->cr();
duke@435 132 }
duke@435 133 #endif // PRODUCT
duke@435 134
duke@435 135
duke@435 136 // perform constant and interval tests on index value
duke@435 137 bool AccessIndexed::compute_needs_range_check() {
roland@4860 138
roland@4860 139 if (length()) {
roland@4860 140
roland@4860 141 Constant* clength = length()->as_Constant();
roland@4860 142 Constant* cindex = index()->as_Constant();
roland@4860 143 if (clength && cindex) {
roland@4860 144 IntConstant* l = clength->type()->as_IntConstant();
roland@4860 145 IntConstant* i = cindex->type()->as_IntConstant();
roland@4860 146 if (l && i && i->value() < l->value() && i->value() >= 0) {
roland@4860 147 return false;
roland@4860 148 }
duke@435 149 }
duke@435 150 }
roland@4860 151
roland@4860 152 if (!this->check_flag(NeedsRangeCheckFlag)) {
roland@4860 153 return false;
roland@4860 154 }
roland@4860 155
duke@435 156 return true;
duke@435 157 }
duke@435 158
duke@435 159
roland@2728 160 ciType* Local::exact_type() const {
roland@2728 161 ciType* type = declared_type();
roland@2728 162
roland@2728 163 // for primitive arrays, the declared type is the exact type
roland@2728 164 if (type->is_type_array_klass()) {
roland@2728 165 return type;
roland@2728 166 } else if (type->is_instance_klass()) {
roland@2728 167 ciInstanceKlass* ik = (ciInstanceKlass*)type;
roland@2728 168 if (ik->is_loaded() && ik->is_final() && !ik->is_interface()) {
roland@2728 169 return type;
roland@2728 170 }
roland@2728 171 } else if (type->is_obj_array_klass()) {
roland@2728 172 ciObjArrayKlass* oak = (ciObjArrayKlass*)type;
roland@2728 173 ciType* base = oak->base_element_type();
roland@2728 174 if (base->is_instance_klass()) {
roland@2728 175 ciInstanceKlass* ik = base->as_instance_klass();
roland@2728 176 if (ik->is_loaded() && ik->is_final()) {
roland@2728 177 return type;
roland@2728 178 }
roland@2728 179 } else if (base->is_primitive_type()) {
roland@2728 180 return type;
roland@2728 181 }
roland@2728 182 }
roland@2728 183 return NULL;
roland@2728 184 }
roland@2728 185
twisti@3969 186 ciType* Constant::exact_type() const {
twisti@3969 187 if (type()->is_object()) {
twisti@3969 188 return type()->as_ObjectType()->exact_type();
twisti@3969 189 }
twisti@3969 190 return NULL;
twisti@3969 191 }
roland@2728 192
duke@435 193 ciType* LoadIndexed::exact_type() const {
duke@435 194 ciType* array_type = array()->exact_type();
duke@435 195 if (array_type == NULL) {
duke@435 196 return NULL;
duke@435 197 }
duke@435 198 assert(array_type->is_array_klass(), "what else?");
duke@435 199 ciArrayKlass* ak = (ciArrayKlass*)array_type;
duke@435 200
duke@435 201 if (ak->element_type()->is_instance_klass()) {
duke@435 202 ciInstanceKlass* ik = (ciInstanceKlass*)ak->element_type();
duke@435 203 if (ik->is_loaded() && ik->is_final()) {
duke@435 204 return ik;
duke@435 205 }
duke@435 206 }
duke@435 207 return NULL;
duke@435 208 }
duke@435 209
duke@435 210
duke@435 211 ciType* LoadIndexed::declared_type() const {
duke@435 212 ciType* array_type = array()->declared_type();
roland@4536 213 if (array_type == NULL || !array_type->is_loaded()) {
duke@435 214 return NULL;
duke@435 215 }
duke@435 216 assert(array_type->is_array_klass(), "what else?");
duke@435 217 ciArrayKlass* ak = (ciArrayKlass*)array_type;
duke@435 218 return ak->element_type();
duke@435 219 }
duke@435 220
duke@435 221
duke@435 222 ciType* LoadField::declared_type() const {
duke@435 223 return field()->type();
duke@435 224 }
duke@435 225
duke@435 226
duke@435 227 ciType* LoadField::exact_type() const {
duke@435 228 ciType* type = declared_type();
duke@435 229 // for primitive arrays, the declared type is the exact type
duke@435 230 if (type->is_type_array_klass()) {
duke@435 231 return type;
duke@435 232 }
duke@435 233 if (type->is_instance_klass()) {
duke@435 234 ciInstanceKlass* ik = (ciInstanceKlass*)type;
duke@435 235 if (ik->is_loaded() && ik->is_final()) {
duke@435 236 return type;
duke@435 237 }
duke@435 238 }
duke@435 239 return NULL;
duke@435 240 }
duke@435 241
duke@435 242
duke@435 243 ciType* NewTypeArray::exact_type() const {
duke@435 244 return ciTypeArrayKlass::make(elt_type());
duke@435 245 }
duke@435 246
duke@435 247 ciType* NewObjectArray::exact_type() const {
duke@435 248 return ciObjArrayKlass::make(klass());
duke@435 249 }
duke@435 250
roland@2728 251 ciType* NewArray::declared_type() const {
roland@2728 252 return exact_type();
roland@2728 253 }
duke@435 254
duke@435 255 ciType* NewInstance::exact_type() const {
duke@435 256 return klass();
duke@435 257 }
duke@435 258
roland@2728 259 ciType* NewInstance::declared_type() const {
roland@2728 260 return exact_type();
roland@2728 261 }
duke@435 262
duke@435 263 ciType* CheckCast::declared_type() const {
duke@435 264 return klass();
duke@435 265 }
duke@435 266
duke@435 267 ciType* CheckCast::exact_type() const {
duke@435 268 if (klass()->is_instance_klass()) {
duke@435 269 ciInstanceKlass* ik = (ciInstanceKlass*)klass();
duke@435 270 if (ik->is_loaded() && ik->is_final()) {
duke@435 271 return ik;
duke@435 272 }
duke@435 273 }
duke@435 274 return NULL;
duke@435 275 }
duke@435 276
duke@435 277 // Implementation of ArithmeticOp
duke@435 278
duke@435 279 bool ArithmeticOp::is_commutative() const {
duke@435 280 switch (op()) {
duke@435 281 case Bytecodes::_iadd: // fall through
duke@435 282 case Bytecodes::_ladd: // fall through
duke@435 283 case Bytecodes::_fadd: // fall through
duke@435 284 case Bytecodes::_dadd: // fall through
duke@435 285 case Bytecodes::_imul: // fall through
duke@435 286 case Bytecodes::_lmul: // fall through
duke@435 287 case Bytecodes::_fmul: // fall through
duke@435 288 case Bytecodes::_dmul: return true;
duke@435 289 }
duke@435 290 return false;
duke@435 291 }
duke@435 292
duke@435 293
duke@435 294 bool ArithmeticOp::can_trap() const {
duke@435 295 switch (op()) {
duke@435 296 case Bytecodes::_idiv: // fall through
duke@435 297 case Bytecodes::_ldiv: // fall through
duke@435 298 case Bytecodes::_irem: // fall through
duke@435 299 case Bytecodes::_lrem: return true;
duke@435 300 }
duke@435 301 return false;
duke@435 302 }
duke@435 303
duke@435 304
duke@435 305 // Implementation of LogicOp
duke@435 306
duke@435 307 bool LogicOp::is_commutative() const {
duke@435 308 #ifdef ASSERT
duke@435 309 switch (op()) {
duke@435 310 case Bytecodes::_iand: // fall through
duke@435 311 case Bytecodes::_land: // fall through
duke@435 312 case Bytecodes::_ior : // fall through
duke@435 313 case Bytecodes::_lor : // fall through
duke@435 314 case Bytecodes::_ixor: // fall through
duke@435 315 case Bytecodes::_lxor: break;
duke@435 316 default : ShouldNotReachHere();
duke@435 317 }
duke@435 318 #endif
duke@435 319 // all LogicOps are commutative
duke@435 320 return true;
duke@435 321 }
duke@435 322
duke@435 323
duke@435 324 // Implementation of IfOp
duke@435 325
duke@435 326 bool IfOp::is_commutative() const {
duke@435 327 return cond() == eql || cond() == neq;
duke@435 328 }
duke@435 329
duke@435 330
duke@435 331 // Implementation of StateSplit
duke@435 332
duke@435 333 void StateSplit::substitute(BlockList& list, BlockBegin* old_block, BlockBegin* new_block) {
duke@435 334 NOT_PRODUCT(bool assigned = false;)
duke@435 335 for (int i = 0; i < list.length(); i++) {
duke@435 336 BlockBegin** b = list.adr_at(i);
duke@435 337 if (*b == old_block) {
duke@435 338 *b = new_block;
duke@435 339 NOT_PRODUCT(assigned = true;)
duke@435 340 }
duke@435 341 }
duke@435 342 assert(assigned == true, "should have assigned at least once");
duke@435 343 }
duke@435 344
duke@435 345
duke@435 346 IRScope* StateSplit::scope() const {
duke@435 347 return _state->scope();
duke@435 348 }
duke@435 349
duke@435 350
iveresov@1939 351 void StateSplit::state_values_do(ValueVisitor* f) {
roland@2174 352 Instruction::state_values_do(f);
duke@435 353 if (state() != NULL) state()->values_do(f);
duke@435 354 }
duke@435 355
duke@435 356
iveresov@1939 357 void BlockBegin::state_values_do(ValueVisitor* f) {
duke@435 358 StateSplit::state_values_do(f);
duke@435 359
duke@435 360 if (is_set(BlockBegin::exception_entry_flag)) {
duke@435 361 for (int i = 0; i < number_of_exception_states(); i++) {
duke@435 362 exception_state_at(i)->values_do(f);
duke@435 363 }
duke@435 364 }
duke@435 365 }
duke@435 366
duke@435 367
duke@435 368 // Implementation of Invoke
duke@435 369
duke@435 370
duke@435 371 Invoke::Invoke(Bytecodes::Code code, ValueType* result_type, Value recv, Values* args,
twisti@1730 372 int vtable_index, ciMethod* target, ValueStack* state_before)
roland@2174 373 : StateSplit(result_type, state_before)
duke@435 374 , _code(code)
duke@435 375 , _recv(recv)
duke@435 376 , _args(args)
duke@435 377 , _vtable_index(vtable_index)
duke@435 378 , _target(target)
duke@435 379 {
duke@435 380 set_flag(TargetIsLoadedFlag, target->is_loaded());
duke@435 381 set_flag(TargetIsFinalFlag, target_is_loaded() && target->is_final_method());
duke@435 382 set_flag(TargetIsStrictfpFlag, target_is_loaded() && target->is_strict());
duke@435 383
duke@435 384 assert(args != NULL, "args must exist");
duke@435 385 #ifdef ASSERT
iveresov@1939 386 AssertValues assert_value;
iveresov@1939 387 values_do(&assert_value);
iveresov@1939 388 #endif
duke@435 389
duke@435 390 // provide an initial guess of signature size.
duke@435 391 _signature = new BasicTypeList(number_of_arguments() + (has_receiver() ? 1 : 0));
duke@435 392 if (has_receiver()) {
duke@435 393 _signature->append(as_BasicType(receiver()->type()));
duke@435 394 }
duke@435 395 for (int i = 0; i < number_of_arguments(); i++) {
duke@435 396 ValueType* t = argument_at(i)->type();
duke@435 397 BasicType bt = as_BasicType(t);
duke@435 398 _signature->append(bt);
duke@435 399 }
duke@435 400 }
duke@435 401
duke@435 402
iveresov@1939 403 void Invoke::state_values_do(ValueVisitor* f) {
twisti@1730 404 StateSplit::state_values_do(f);
twisti@1730 405 if (state_before() != NULL) state_before()->values_do(f);
twisti@1730 406 if (state() != NULL) state()->values_do(f);
twisti@1730 407 }
twisti@1730 408
roland@2728 409 ciType* Invoke::declared_type() const {
roland@2728 410 ciType *t = _target->signature()->return_type();
roland@2728 411 assert(t->basic_type() != T_VOID, "need return value of void method?");
roland@2728 412 return t;
roland@2728 413 }
twisti@1730 414
duke@435 415 // Implementation of Contant
duke@435 416 intx Constant::hash() const {
roland@2174 417 if (state_before() == NULL) {
duke@435 418 switch (type()->tag()) {
duke@435 419 case intTag:
duke@435 420 return HASH2(name(), type()->as_IntConstant()->value());
coleenp@4037 421 case addressTag:
coleenp@4037 422 return HASH2(name(), type()->as_AddressConstant()->value());
duke@435 423 case longTag:
duke@435 424 {
duke@435 425 jlong temp = type()->as_LongConstant()->value();
duke@435 426 return HASH3(name(), high(temp), low(temp));
duke@435 427 }
duke@435 428 case floatTag:
duke@435 429 return HASH2(name(), jint_cast(type()->as_FloatConstant()->value()));
duke@435 430 case doubleTag:
duke@435 431 {
duke@435 432 jlong temp = jlong_cast(type()->as_DoubleConstant()->value());
duke@435 433 return HASH3(name(), high(temp), low(temp));
duke@435 434 }
duke@435 435 case objectTag:
duke@435 436 assert(type()->as_ObjectType()->is_loaded(), "can't handle unloaded values");
duke@435 437 return HASH2(name(), type()->as_ObjectType()->constant_value());
coleenp@4037 438 case metaDataTag:
coleenp@4037 439 assert(type()->as_MetadataType()->is_loaded(), "can't handle unloaded values");
coleenp@4037 440 return HASH2(name(), type()->as_MetadataType()->constant_value());
coleenp@4037 441 default:
coleenp@4037 442 ShouldNotReachHere();
duke@435 443 }
duke@435 444 }
duke@435 445 return 0;
duke@435 446 }
duke@435 447
duke@435 448 bool Constant::is_equal(Value v) const {
duke@435 449 if (v->as_Constant() == NULL) return false;
duke@435 450
duke@435 451 switch (type()->tag()) {
duke@435 452 case intTag:
duke@435 453 {
duke@435 454 IntConstant* t1 = type()->as_IntConstant();
duke@435 455 IntConstant* t2 = v->type()->as_IntConstant();
duke@435 456 return (t1 != NULL && t2 != NULL &&
duke@435 457 t1->value() == t2->value());
duke@435 458 }
duke@435 459 case longTag:
duke@435 460 {
duke@435 461 LongConstant* t1 = type()->as_LongConstant();
duke@435 462 LongConstant* t2 = v->type()->as_LongConstant();
duke@435 463 return (t1 != NULL && t2 != NULL &&
duke@435 464 t1->value() == t2->value());
duke@435 465 }
duke@435 466 case floatTag:
duke@435 467 {
duke@435 468 FloatConstant* t1 = type()->as_FloatConstant();
duke@435 469 FloatConstant* t2 = v->type()->as_FloatConstant();
duke@435 470 return (t1 != NULL && t2 != NULL &&
duke@435 471 jint_cast(t1->value()) == jint_cast(t2->value()));
duke@435 472 }
duke@435 473 case doubleTag:
duke@435 474 {
duke@435 475 DoubleConstant* t1 = type()->as_DoubleConstant();
duke@435 476 DoubleConstant* t2 = v->type()->as_DoubleConstant();
duke@435 477 return (t1 != NULL && t2 != NULL &&
duke@435 478 jlong_cast(t1->value()) == jlong_cast(t2->value()));
duke@435 479 }
duke@435 480 case objectTag:
duke@435 481 {
duke@435 482 ObjectType* t1 = type()->as_ObjectType();
duke@435 483 ObjectType* t2 = v->type()->as_ObjectType();
duke@435 484 return (t1 != NULL && t2 != NULL &&
duke@435 485 t1->is_loaded() && t2->is_loaded() &&
duke@435 486 t1->constant_value() == t2->constant_value());
duke@435 487 }
coleenp@4037 488 case metaDataTag:
coleenp@4037 489 {
coleenp@4037 490 MetadataType* t1 = type()->as_MetadataType();
coleenp@4037 491 MetadataType* t2 = v->type()->as_MetadataType();
coleenp@4037 492 return (t1 != NULL && t2 != NULL &&
coleenp@4037 493 t1->is_loaded() && t2->is_loaded() &&
coleenp@4037 494 t1->constant_value() == t2->constant_value());
coleenp@4037 495 }
duke@435 496 }
duke@435 497 return false;
duke@435 498 }
duke@435 499
roland@2254 500 Constant::CompareResult Constant::compare(Instruction::Condition cond, Value right) const {
duke@435 501 Constant* rc = right->as_Constant();
duke@435 502 // other is not a constant
roland@2254 503 if (rc == NULL) return not_comparable;
duke@435 504
duke@435 505 ValueType* lt = type();
duke@435 506 ValueType* rt = rc->type();
duke@435 507 // different types
roland@2254 508 if (lt->base() != rt->base()) return not_comparable;
duke@435 509 switch (lt->tag()) {
duke@435 510 case intTag: {
duke@435 511 int x = lt->as_IntConstant()->value();
duke@435 512 int y = rt->as_IntConstant()->value();
duke@435 513 switch (cond) {
roland@2254 514 case If::eql: return x == y ? cond_true : cond_false;
roland@2254 515 case If::neq: return x != y ? cond_true : cond_false;
roland@2254 516 case If::lss: return x < y ? cond_true : cond_false;
roland@2254 517 case If::leq: return x <= y ? cond_true : cond_false;
roland@2254 518 case If::gtr: return x > y ? cond_true : cond_false;
roland@2254 519 case If::geq: return x >= y ? cond_true : cond_false;
duke@435 520 }
duke@435 521 break;
duke@435 522 }
duke@435 523 case longTag: {
duke@435 524 jlong x = lt->as_LongConstant()->value();
duke@435 525 jlong y = rt->as_LongConstant()->value();
duke@435 526 switch (cond) {
roland@2254 527 case If::eql: return x == y ? cond_true : cond_false;
roland@2254 528 case If::neq: return x != y ? cond_true : cond_false;
roland@2254 529 case If::lss: return x < y ? cond_true : cond_false;
roland@2254 530 case If::leq: return x <= y ? cond_true : cond_false;
roland@2254 531 case If::gtr: return x > y ? cond_true : cond_false;
roland@2254 532 case If::geq: return x >= y ? cond_true : cond_false;
duke@435 533 }
duke@435 534 break;
duke@435 535 }
duke@435 536 case objectTag: {
duke@435 537 ciObject* xvalue = lt->as_ObjectType()->constant_value();
duke@435 538 ciObject* yvalue = rt->as_ObjectType()->constant_value();
duke@435 539 assert(xvalue != NULL && yvalue != NULL, "not constants");
duke@435 540 if (xvalue->is_loaded() && yvalue->is_loaded()) {
duke@435 541 switch (cond) {
roland@2254 542 case If::eql: return xvalue == yvalue ? cond_true : cond_false;
roland@2254 543 case If::neq: return xvalue != yvalue ? cond_true : cond_false;
duke@435 544 }
duke@435 545 }
duke@435 546 break;
duke@435 547 }
coleenp@4037 548 case metaDataTag: {
coleenp@4037 549 ciMetadata* xvalue = lt->as_MetadataType()->constant_value();
coleenp@4037 550 ciMetadata* yvalue = rt->as_MetadataType()->constant_value();
coleenp@4037 551 assert(xvalue != NULL && yvalue != NULL, "not constants");
coleenp@4037 552 if (xvalue->is_loaded() && yvalue->is_loaded()) {
coleenp@4037 553 switch (cond) {
coleenp@4037 554 case If::eql: return xvalue == yvalue ? cond_true : cond_false;
coleenp@4037 555 case If::neq: return xvalue != yvalue ? cond_true : cond_false;
coleenp@4037 556 }
coleenp@4037 557 }
coleenp@4037 558 break;
coleenp@4037 559 }
duke@435 560 }
roland@2254 561 return not_comparable;
duke@435 562 }
duke@435 563
duke@435 564
duke@435 565 // Implementation of BlockBegin
duke@435 566
duke@435 567 void BlockBegin::set_end(BlockEnd* end) {
duke@435 568 assert(end != NULL, "should not reset block end to NULL");
twisti@3100 569 if (end == _end) {
duke@435 570 return;
duke@435 571 }
twisti@3100 572 clear_end();
duke@435 573
twisti@3100 574 // Set the new end
duke@435 575 _end = end;
duke@435 576
duke@435 577 _successors.clear();
duke@435 578 // Now reset successors list based on BlockEnd
twisti@3100 579 for (int i = 0; i < end->number_of_sux(); i++) {
duke@435 580 BlockBegin* sux = end->sux_at(i);
duke@435 581 _successors.append(sux);
duke@435 582 sux->_predecessors.append(this);
duke@435 583 }
duke@435 584 _end->set_begin(this);
duke@435 585 }
duke@435 586
duke@435 587
twisti@3100 588 void BlockBegin::clear_end() {
twisti@3100 589 // Must make the predecessors/successors match up with the
twisti@3100 590 // BlockEnd's notion.
twisti@3100 591 if (_end != NULL) {
twisti@3100 592 // disconnect from the old end
twisti@3100 593 _end->set_begin(NULL);
twisti@3100 594
twisti@3100 595 // disconnect this block from it's current successors
twisti@3100 596 for (int i = 0; i < _successors.length(); i++) {
twisti@3100 597 _successors.at(i)->remove_predecessor(this);
twisti@3100 598 }
twisti@3100 599 _end = NULL;
twisti@3100 600 }
twisti@3100 601 }
twisti@3100 602
twisti@3100 603
duke@435 604 void BlockBegin::disconnect_edge(BlockBegin* from, BlockBegin* to) {
duke@435 605 // disconnect any edges between from and to
duke@435 606 #ifndef PRODUCT
duke@435 607 if (PrintIR && Verbose) {
duke@435 608 tty->print_cr("Disconnected edge B%d -> B%d", from->block_id(), to->block_id());
duke@435 609 }
duke@435 610 #endif
duke@435 611 for (int s = 0; s < from->number_of_sux();) {
duke@435 612 BlockBegin* sux = from->sux_at(s);
duke@435 613 if (sux == to) {
duke@435 614 int index = sux->_predecessors.index_of(from);
duke@435 615 if (index >= 0) {
duke@435 616 sux->_predecessors.remove_at(index);
duke@435 617 }
duke@435 618 from->_successors.remove_at(s);
duke@435 619 } else {
duke@435 620 s++;
duke@435 621 }
duke@435 622 }
duke@435 623 }
duke@435 624
duke@435 625
duke@435 626 void BlockBegin::disconnect_from_graph() {
duke@435 627 // disconnect this block from all other blocks
duke@435 628 for (int p = 0; p < number_of_preds(); p++) {
duke@435 629 pred_at(p)->remove_successor(this);
duke@435 630 }
duke@435 631 for (int s = 0; s < number_of_sux(); s++) {
duke@435 632 sux_at(s)->remove_predecessor(this);
duke@435 633 }
duke@435 634 }
duke@435 635
duke@435 636 void BlockBegin::substitute_sux(BlockBegin* old_sux, BlockBegin* new_sux) {
duke@435 637 // modify predecessors before substituting successors
duke@435 638 for (int i = 0; i < number_of_sux(); i++) {
duke@435 639 if (sux_at(i) == old_sux) {
duke@435 640 // remove old predecessor before adding new predecessor
duke@435 641 // otherwise there is a dead predecessor in the list
duke@435 642 new_sux->remove_predecessor(old_sux);
duke@435 643 new_sux->add_predecessor(this);
duke@435 644 }
duke@435 645 }
duke@435 646 old_sux->remove_predecessor(this);
duke@435 647 end()->substitute_sux(old_sux, new_sux);
duke@435 648 }
duke@435 649
duke@435 650
duke@435 651
duke@435 652 // In general it is not possible to calculate a value for the field "depth_first_number"
duke@435 653 // of the inserted block, without recomputing the values of the other blocks
duke@435 654 // in the CFG. Therefore the value of "depth_first_number" in BlockBegin becomes meaningless.
duke@435 655 BlockBegin* BlockBegin::insert_block_between(BlockBegin* sux) {
roland@4860 656 int bci = sux->bci();
roland@4860 657 // critical edge splitting may introduce a goto after a if and array
roland@4860 658 // bound check elimination may insert a predicate between the if and
roland@4860 659 // goto. The bci of the goto can't be the one of the if otherwise
roland@4860 660 // the state and bci are inconsistent and a deoptimization triggered
roland@4860 661 // by the predicate would lead to incorrect execution/a crash.
roland@4860 662 BlockBegin* new_sux = new BlockBegin(bci);
duke@435 663
duke@435 664 // mark this block (special treatment when block order is computed)
duke@435 665 new_sux->set(critical_edge_split_flag);
duke@435 666
duke@435 667 // This goto is not a safepoint.
duke@435 668 Goto* e = new Goto(sux, false);
roland@4860 669 new_sux->set_next(e, bci);
duke@435 670 new_sux->set_end(e);
duke@435 671 // setup states
duke@435 672 ValueStack* s = end()->state();
roland@4860 673 new_sux->set_state(s->copy(s->kind(), bci));
roland@4860 674 e->set_state(s->copy(s->kind(), bci));
duke@435 675 assert(new_sux->state()->locals_size() == s->locals_size(), "local size mismatch!");
duke@435 676 assert(new_sux->state()->stack_size() == s->stack_size(), "stack size mismatch!");
duke@435 677 assert(new_sux->state()->locks_size() == s->locks_size(), "locks size mismatch!");
duke@435 678
duke@435 679 // link predecessor to new block
duke@435 680 end()->substitute_sux(sux, new_sux);
duke@435 681
duke@435 682 // The ordering needs to be the same, so remove the link that the
duke@435 683 // set_end call above added and substitute the new_sux for this
duke@435 684 // block.
duke@435 685 sux->remove_predecessor(new_sux);
duke@435 686
duke@435 687 // the successor could be the target of a switch so it might have
duke@435 688 // multiple copies of this predecessor, so substitute the new_sux
duke@435 689 // for the first and delete the rest.
duke@435 690 bool assigned = false;
duke@435 691 BlockList& list = sux->_predecessors;
duke@435 692 for (int i = 0; i < list.length(); i++) {
duke@435 693 BlockBegin** b = list.adr_at(i);
duke@435 694 if (*b == this) {
duke@435 695 if (assigned) {
duke@435 696 list.remove_at(i);
duke@435 697 // reprocess this index
duke@435 698 i--;
duke@435 699 } else {
duke@435 700 assigned = true;
duke@435 701 *b = new_sux;
duke@435 702 }
duke@435 703 // link the new block back to it's predecessors.
duke@435 704 new_sux->add_predecessor(this);
duke@435 705 }
duke@435 706 }
duke@435 707 assert(assigned == true, "should have assigned at least once");
duke@435 708 return new_sux;
duke@435 709 }
duke@435 710
duke@435 711
duke@435 712 void BlockBegin::remove_successor(BlockBegin* pred) {
duke@435 713 int idx;
duke@435 714 while ((idx = _successors.index_of(pred)) >= 0) {
duke@435 715 _successors.remove_at(idx);
duke@435 716 }
duke@435 717 }
duke@435 718
duke@435 719
duke@435 720 void BlockBegin::add_predecessor(BlockBegin* pred) {
duke@435 721 _predecessors.append(pred);
duke@435 722 }
duke@435 723
duke@435 724
duke@435 725 void BlockBegin::remove_predecessor(BlockBegin* pred) {
duke@435 726 int idx;
duke@435 727 while ((idx = _predecessors.index_of(pred)) >= 0) {
duke@435 728 _predecessors.remove_at(idx);
duke@435 729 }
duke@435 730 }
duke@435 731
duke@435 732
duke@435 733 void BlockBegin::add_exception_handler(BlockBegin* b) {
duke@435 734 assert(b != NULL && (b->is_set(exception_entry_flag)), "exception handler must exist");
duke@435 735 // add only if not in the list already
duke@435 736 if (!_exception_handlers.contains(b)) _exception_handlers.append(b);
duke@435 737 }
duke@435 738
duke@435 739 int BlockBegin::add_exception_state(ValueStack* state) {
duke@435 740 assert(is_set(exception_entry_flag), "only for xhandlers");
duke@435 741 if (_exception_states == NULL) {
duke@435 742 _exception_states = new ValueStackStack(4);
duke@435 743 }
duke@435 744 _exception_states->append(state);
duke@435 745 return _exception_states->length() - 1;
duke@435 746 }
duke@435 747
duke@435 748
duke@435 749 void BlockBegin::iterate_preorder(boolArray& mark, BlockClosure* closure) {
duke@435 750 if (!mark.at(block_id())) {
duke@435 751 mark.at_put(block_id(), true);
duke@435 752 closure->block_do(this);
duke@435 753 BlockEnd* e = end(); // must do this after block_do because block_do may change it!
duke@435 754 { for (int i = number_of_exception_handlers() - 1; i >= 0; i--) exception_handler_at(i)->iterate_preorder(mark, closure); }
duke@435 755 { for (int i = e->number_of_sux () - 1; i >= 0; i--) e->sux_at (i)->iterate_preorder(mark, closure); }
duke@435 756 }
duke@435 757 }
duke@435 758
duke@435 759
duke@435 760 void BlockBegin::iterate_postorder(boolArray& mark, BlockClosure* closure) {
duke@435 761 if (!mark.at(block_id())) {
duke@435 762 mark.at_put(block_id(), true);
duke@435 763 BlockEnd* e = end();
duke@435 764 { for (int i = number_of_exception_handlers() - 1; i >= 0; i--) exception_handler_at(i)->iterate_postorder(mark, closure); }
duke@435 765 { for (int i = e->number_of_sux () - 1; i >= 0; i--) e->sux_at (i)->iterate_postorder(mark, closure); }
duke@435 766 closure->block_do(this);
duke@435 767 }
duke@435 768 }
duke@435 769
duke@435 770
duke@435 771 void BlockBegin::iterate_preorder(BlockClosure* closure) {
duke@435 772 boolArray mark(number_of_blocks(), false);
duke@435 773 iterate_preorder(mark, closure);
duke@435 774 }
duke@435 775
duke@435 776
duke@435 777 void BlockBegin::iterate_postorder(BlockClosure* closure) {
duke@435 778 boolArray mark(number_of_blocks(), false);
duke@435 779 iterate_postorder(mark, closure);
duke@435 780 }
duke@435 781
duke@435 782
iveresov@1939 783 void BlockBegin::block_values_do(ValueVisitor* f) {
duke@435 784 for (Instruction* n = this; n != NULL; n = n->next()) n->values_do(f);
duke@435 785 }
duke@435 786
duke@435 787
duke@435 788 #ifndef PRODUCT
iveresov@2138 789 #define TRACE_PHI(code) if (PrintPhiFunctions) { code; }
duke@435 790 #else
iveresov@2138 791 #define TRACE_PHI(coce)
duke@435 792 #endif
duke@435 793
duke@435 794
duke@435 795 bool BlockBegin::try_merge(ValueStack* new_state) {
duke@435 796 TRACE_PHI(tty->print_cr("********** try_merge for block B%d", block_id()));
duke@435 797
duke@435 798 // local variables used for state iteration
duke@435 799 int index;
duke@435 800 Value new_value, existing_value;
duke@435 801
duke@435 802 ValueStack* existing_state = state();
duke@435 803 if (existing_state == NULL) {
duke@435 804 TRACE_PHI(tty->print_cr("first call of try_merge for this block"));
duke@435 805
duke@435 806 if (is_set(BlockBegin::was_visited_flag)) {
duke@435 807 // this actually happens for complicated jsr/ret structures
duke@435 808 return false; // BAILOUT in caller
duke@435 809 }
duke@435 810
duke@435 811 // copy state because it is altered
roland@2174 812 new_state = new_state->copy(ValueStack::BlockBeginState, bci());
duke@435 813
duke@435 814 // Use method liveness to invalidate dead locals
duke@435 815 MethodLivenessResult liveness = new_state->scope()->method()->liveness_at_bci(bci());
duke@435 816 if (liveness.is_valid()) {
duke@435 817 assert((int)liveness.size() == new_state->locals_size(), "error in use of liveness");
duke@435 818
duke@435 819 for_each_local_value(new_state, index, new_value) {
duke@435 820 if (!liveness.at(index) || new_value->type()->is_illegal()) {
duke@435 821 new_state->invalidate_local(index);
duke@435 822 TRACE_PHI(tty->print_cr("invalidating dead local %d", index));
duke@435 823 }
duke@435 824 }
duke@435 825 }
duke@435 826
duke@435 827 if (is_set(BlockBegin::parser_loop_header_flag)) {
duke@435 828 TRACE_PHI(tty->print_cr("loop header block, initializing phi functions"));
duke@435 829
duke@435 830 for_each_stack_value(new_state, index, new_value) {
duke@435 831 new_state->setup_phi_for_stack(this, index);
duke@435 832 TRACE_PHI(tty->print_cr("creating phi-function %c%d for stack %d", new_state->stack_at(index)->type()->tchar(), new_state->stack_at(index)->id(), index));
duke@435 833 }
duke@435 834
duke@435 835 BitMap requires_phi_function = new_state->scope()->requires_phi_function();
duke@435 836
duke@435 837 for_each_local_value(new_state, index, new_value) {
duke@435 838 bool requires_phi = requires_phi_function.at(index) || (new_value->type()->is_double_word() && requires_phi_function.at(index + 1));
duke@435 839 if (requires_phi || !SelectivePhiFunctions) {
duke@435 840 new_state->setup_phi_for_local(this, index);
duke@435 841 TRACE_PHI(tty->print_cr("creating phi-function %c%d for local %d", new_state->local_at(index)->type()->tchar(), new_state->local_at(index)->id(), index));
duke@435 842 }
duke@435 843 }
duke@435 844 }
duke@435 845
duke@435 846 // initialize state of block
duke@435 847 set_state(new_state);
duke@435 848
roland@2174 849 } else if (existing_state->is_same(new_state)) {
duke@435 850 TRACE_PHI(tty->print_cr("exisiting state found"));
duke@435 851
duke@435 852 assert(existing_state->scope() == new_state->scope(), "not matching");
duke@435 853 assert(existing_state->locals_size() == new_state->locals_size(), "not matching");
duke@435 854 assert(existing_state->stack_size() == new_state->stack_size(), "not matching");
duke@435 855
duke@435 856 if (is_set(BlockBegin::was_visited_flag)) {
duke@435 857 TRACE_PHI(tty->print_cr("loop header block, phis must be present"));
duke@435 858
duke@435 859 if (!is_set(BlockBegin::parser_loop_header_flag)) {
duke@435 860 // this actually happens for complicated jsr/ret structures
duke@435 861 return false; // BAILOUT in caller
duke@435 862 }
duke@435 863
duke@435 864 for_each_local_value(existing_state, index, existing_value) {
duke@435 865 Value new_value = new_state->local_at(index);
duke@435 866 if (new_value == NULL || new_value->type()->tag() != existing_value->type()->tag()) {
duke@435 867 // The old code invalidated the phi function here
duke@435 868 // Because dead locals are replaced with NULL, this is a very rare case now, so simply bail out
duke@435 869 return false; // BAILOUT in caller
duke@435 870 }
duke@435 871 }
duke@435 872
duke@435 873 #ifdef ASSERT
duke@435 874 // check that all necessary phi functions are present
duke@435 875 for_each_stack_value(existing_state, index, existing_value) {
duke@435 876 assert(existing_value->as_Phi() != NULL && existing_value->as_Phi()->block() == this, "phi function required");
duke@435 877 }
duke@435 878 for_each_local_value(existing_state, index, existing_value) {
duke@435 879 assert(existing_value == new_state->local_at(index) || (existing_value->as_Phi() != NULL && existing_value->as_Phi()->as_Phi()->block() == this), "phi function required");
duke@435 880 }
duke@435 881 #endif
duke@435 882
duke@435 883 } else {
duke@435 884 TRACE_PHI(tty->print_cr("creating phi functions on demand"));
duke@435 885
duke@435 886 // create necessary phi functions for stack
duke@435 887 for_each_stack_value(existing_state, index, existing_value) {
duke@435 888 Value new_value = new_state->stack_at(index);
duke@435 889 Phi* existing_phi = existing_value->as_Phi();
duke@435 890
duke@435 891 if (new_value != existing_value && (existing_phi == NULL || existing_phi->block() != this)) {
duke@435 892 existing_state->setup_phi_for_stack(this, index);
duke@435 893 TRACE_PHI(tty->print_cr("creating phi-function %c%d for stack %d", existing_state->stack_at(index)->type()->tchar(), existing_state->stack_at(index)->id(), index));
duke@435 894 }
duke@435 895 }
duke@435 896
duke@435 897 // create necessary phi functions for locals
duke@435 898 for_each_local_value(existing_state, index, existing_value) {
duke@435 899 Value new_value = new_state->local_at(index);
duke@435 900 Phi* existing_phi = existing_value->as_Phi();
duke@435 901
duke@435 902 if (new_value == NULL || new_value->type()->tag() != existing_value->type()->tag()) {
duke@435 903 existing_state->invalidate_local(index);
duke@435 904 TRACE_PHI(tty->print_cr("invalidating local %d because of type mismatch", index));
duke@435 905 } else if (new_value != existing_value && (existing_phi == NULL || existing_phi->block() != this)) {
duke@435 906 existing_state->setup_phi_for_local(this, index);
duke@435 907 TRACE_PHI(tty->print_cr("creating phi-function %c%d for local %d", existing_state->local_at(index)->type()->tchar(), existing_state->local_at(index)->id(), index));
duke@435 908 }
duke@435 909 }
duke@435 910 }
duke@435 911
duke@435 912 assert(existing_state->caller_state() == new_state->caller_state(), "caller states must be equal");
duke@435 913
duke@435 914 } else {
duke@435 915 assert(false, "stack or locks not matching (invalid bytecodes)");
duke@435 916 return false;
duke@435 917 }
duke@435 918
duke@435 919 TRACE_PHI(tty->print_cr("********** try_merge for block B%d successful", block_id()));
duke@435 920
duke@435 921 return true;
duke@435 922 }
duke@435 923
duke@435 924
duke@435 925 #ifndef PRODUCT
duke@435 926 void BlockBegin::print_block() {
duke@435 927 InstructionPrinter ip;
duke@435 928 print_block(ip, false);
duke@435 929 }
duke@435 930
duke@435 931
duke@435 932 void BlockBegin::print_block(InstructionPrinter& ip, bool live_only) {
duke@435 933 ip.print_instr(this); tty->cr();
duke@435 934 ip.print_stack(this->state()); tty->cr();
duke@435 935 ip.print_inline_level(this);
duke@435 936 ip.print_head();
duke@435 937 for (Instruction* n = next(); n != NULL; n = n->next()) {
duke@435 938 if (!live_only || n->is_pinned() || n->use_count() > 0) {
duke@435 939 ip.print_line(n);
duke@435 940 }
duke@435 941 }
duke@435 942 tty->cr();
duke@435 943 }
duke@435 944 #endif // PRODUCT
duke@435 945
duke@435 946
duke@435 947 // Implementation of BlockList
duke@435 948
duke@435 949 void BlockList::iterate_forward (BlockClosure* closure) {
duke@435 950 const int l = length();
duke@435 951 for (int i = 0; i < l; i++) closure->block_do(at(i));
duke@435 952 }
duke@435 953
duke@435 954
duke@435 955 void BlockList::iterate_backward(BlockClosure* closure) {
duke@435 956 for (int i = length() - 1; i >= 0; i--) closure->block_do(at(i));
duke@435 957 }
duke@435 958
duke@435 959
duke@435 960 void BlockList::blocks_do(void f(BlockBegin*)) {
duke@435 961 for (int i = length() - 1; i >= 0; i--) f(at(i));
duke@435 962 }
duke@435 963
duke@435 964
iveresov@1939 965 void BlockList::values_do(ValueVisitor* f) {
duke@435 966 for (int i = length() - 1; i >= 0; i--) at(i)->block_values_do(f);
duke@435 967 }
duke@435 968
duke@435 969
duke@435 970 #ifndef PRODUCT
duke@435 971 void BlockList::print(bool cfg_only, bool live_only) {
duke@435 972 InstructionPrinter ip;
duke@435 973 for (int i = 0; i < length(); i++) {
duke@435 974 BlockBegin* block = at(i);
duke@435 975 if (cfg_only) {
duke@435 976 ip.print_instr(block); tty->cr();
duke@435 977 } else {
duke@435 978 block->print_block(ip, live_only);
duke@435 979 }
duke@435 980 }
duke@435 981 }
duke@435 982 #endif // PRODUCT
duke@435 983
duke@435 984
duke@435 985 // Implementation of BlockEnd
duke@435 986
duke@435 987 void BlockEnd::set_begin(BlockBegin* begin) {
duke@435 988 BlockList* sux = NULL;
duke@435 989 if (begin != NULL) {
duke@435 990 sux = begin->successors();
roland@4860 991 } else if (this->begin() != NULL) {
duke@435 992 // copy our sux list
roland@4860 993 BlockList* sux = new BlockList(this->begin()->number_of_sux());
roland@4860 994 for (int i = 0; i < this->begin()->number_of_sux(); i++) {
roland@4860 995 sux->append(this->begin()->sux_at(i));
duke@435 996 }
duke@435 997 }
duke@435 998 _sux = sux;
duke@435 999 }
duke@435 1000
duke@435 1001
duke@435 1002 void BlockEnd::substitute_sux(BlockBegin* old_sux, BlockBegin* new_sux) {
duke@435 1003 substitute(*_sux, old_sux, new_sux);
duke@435 1004 }
duke@435 1005
duke@435 1006
duke@435 1007 // Implementation of Phi
duke@435 1008
duke@435 1009 // Normal phi functions take their operands from the last instruction of the
duke@435 1010 // predecessor. Special handling is needed for xhanlder entries because there
duke@435 1011 // the state of arbitrary instructions are needed.
duke@435 1012
duke@435 1013 Value Phi::operand_at(int i) const {
duke@435 1014 ValueStack* state;
duke@435 1015 if (_block->is_set(BlockBegin::exception_entry_flag)) {
duke@435 1016 state = _block->exception_state_at(i);
duke@435 1017 } else {
duke@435 1018 state = _block->pred_at(i)->end()->state();
duke@435 1019 }
duke@435 1020 assert(state != NULL, "");
duke@435 1021
duke@435 1022 if (is_local()) {
duke@435 1023 return state->local_at(local_index());
duke@435 1024 } else {
duke@435 1025 return state->stack_at(stack_index());
duke@435 1026 }
duke@435 1027 }
duke@435 1028
duke@435 1029
duke@435 1030 int Phi::operand_count() const {
duke@435 1031 if (_block->is_set(BlockBegin::exception_entry_flag)) {
duke@435 1032 return _block->number_of_exception_states();
duke@435 1033 } else {
duke@435 1034 return _block->number_of_preds();
duke@435 1035 }
duke@435 1036 }
duke@435 1037
roland@4860 1038 #ifdef ASSERT
roland@4860 1039 // Constructor of Assert
roland@4860 1040 Assert::Assert(Value x, Condition cond, bool unordered_is_true, Value y) : Instruction(illegalType)
roland@4860 1041 , _x(x)
roland@4860 1042 , _cond(cond)
roland@4860 1043 , _y(y)
roland@4860 1044 {
roland@4860 1045 set_flag(UnorderedIsTrueFlag, unordered_is_true);
roland@4860 1046 assert(x->type()->tag() == y->type()->tag(), "types must match");
roland@4860 1047 pin();
duke@435 1048
roland@4860 1049 stringStream strStream;
roland@4860 1050 Compilation::current()->method()->print_name(&strStream);
roland@4860 1051
roland@4860 1052 stringStream strStream1;
roland@4860 1053 InstructionPrinter ip1(1, &strStream1);
roland@4860 1054 ip1.print_instr(x);
roland@4860 1055
roland@4860 1056 stringStream strStream2;
roland@4860 1057 InstructionPrinter ip2(1, &strStream2);
roland@4860 1058 ip2.print_instr(y);
roland@4860 1059
roland@4860 1060 stringStream ss;
roland@4860 1061 ss.print("Assertion %s %s %s in method %s", strStream1.as_string(), ip2.cond_name(cond), strStream2.as_string(), strStream.as_string());
roland@4860 1062
roland@4860 1063 _message = ss.as_string();
roland@4860 1064 }
roland@4860 1065 #endif
roland@4860 1066
roland@4860 1067 void RangeCheckPredicate::check_state() {
roland@4860 1068 assert(state()->kind() != ValueStack::EmptyExceptionState && state()->kind() != ValueStack::ExceptionState, "will deopt with empty state");
roland@4860 1069 }
iveresov@2138 1070
iveresov@2138 1071 void ProfileInvoke::state_values_do(ValueVisitor* f) {
iveresov@2138 1072 if (state() != NULL) state()->values_do(f);
iveresov@2138 1073 }

mercurial