@@ -288,7 +288,7 @@ IfProjNode* PhaseIdealLoop::clone_parse_predicate_to_unswitched_loop(ParsePredic
288
288
// cloned predicates.
289
289
void PhaseIdealLoop::clone_assertion_predicates_to_unswitched_loop (IdealLoopTree* loop, const Node_List& old_new,
290
290
Deoptimization::DeoptReason reason,
291
- IfProjNode* old_predicate_proj ,
291
+ ParsePredicateSuccessProj* old_parse_predicate_proj ,
292
292
ParsePredicateSuccessProj* fast_loop_parse_predicate_proj,
293
293
ParsePredicateSuccessProj* slow_loop_parse_predicate_proj) {
294
294
assert (fast_loop_parse_predicate_proj->in (0 )->is_ParsePredicate () &&
@@ -297,17 +297,15 @@ void PhaseIdealLoop::clone_assertion_predicates_to_unswitched_loop(IdealLoopTree
297
297
// and doing loop unrolling. Push the original predicates on a list to later process them in reverse order to keep the
298
298
// original predicate order.
299
299
Unique_Node_List list;
300
- get_assertion_predicates (old_predicate_proj , list);
300
+ get_assertion_predicates (old_parse_predicate_proj , list);
301
301
302
302
Node_List to_process;
303
- IfNode* iff = old_predicate_proj->in (0 )->as_If ();
304
- IfProjNode* uncommon_proj = iff->proj_out (1 - old_predicate_proj->as_Proj ()->_con )->as_IfProj ();
305
303
// Process in reverse order such that 'create_new_if_for_predicate' can be used in
306
304
// 'clone_assertion_predicate_for_unswitched_loops' and the original order is maintained.
307
305
for (int i = list.size () - 1 ; i >= 0 ; i--) {
308
306
Node* predicate = list.at (i);
309
307
assert (predicate->in (0 )->is_If (), " must be If node" );
310
- iff = predicate->in (0 )->as_If ();
308
+ IfNode* iff = predicate->in (0 )->as_If ();
311
309
assert (predicate->is_Proj () && predicate->as_Proj ()->is_IfProj (), " predicate must be a projection of an if node" );
312
310
IfProjNode* predicate_proj = predicate->as_IfProj ();
313
311
@@ -337,34 +335,14 @@ void PhaseIdealLoop::clone_assertion_predicates_to_unswitched_loop(IdealLoopTree
337
335
}
338
336
339
337
// Put all Assertion Predicate projections on a list, starting at 'predicate' and going up in the tree. If 'get_opaque'
340
- // is set, then the OpaqueTemplateAssertionPredicate nodes of the Assertion Predicates are put on the list instead of
341
- // the projections.
342
- void PhaseIdealLoop::get_assertion_predicates (Node* predicate, Unique_Node_List& list, bool get_opaque) {
343
- ParsePredicateNode* parse_predicate = predicate->in (0 )->as_ParsePredicate ();
344
- ProjNode* uncommon_proj = parse_predicate->proj_out (1 - predicate->as_Proj ()->_con );
345
- Node* rgn = uncommon_proj->unique_ctrl_out ();
346
- assert (rgn->is_Region () || rgn->is_Call (), " must be a region or call uct" );
347
- predicate = parse_predicate->in (0 );
348
- while (predicate != nullptr && predicate->is_Proj () && predicate->in (0 )->is_If ()) {
349
- IfNode* iff = predicate->in (0 )->as_If ();
350
- uncommon_proj = iff->proj_out (1 - predicate->as_Proj ()->_con );
351
- if (uncommon_proj->unique_ctrl_out () != rgn) {
352
- break ;
353
- }
354
- Node* bol = iff->in (1 );
355
- assert (!bol->is_OpaqueInitializedAssertionPredicate (), " should not find an Initialized Assertion Predicate" );
356
- if (bol->is_OpaqueTemplateAssertionPredicate ()) {
357
- assert (assertion_predicate_has_loop_opaque_node (iff), " must find OpaqueLoop* nodes" );
358
- if (get_opaque) {
359
- // Collect the OpaqueTemplateAssertionPredicateNode.
360
- list.push (bol);
361
- } else {
362
- // Collect the predicate projection.
363
- list.push (predicate);
364
- }
365
- }
366
- predicate = predicate->in (0 )->in (0 );
367
- }
338
+ // is set, then the OpaqueTemplateAssertionPredicateNode nodes of the Assertion Predicates are put on the list instead
339
+ // of the projections.
340
+ void PhaseIdealLoop::get_assertion_predicates (ParsePredicateSuccessProj* parse_predicate_proj, Unique_Node_List& list,
341
+ const bool get_opaque) {
342
+ Deoptimization::DeoptReason deopt_reason = parse_predicate_proj->in (0 )->as_ParsePredicate ()->deopt_reason ();
343
+ PredicateBlockIterator predicate_iterator (parse_predicate_proj, deopt_reason);
344
+ TemplateAssertionPredicateCollector template_assertion_predicate_collector (list, get_opaque);
345
+ predicate_iterator.for_each (template_assertion_predicate_collector);
368
346
}
369
347
370
348
// Clone an Assertion Predicate for an unswitched loop. OpaqueLoopInit and OpaqueLoopStride nodes are cloned and uncommon
0 commit comments