Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/parse2.cpp @ 14422:2b8e28fdf503
Merge
author | kvn |
---|---|
date | Tue, 05 Nov 2013 17:38:04 -0800 |
parents | b2ee5dc63353 |
children | de6a9e811145 2113136690bc |
comparison
equal
deleted
inserted
replaced
14421:3068270ba476 | 14422:2b8e28fdf503 |
---|---|
266 } | 266 } |
267 bool adjoin(jint value, int dest, int table_index) { | 267 bool adjoin(jint value, int dest, int table_index) { |
268 return adjoinRange(value, value, dest, table_index); | 268 return adjoinRange(value, value, dest, table_index); |
269 } | 269 } |
270 | 270 |
271 void print(ciEnv* env) { | 271 void print() { |
272 if (is_singleton()) | 272 if (is_singleton()) |
273 tty->print(" {%d}=>%d", lo(), dest()); | 273 tty->print(" {%d}=>%d", lo(), dest()); |
274 else if (lo() == min_jint) | 274 else if (lo() == min_jint) |
275 tty->print(" {..%d}=>%d", hi(), dest()); | 275 tty->print(" {..%d}=>%d", hi(), dest()); |
276 else if (hi() == max_jint) | 276 else if (hi() == max_jint) |
469 Node* jtn = _gvn.transform( new (C) JumpNode(control(), key_val, num_cases) ); | 469 Node* jtn = _gvn.transform( new (C) JumpNode(control(), key_val, num_cases) ); |
470 | 470 |
471 // These are the switch destinations hanging off the jumpnode | 471 // These are the switch destinations hanging off the jumpnode |
472 int i = 0; | 472 int i = 0; |
473 for (SwitchRange* r = lo; r <= hi; r++) { | 473 for (SwitchRange* r = lo; r <= hi; r++) { |
474 for (int j = r->lo(); j <= r->hi(); j++, i++) { | 474 for (int64 j = r->lo(); j <= r->hi(); j++, i++) { |
475 Node* input = _gvn.transform(new (C) JumpProjNode(jtn, i, r->dest(), j - lowval)); | 475 Node* input = _gvn.transform(new (C) JumpProjNode(jtn, i, r->dest(), (int)(j - lowval))); |
476 { | 476 { |
477 PreserveJVMState pjvms(this); | 477 PreserveJVMState pjvms(this); |
478 set_control(input); | 478 set_control(input); |
479 jump_if_always_fork(r->dest(), r->table_index()); | 479 jump_if_always_fork(r->dest(), r->table_index()); |
480 } | 480 } |
630 if (_max_switch_depth > _est_switch_depth) { | 630 if (_max_switch_depth > _est_switch_depth) { |
631 tty->print_cr("******** BAD SWITCH DEPTH ********"); | 631 tty->print_cr("******** BAD SWITCH DEPTH ********"); |
632 } | 632 } |
633 tty->print(" "); | 633 tty->print(" "); |
634 for( r = lo; r <= hi; r++ ) { | 634 for( r = lo; r <= hi; r++ ) { |
635 r->print(env()); | 635 r->print(); |
636 } | 636 } |
637 tty->print_cr(""); | 637 tty->print_cr(""); |
638 } | 638 } |
639 #endif | 639 #endif |
640 } | 640 } |
1364 if (cast != NULL) { // Here's the payoff. | 1364 if (cast != NULL) { // Here's the payoff. |
1365 replace_in_map(val, cast); | 1365 replace_in_map(val, cast); |
1366 } | 1366 } |
1367 } | 1367 } |
1368 | 1368 |
1369 /** | |
1370 * Use speculative type to optimize CmpP node: if comparison is | |
1371 * against the low level class, cast the object to the speculative | |
1372 * type if any. CmpP should then go away. | |
1373 * | |
1374 * @param c expected CmpP node | |
1375 * @return result of CmpP on object casted to speculative type | |
1376 * | |
1377 */ | |
1378 Node* Parse::optimize_cmp_with_klass(Node* c) { | |
1379 // If this is transformed by the _gvn to a comparison with the low | |
1380 // level klass then we may be able to use speculation | |
1381 if (c->Opcode() == Op_CmpP && | |
1382 (c->in(1)->Opcode() == Op_LoadKlass || c->in(1)->Opcode() == Op_DecodeNKlass) && | |
1383 c->in(2)->is_Con()) { | |
1384 Node* load_klass = NULL; | |
1385 Node* decode = NULL; | |
1386 if (c->in(1)->Opcode() == Op_DecodeNKlass) { | |
1387 decode = c->in(1); | |
1388 load_klass = c->in(1)->in(1); | |
1389 } else { | |
1390 load_klass = c->in(1); | |
1391 } | |
1392 if (load_klass->in(2)->is_AddP()) { | |
1393 Node* addp = load_klass->in(2); | |
1394 Node* obj = addp->in(AddPNode::Address); | |
1395 const TypeOopPtr* obj_type = _gvn.type(obj)->is_oopptr(); | |
1396 if (obj_type->speculative_type() != NULL) { | |
1397 ciKlass* k = obj_type->speculative_type(); | |
1398 inc_sp(2); | |
1399 obj = maybe_cast_profiled_obj(obj, k); | |
1400 dec_sp(2); | |
1401 // Make the CmpP use the casted obj | |
1402 addp = basic_plus_adr(obj, addp->in(AddPNode::Offset)); | |
1403 load_klass = load_klass->clone(); | |
1404 load_klass->set_req(2, addp); | |
1405 load_klass = _gvn.transform(load_klass); | |
1406 if (decode != NULL) { | |
1407 decode = decode->clone(); | |
1408 decode->set_req(1, load_klass); | |
1409 load_klass = _gvn.transform(decode); | |
1410 } | |
1411 c = c->clone(); | |
1412 c->set_req(1, load_klass); | |
1413 c = _gvn.transform(c); | |
1414 } | |
1415 } | |
1416 } | |
1417 return c; | |
1418 } | |
1369 | 1419 |
1370 //------------------------------do_one_bytecode-------------------------------- | 1420 //------------------------------do_one_bytecode-------------------------------- |
1371 // Parse this bytecode, and alter the Parsers JVM->Node mapping | 1421 // Parse this bytecode, and alter the Parsers JVM->Node mapping |
1372 void Parse::do_one_bytecode() { | 1422 void Parse::do_one_bytecode() { |
1373 Node *a, *b, *c, *d; // Handy temps | 1423 Node *a, *b, *c, *d; // Handy temps |
2237 // If this is a backwards branch in the bytecodes, add Safepoint | 2287 // If this is a backwards branch in the bytecodes, add Safepoint |
2238 maybe_add_safepoint(iter().get_dest()); | 2288 maybe_add_safepoint(iter().get_dest()); |
2239 a = pop(); | 2289 a = pop(); |
2240 b = pop(); | 2290 b = pop(); |
2241 c = _gvn.transform( new (C) CmpPNode(b, a) ); | 2291 c = _gvn.transform( new (C) CmpPNode(b, a) ); |
2292 c = optimize_cmp_with_klass(c); | |
2242 do_if(btest, c); | 2293 do_if(btest, c); |
2243 break; | 2294 break; |
2244 | 2295 |
2245 case Bytecodes::_ifeq: btest = BoolTest::eq; goto handle_ifxx; | 2296 case Bytecodes::_ifeq: btest = BoolTest::eq; goto handle_ifxx; |
2246 case Bytecodes::_ifne: btest = BoolTest::ne; goto handle_ifxx; | 2297 case Bytecodes::_ifne: btest = BoolTest::ne; goto handle_ifxx; |