equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
77 if (phase->find_unswitching_candidate(this) == NULL) { |
77 if (phase->find_unswitching_candidate(this) == NULL) { |
78 return false; |
78 return false; |
79 } |
79 } |
80 |
80 |
81 // Too speculative if running low on nodes. |
81 // Too speculative if running low on nodes. |
82 return phase->may_require_nodes(est_loop_clone_sz(3, _body.size())); |
82 return phase->may_require_nodes(est_loop_clone_sz(2)); |
83 } |
83 } |
84 |
84 |
85 //------------------------------find_unswitching_candidate----------------------------- |
85 //------------------------------find_unswitching_candidate----------------------------- |
86 // Find candidate "if" for unswitching |
86 // Find candidate "if" for unswitching |
87 IfNode* PhaseIdealLoop::find_unswitching_candidate(const IdealLoopTree *loop) const { |
87 IfNode* PhaseIdealLoop::find_unswitching_candidate(const IdealLoopTree *loop) const { |
114 |
114 |
115 //------------------------------do_unswitching----------------------------- |
115 //------------------------------do_unswitching----------------------------- |
116 // Clone loop with an invariant test (that does not exit) and |
116 // Clone loop with an invariant test (that does not exit) and |
117 // insert a clone of the test that selects which version to |
117 // insert a clone of the test that selects which version to |
118 // execute. |
118 // execute. |
119 void PhaseIdealLoop::do_unswitching (IdealLoopTree *loop, Node_List &old_new) { |
119 void PhaseIdealLoop::do_unswitching(IdealLoopTree *loop, Node_List &old_new) { |
120 |
120 |
121 // Find first invariant test that doesn't exit the loop |
121 // Find first invariant test that doesn't exit the loop |
122 LoopNode *head = loop->_head->as_Loop(); |
122 LoopNode *head = loop->_head->as_Loop(); |
123 |
123 |
124 IfNode* unswitch_iff = find_unswitching_candidate((const IdealLoopTree *)loop); |
124 IfNode* unswitch_iff = find_unswitching_candidate((const IdealLoopTree *)loop); |