1630 // We are about to decide on whether this pause will be an
1631 // initial-mark pause.
1632
1633 // First, collector_state()->during_initial_mark_pause() should not be already set. We
1634 // will set it here if we have to. However, it should be cleared by
1635 // the end of the pause (it's only set for the duration of an
1636 // initial-mark pause).
1637 assert(!collector_state()->during_initial_mark_pause(), "pre-condition");
1638
1639 if (collector_state()->initiate_conc_mark_if_possible()) {
1640 // We had noticed on a previous pause that the heap occupancy has
1641 // gone over the initiating threshold and we should start a
1642 // concurrent marking cycle. So we might initiate one.
1643
1644 if (!about_to_start_mixed_phase() && collector_state()->gcs_are_young()) {
1645 // Initiate a new initial mark if there is no marking or reclamation going on.
1646 initiate_conc_mark();
1647 ergo_verbose0(ErgoConcCycles,
1648 "initiate concurrent cycle",
1649 ergo_format_reason("concurrent cycle initiation requested"));
1650 } else if (_g1->user_requested_concurrent_full_gc(_g1->gc_cause())) {
1651 // Initiate a user requested initial mark and update the collector state to
1652 // reflect this.
1653 collector_state()->set_gcs_are_young(true);
1654 collector_state()->set_last_young_gc(false);
1655
1656 initiate_conc_mark();
1657 ergo_verbose0(ErgoConcCycles,
1658 "initiate concurrent cycle",
1659 ergo_format_reason("user requested concurrent cycle"));
1660 } else {
1661 // The concurrent marking thread is still finishing up the
1662 // previous cycle. If we start one right now the two cycles
1663 // overlap. In particular, the concurrent marking thread might
1664 // be in the process of clearing the next marking bitmap (which
1665 // we will use for the next cycle if we start one). Starting a
1666 // cycle now will be bad given that parts of the marking
1667 // information might get cleared by the marking thread. And we
1668 // cannot wait for the marking thread to finish the cycle as it
1669 // periodically yields while clearing the next marking bitmap
1670 // and, if it's in a yield point, it's waiting for us to
1671 // finish. So, at this point we will not start a cycle and we'll
1672 // let the concurrent marking thread complete the last one.
|
1630 // We are about to decide on whether this pause will be an
1631 // initial-mark pause.
1632
1633 // First, collector_state()->during_initial_mark_pause() should not be already set. We
1634 // will set it here if we have to. However, it should be cleared by
1635 // the end of the pause (it's only set for the duration of an
1636 // initial-mark pause).
1637 assert(!collector_state()->during_initial_mark_pause(), "pre-condition");
1638
1639 if (collector_state()->initiate_conc_mark_if_possible()) {
1640 // We had noticed on a previous pause that the heap occupancy has
1641 // gone over the initiating threshold and we should start a
1642 // concurrent marking cycle. So we might initiate one.
1643
1644 if (!about_to_start_mixed_phase() && collector_state()->gcs_are_young()) {
1645 // Initiate a new initial mark if there is no marking or reclamation going on.
1646 initiate_conc_mark();
1647 ergo_verbose0(ErgoConcCycles,
1648 "initiate concurrent cycle",
1649 ergo_format_reason("concurrent cycle initiation requested"));
1650 } else if (_g1->is_user_requested_concurrent_full_gc(_g1->gc_cause())) {
1651 // Initiate a user requested initial mark. An initial mark must be young only
1652 // GC, so the collector state must be updated to reflect this.
1653 collector_state()->set_gcs_are_young(true);
1654 collector_state()->set_last_young_gc(false);
1655
1656 initiate_conc_mark();
1657 ergo_verbose0(ErgoConcCycles,
1658 "initiate concurrent cycle",
1659 ergo_format_reason("user requested concurrent cycle"));
1660 } else {
1661 // The concurrent marking thread is still finishing up the
1662 // previous cycle. If we start one right now the two cycles
1663 // overlap. In particular, the concurrent marking thread might
1664 // be in the process of clearing the next marking bitmap (which
1665 // we will use for the next cycle if we start one). Starting a
1666 // cycle now will be bad given that parts of the marking
1667 // information might get cleared by the marking thread. And we
1668 // cannot wait for the marking thread to finish the cycle as it
1669 // periodically yields while clearing the next marking bitmap
1670 // and, if it's in a yield point, it's waiting for us to
1671 // finish. So, at this point we will not start a cycle and we'll
1672 // let the concurrent marking thread complete the last one.
|