< prev index next >

src/hotspot/share/opto/reachability.cpp

Print this page

423       sfpt->add_req(referent);
424       igvn()._worklist.push(sfpt);
425     }
426   }
427   // Eliminate processed RFs. They become redundant once reachability edges are added.
428   bool progress = (for_removal.size() > 0);
429   while (for_removal.size() > 0) {
430     remove_rf(for_removal.pop()->as_ReachabilityFence());
431   }
432 
433   assert(C->reachability_fences_count() == no_of_constant_rfs, "");
434   return progress;
435 }
436 
437 //======================================================================
438 //---------------------------- Phase 3 ---------------------------------
439 
440 // Find a point in CFG right after safepoint node to insert reachability fence.
441 static Node* sfpt_ctrl_out(SafePointNode* sfpt) {
442   if (sfpt->is_Call()) {
443     CallProjections callprojs;
444     sfpt->as_Call()->extract_projections(&callprojs,
445                                          false /*separate_io_proj*/,
446                                          false /*do_asserts*/,
447                                          true /*allow_handlers*/);
448     // Calls can have multiple control projections. However, reachability edge expansion
449     // happens during final graph reshaping which is performed very late in compilation pipeline.
450     // The assumption here is that the control path chosen for insertion can't go away.
451     // So, materializing a reachability fence on a single control path produced by a call
452     // is enough to keep the referent oop alive across the call.
453     if (callprojs.fallthrough_catchproj != nullptr) {
454       return callprojs.fallthrough_catchproj;
455     } else if (callprojs.catchall_catchproj != nullptr) {
456       return callprojs.catchall_catchproj; // rethrow stub
457     } else if (callprojs.fallthrough_proj != nullptr) {
458       return callprojs.fallthrough_proj; // no exceptions thrown
459     } else {
460       ShouldNotReachHere();
461     }
462   } else {
463     return sfpt;
464   }
465 }
466 
467 // Phase 3: materialize reachability fences from reachability edges on safepoints.
468 // Turn extra safepoint edges into reachability fences immediately following the safepoint.
469 //
470 // NB! As of now, a special care is needed to properly enumerate reachability edges because
471 // there are other use cases for non-debug safepoint edges. expand_reachability_edges() runs
472 // after macro expansion where runtime calls during array allocation are annotated with
473 // valid_length_test_input as an extra edges. Until there's a mechanism to distinguish between
474 // different types of non-debug edges, unrelated cases are filtered out explicitly and in ad-hoc manner.
475 void Compile::expand_reachability_edges(Unique_Node_List& safepoints) {
476   for (uint i = 0; i < safepoints.size(); i++) {
477     SafePointNode* sfpt = safepoints.at(i)->as_SafePoint();
478 

423       sfpt->add_req(referent);
424       igvn()._worklist.push(sfpt);
425     }
426   }
427   // Eliminate processed RFs. They become redundant once reachability edges are added.
428   bool progress = (for_removal.size() > 0);
429   while (for_removal.size() > 0) {
430     remove_rf(for_removal.pop()->as_ReachabilityFence());
431   }
432 
433   assert(C->reachability_fences_count() == no_of_constant_rfs, "");
434   return progress;
435 }
436 
437 //======================================================================
438 //---------------------------- Phase 3 ---------------------------------
439 
440 // Find a point in CFG right after safepoint node to insert reachability fence.
441 static Node* sfpt_ctrl_out(SafePointNode* sfpt) {
442   if (sfpt->is_Call()) {
443     CallProjections* callprojs = sfpt->as_Call()->extract_projections(false /*separate_io_proj*/,
444                                                                       false /*do_asserts*/,
445                                                                       true /*allow_handlers*/);


446     // Calls can have multiple control projections. However, reachability edge expansion
447     // happens during final graph reshaping which is performed very late in compilation pipeline.
448     // The assumption here is that the control path chosen for insertion can't go away.
449     // So, materializing a reachability fence on a single control path produced by a call
450     // is enough to keep the referent oop alive across the call.
451     if (callprojs->fallthrough_catchproj != nullptr) {
452       return callprojs->fallthrough_catchproj;
453     } else if (callprojs->catchall_catchproj != nullptr) {
454       return callprojs->catchall_catchproj; // rethrow stub
455     } else if (callprojs->fallthrough_proj != nullptr) {
456       return callprojs->fallthrough_proj; // no exceptions thrown
457     } else {
458       ShouldNotReachHere();
459     }
460   } else {
461     return sfpt;
462   }
463 }
464 
465 // Phase 3: materialize reachability fences from reachability edges on safepoints.
466 // Turn extra safepoint edges into reachability fences immediately following the safepoint.
467 //
468 // NB! As of now, a special care is needed to properly enumerate reachability edges because
469 // there are other use cases for non-debug safepoint edges. expand_reachability_edges() runs
470 // after macro expansion where runtime calls during array allocation are annotated with
471 // valid_length_test_input as an extra edges. Until there's a mechanism to distinguish between
472 // different types of non-debug edges, unrelated cases are filtered out explicitly and in ad-hoc manner.
473 void Compile::expand_reachability_edges(Unique_Node_List& safepoints) {
474   for (uint i = 0; i < safepoints.size(); i++) {
475     SafePointNode* sfpt = safepoints.at(i)->as_SafePoint();
476 
< prev index next >