7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/serial/defNewGeneration.inline.hpp"
27 #include "gc/shared/ageTable.inline.hpp"
28 #include "gc/shared/cardTableRS.hpp"
29 #include "gc/shared/collectorCounters.hpp"
30 #include "gc/shared/gcHeapSummary.hpp"
31 #include "gc/shared/gcLocker.inline.hpp"
32 #include "gc/shared/gcPolicyCounters.hpp"
33 #include "gc/shared/gcTimer.hpp"
34 #include "gc/shared/gcTrace.hpp"
35 #include "gc/shared/gcTraceTime.inline.hpp"
36 #include "gc/shared/genCollectedHeap.hpp"
37 #include "gc/shared/genOopClosures.inline.hpp"
38 #include "gc/shared/generationSpec.hpp"
39 #include "gc/shared/preservedMarks.inline.hpp"
40 #include "gc/shared/referencePolicy.hpp"
41 #include "gc/shared/space.inline.hpp"
42 #include "gc/shared/spaceDecorator.hpp"
43 #include "gc/shared/strongRootsScope.hpp"
44 #include "gc/shared/weakProcessor.hpp"
45 #include "logging/log.hpp"
46 #include "memory/iterator.hpp"
668 eden()->clear(SpaceDecorator::Mangle);
669 from()->clear(SpaceDecorator::Mangle);
670 if (ZapUnusedHeapArea) {
671 // This is now done here because of the piece-meal mangling which
672 // can check for valid mangling at intermediate points in the
673 // collection(s). When a young collection fails to collect
674 // sufficient space resizing of the young generation can occur
675 // an redistribute the spaces in the young generation. Mangle
676 // here so that unzapped regions don't get distributed to
677 // other spaces.
678 to()->mangle_unused_area();
679 }
680 swap_spaces();
681
682 assert(to()->is_empty(), "to space should be empty now");
683
684 adjust_desired_tenuring_threshold();
685
686 // A successful scavenge should restart the GC time limit count which is
687 // for full GC's.
688 AdaptiveSizePolicy* size_policy = gch->gen_policy()->size_policy();
689 size_policy->reset_gc_overhead_limit_count();
690 assert(!gch->incremental_collection_failed(), "Should be clear");
691 } else {
692 assert(_promo_failure_scan_stack.is_empty(), "post condition");
693 _promo_failure_scan_stack.clear(true); // Clear cached segments.
694
695 remove_forwarding_pointers();
696 log_info(gc, promotion)("Promotion failed");
697 // Add to-space to the list of space to compact
698 // when a promotion failure has occurred. In that
699 // case there can be live objects in to-space
700 // as a result of a partial evacuation of eden
701 // and from-space.
702 swap_spaces(); // For uniformity wrt ParNewGeneration.
703 from()->set_next_compaction_space(to());
704 gch->set_incremental_collection_failed();
705
706 // Inform the next generation that a promotion failure occurred.
707 _old_gen->promotion_failure_occurred();
708 gc_tracer.report_promotion_failed(_promotion_failed_info);
|
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/serial/defNewGeneration.inline.hpp"
27 #include "gc/shared/adaptiveSizePolicy.hpp"
28 #include "gc/shared/ageTable.inline.hpp"
29 #include "gc/shared/cardTableRS.hpp"
30 #include "gc/shared/collectorCounters.hpp"
31 #include "gc/shared/gcHeapSummary.hpp"
32 #include "gc/shared/gcLocker.inline.hpp"
33 #include "gc/shared/gcPolicyCounters.hpp"
34 #include "gc/shared/gcTimer.hpp"
35 #include "gc/shared/gcTrace.hpp"
36 #include "gc/shared/gcTraceTime.inline.hpp"
37 #include "gc/shared/genCollectedHeap.hpp"
38 #include "gc/shared/genOopClosures.inline.hpp"
39 #include "gc/shared/generationSpec.hpp"
40 #include "gc/shared/preservedMarks.inline.hpp"
41 #include "gc/shared/referencePolicy.hpp"
42 #include "gc/shared/space.inline.hpp"
43 #include "gc/shared/spaceDecorator.hpp"
44 #include "gc/shared/strongRootsScope.hpp"
45 #include "gc/shared/weakProcessor.hpp"
46 #include "logging/log.hpp"
47 #include "memory/iterator.hpp"
669 eden()->clear(SpaceDecorator::Mangle);
670 from()->clear(SpaceDecorator::Mangle);
671 if (ZapUnusedHeapArea) {
672 // This is now done here because of the piece-meal mangling which
673 // can check for valid mangling at intermediate points in the
674 // collection(s). When a young collection fails to collect
675 // sufficient space resizing of the young generation can occur
676 // an redistribute the spaces in the young generation. Mangle
677 // here so that unzapped regions don't get distributed to
678 // other spaces.
679 to()->mangle_unused_area();
680 }
681 swap_spaces();
682
683 assert(to()->is_empty(), "to space should be empty now");
684
685 adjust_desired_tenuring_threshold();
686
687 // A successful scavenge should restart the GC time limit count which is
688 // for full GC's.
689 AdaptiveSizePolicy* size_policy = gch->size_policy();
690 size_policy->reset_gc_overhead_limit_count();
691 assert(!gch->incremental_collection_failed(), "Should be clear");
692 } else {
693 assert(_promo_failure_scan_stack.is_empty(), "post condition");
694 _promo_failure_scan_stack.clear(true); // Clear cached segments.
695
696 remove_forwarding_pointers();
697 log_info(gc, promotion)("Promotion failed");
698 // Add to-space to the list of space to compact
699 // when a promotion failure has occurred. In that
700 // case there can be live objects in to-space
701 // as a result of a partial evacuation of eden
702 // and from-space.
703 swap_spaces(); // For uniformity wrt ParNewGeneration.
704 from()->set_next_compaction_space(to());
705 gch->set_incremental_collection_failed();
706
707 // Inform the next generation that a promotion failure occurred.
708 _old_gen->promotion_failure_occurred();
709 gc_tracer.report_promotion_failed(_promotion_failed_info);
|