26 #include "memory/allocation.inline.hpp"
27 #include "opto/addnode.hpp"
28 #include "opto/connode.hpp"
29 #include "opto/divnode.hpp"
30 #include "opto/loopnode.hpp"
31 #include "opto/matcher.hpp"
32 #include "opto/mulnode.hpp"
33 #include "opto/rootnode.hpp"
34 #include "opto/subnode.hpp"
35
36 //=============================================================================
37 //------------------------------split_thru_phi---------------------------------
38 // Split Node 'n' through merge point if there is enough win.
39 Node *PhaseIdealLoop::split_thru_phi( Node *n, Node *region, int policy ) {
40 if (n->Opcode() == Op_ConvI2L && n->bottom_type() != TypeLong::LONG) {
41 // ConvI2L may have type information on it which is unsafe to push up
42 // so disable this for now
43 return NULL;
44 }
45
46 if (n->is_MathExact()) {
47 // MathExact has projections that are not correctly handled in the code
48 // below.
49 return NULL;
50 }
51
52 int wins = 0;
53 assert(!n->is_CFG(), "");
54 assert(region->is_Region(), "");
55
56 const Type* type = n->bottom_type();
57 const TypeOopPtr *t_oop = _igvn.type(n)->isa_oopptr();
58 Node *phi;
59 if (t_oop != NULL && t_oop->is_known_instance_field()) {
60 int iid = t_oop->instance_id();
61 int index = C->get_alias_index(t_oop);
62 int offset = t_oop->offset();
63 phi = new (C) PhiNode(region, type, NULL, iid, index, offset);
64 } else {
65 phi = PhiNode::make_blank(region, n);
66 }
67 uint old_unique = C->unique();
68 for (uint i = 1; i < region->req(); i++) {
69 Node *x;
70 Node* the_clone = NULL;
71 if (region->in(i) == C->top()) {
2345 bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) {
2346
2347 assert(!loop->_head->is_CountedLoop(), "Non-counted loop only");
2348 if (!loop->_head->is_Loop()) {
2349 return false; }
2350
2351 LoopNode *head = loop->_head->as_Loop();
2352
2353 if (head->is_partial_peel_loop() || head->partial_peel_has_failed()) {
2354 return false;
2355 }
2356
2357 // Check for complex exit control
2358 for(uint ii = 0; ii < loop->_body.size(); ii++ ) {
2359 Node *n = loop->_body.at(ii);
2360 int opc = n->Opcode();
2361 if (n->is_Call() ||
2362 opc == Op_Catch ||
2363 opc == Op_CatchProj ||
2364 opc == Op_Jump ||
2365 opc == Op_JumpProj ||
2366 opc == Op_FlagsProj) {
2367 #if !defined(PRODUCT)
2368 if (TracePartialPeeling) {
2369 tty->print_cr("\nExit control too complex: lp: %d", head->_idx);
2370 }
2371 #endif
2372 return false;
2373 }
2374 }
2375
2376 int dd = dom_depth(head);
2377
2378 // Step 1: find cut point
2379
2380 // Walk up dominators to loop head looking for first loop exit
2381 // which is executed on every path thru loop.
2382 IfNode *peel_if = NULL;
2383 IfNode *peel_if_cmpu = NULL;
2384
2385 Node *iff = loop->tail();
2386 while( iff != head ) {
|
26 #include "memory/allocation.inline.hpp"
27 #include "opto/addnode.hpp"
28 #include "opto/connode.hpp"
29 #include "opto/divnode.hpp"
30 #include "opto/loopnode.hpp"
31 #include "opto/matcher.hpp"
32 #include "opto/mulnode.hpp"
33 #include "opto/rootnode.hpp"
34 #include "opto/subnode.hpp"
35
36 //=============================================================================
37 //------------------------------split_thru_phi---------------------------------
38 // Split Node 'n' through merge point if there is enough win.
39 Node *PhaseIdealLoop::split_thru_phi( Node *n, Node *region, int policy ) {
40 if (n->Opcode() == Op_ConvI2L && n->bottom_type() != TypeLong::LONG) {
41 // ConvI2L may have type information on it which is unsafe to push up
42 // so disable this for now
43 return NULL;
44 }
45
46 int wins = 0;
47 assert(!n->is_CFG(), "");
48 assert(region->is_Region(), "");
49
50 const Type* type = n->bottom_type();
51 const TypeOopPtr *t_oop = _igvn.type(n)->isa_oopptr();
52 Node *phi;
53 if (t_oop != NULL && t_oop->is_known_instance_field()) {
54 int iid = t_oop->instance_id();
55 int index = C->get_alias_index(t_oop);
56 int offset = t_oop->offset();
57 phi = new (C) PhiNode(region, type, NULL, iid, index, offset);
58 } else {
59 phi = PhiNode::make_blank(region, n);
60 }
61 uint old_unique = C->unique();
62 for (uint i = 1; i < region->req(); i++) {
63 Node *x;
64 Node* the_clone = NULL;
65 if (region->in(i) == C->top()) {
2339 bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) {
2340
2341 assert(!loop->_head->is_CountedLoop(), "Non-counted loop only");
2342 if (!loop->_head->is_Loop()) {
2343 return false; }
2344
2345 LoopNode *head = loop->_head->as_Loop();
2346
2347 if (head->is_partial_peel_loop() || head->partial_peel_has_failed()) {
2348 return false;
2349 }
2350
2351 // Check for complex exit control
2352 for(uint ii = 0; ii < loop->_body.size(); ii++ ) {
2353 Node *n = loop->_body.at(ii);
2354 int opc = n->Opcode();
2355 if (n->is_Call() ||
2356 opc == Op_Catch ||
2357 opc == Op_CatchProj ||
2358 opc == Op_Jump ||
2359 opc == Op_JumpProj) {
2360 #if !defined(PRODUCT)
2361 if (TracePartialPeeling) {
2362 tty->print_cr("\nExit control too complex: lp: %d", head->_idx);
2363 }
2364 #endif
2365 return false;
2366 }
2367 }
2368
2369 int dd = dom_depth(head);
2370
2371 // Step 1: find cut point
2372
2373 // Walk up dominators to loop head looking for first loop exit
2374 // which is executed on every path thru loop.
2375 IfNode *peel_if = NULL;
2376 IfNode *peel_if_cmpu = NULL;
2377
2378 Node *iff = loop->tail();
2379 while( iff != head ) {
|