< prev index next >

src/hotspot/share/gc/cms/parNewGeneration.cpp

Print this page
rev 50281 : 8195097: Make it possible to process StringTable outside safepoint
Reviewed-by:


   6  * under the terms of the GNU General Public License version 2 only, as
   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/cms/cmsHeap.inline.hpp"
  27 #include "gc/cms/compactibleFreeListSpace.hpp"
  28 #include "gc/cms/concurrentMarkSweepGeneration.hpp"
  29 #include "gc/cms/parNewGeneration.inline.hpp"
  30 #include "gc/cms/parOopClosures.inline.hpp"
  31 #include "gc/serial/defNewGeneration.inline.hpp"
  32 #include "gc/shared/adaptiveSizePolicy.hpp"
  33 #include "gc/shared/ageTable.inline.hpp"
  34 #include "gc/shared/copyFailedInfo.hpp"
  35 #include "gc/shared/gcHeapSummary.hpp"
  36 #include "gc/shared/gcTimer.hpp"
  37 #include "gc/shared/gcTrace.hpp"
  38 #include "gc/shared/gcTraceTime.inline.hpp"
  39 #include "gc/shared/genOopClosures.inline.hpp"
  40 #include "gc/shared/generation.hpp"
  41 #include "gc/shared/plab.inline.hpp"
  42 #include "gc/shared/preservedMarks.inline.hpp"
  43 #include "gc/shared/referencePolicy.hpp"
  44 #include "gc/shared/space.hpp"
  45 #include "gc/shared/spaceDecorator.hpp"


 572     // Otherwise, offer termination.
 573     par_scan_state()->start_term_time();
 574     if (terminator()->offer_termination()) break;
 575     par_scan_state()->end_term_time();
 576   }
 577   assert(par_gen()->_overflow_list == NULL && par_gen()->_num_par_pushes == 0,
 578          "Broken overflow list?");
 579   // Finish the last termination pause.
 580   par_scan_state()->end_term_time();
 581 }
 582 
 583 ParNewGenTask::ParNewGenTask(ParNewGeneration* young_gen,
 584                              Generation* old_gen,
 585                              HeapWord* young_old_boundary,
 586                              ParScanThreadStateSet* state_set,
 587                              StrongRootsScope* strong_roots_scope) :
 588     AbstractGangTask("ParNewGeneration collection"),
 589     _young_gen(young_gen), _old_gen(old_gen),
 590     _young_old_boundary(young_old_boundary),
 591     _state_set(state_set),
 592     _strong_roots_scope(strong_roots_scope)

 593 {}
 594 
 595 void ParNewGenTask::work(uint worker_id) {
 596   CMSHeap* heap = CMSHeap::heap();
 597   // Since this is being done in a separate thread, need new resource
 598   // and handle marks.
 599   ResourceMark rm;
 600   HandleMark hm;
 601 
 602   ParScanThreadState& par_scan_state = _state_set->thread_state(worker_id);
 603   assert(_state_set->is_valid(worker_id), "Should not have been called");
 604 
 605   par_scan_state.set_young_old_boundary(_young_old_boundary);
 606 
 607   CLDScanClosure cld_scan_closure(&par_scan_state.to_space_root_closure(),
 608                                   heap->rem_set()->cld_rem_set()->accumulate_modified_oops());
 609 
 610   par_scan_state.start_strong_roots();
 611   heap->young_process_roots(_strong_roots_scope,
 612                            &par_scan_state.to_space_root_closure(),
 613                            &par_scan_state.older_gen_closure(),
 614                            &cld_scan_closure);

 615 
 616   par_scan_state.end_strong_roots();
 617 
 618   // "evacuate followers".
 619   par_scan_state.evacuate_followers_closure().do_void();
 620 
 621   // This will collapse this worker's promoted object list that's
 622   // created during the main ParNew parallel phase of ParNew. This has
 623   // to be called after all workers have finished promoting objects
 624   // and scanning promoted objects. It should be safe calling it from
 625   // here, given that we can only reach here after all thread have
 626   // offered termination, i.e., after there is no more work to be
 627   // done. It will also disable promotion tracking for the rest of
 628   // this GC as it's not necessary to be on during reference processing.
 629   _old_gen->par_oop_since_save_marks_iterate_done((int) worker_id);
 630 }
 631 
 632 ParNewGeneration::ParNewGeneration(ReservedSpace rs, size_t initial_byte_size)
 633   : DefNewGeneration(rs, initial_byte_size, "PCopy"),
 634   _overflow_list(NULL),




   6  * under the terms of the GNU General Public License version 2 only, as
   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 "classfile/stringTable.hpp"
  27 #include "gc/cms/cmsHeap.inline.hpp"
  28 #include "gc/cms/compactibleFreeListSpace.hpp"
  29 #include "gc/cms/concurrentMarkSweepGeneration.hpp"
  30 #include "gc/cms/parNewGeneration.inline.hpp"
  31 #include "gc/cms/parOopClosures.inline.hpp"
  32 #include "gc/serial/defNewGeneration.inline.hpp"
  33 #include "gc/shared/adaptiveSizePolicy.hpp"
  34 #include "gc/shared/ageTable.inline.hpp"
  35 #include "gc/shared/copyFailedInfo.hpp"
  36 #include "gc/shared/gcHeapSummary.hpp"
  37 #include "gc/shared/gcTimer.hpp"
  38 #include "gc/shared/gcTrace.hpp"
  39 #include "gc/shared/gcTraceTime.inline.hpp"
  40 #include "gc/shared/genOopClosures.inline.hpp"
  41 #include "gc/shared/generation.hpp"
  42 #include "gc/shared/plab.inline.hpp"
  43 #include "gc/shared/preservedMarks.inline.hpp"
  44 #include "gc/shared/referencePolicy.hpp"
  45 #include "gc/shared/space.hpp"
  46 #include "gc/shared/spaceDecorator.hpp"


 573     // Otherwise, offer termination.
 574     par_scan_state()->start_term_time();
 575     if (terminator()->offer_termination()) break;
 576     par_scan_state()->end_term_time();
 577   }
 578   assert(par_gen()->_overflow_list == NULL && par_gen()->_num_par_pushes == 0,
 579          "Broken overflow list?");
 580   // Finish the last termination pause.
 581   par_scan_state()->end_term_time();
 582 }
 583 
 584 ParNewGenTask::ParNewGenTask(ParNewGeneration* young_gen,
 585                              Generation* old_gen,
 586                              HeapWord* young_old_boundary,
 587                              ParScanThreadStateSet* state_set,
 588                              StrongRootsScope* strong_roots_scope) :
 589     AbstractGangTask("ParNewGeneration collection"),
 590     _young_gen(young_gen), _old_gen(old_gen),
 591     _young_old_boundary(young_old_boundary),
 592     _state_set(state_set),
 593     _strong_roots_scope(strong_roots_scope),
 594     _par_state_string(StringTable::weak_storage())
 595 {}
 596 
 597 void ParNewGenTask::work(uint worker_id) {
 598   CMSHeap* heap = CMSHeap::heap();
 599   // Since this is being done in a separate thread, need new resource
 600   // and handle marks.
 601   ResourceMark rm;
 602   HandleMark hm;
 603 
 604   ParScanThreadState& par_scan_state = _state_set->thread_state(worker_id);
 605   assert(_state_set->is_valid(worker_id), "Should not have been called");
 606 
 607   par_scan_state.set_young_old_boundary(_young_old_boundary);
 608 
 609   CLDScanClosure cld_scan_closure(&par_scan_state.to_space_root_closure(),
 610                                   heap->rem_set()->cld_rem_set()->accumulate_modified_oops());
 611 
 612   par_scan_state.start_strong_roots();
 613   heap->young_process_roots(_strong_roots_scope,
 614                            &par_scan_state.to_space_root_closure(),
 615                            &par_scan_state.older_gen_closure(),
 616                            &cld_scan_closure,
 617                            &_par_state_string);
 618 
 619   par_scan_state.end_strong_roots();
 620 
 621   // "evacuate followers".
 622   par_scan_state.evacuate_followers_closure().do_void();
 623 
 624   // This will collapse this worker's promoted object list that's
 625   // created during the main ParNew parallel phase of ParNew. This has
 626   // to be called after all workers have finished promoting objects
 627   // and scanning promoted objects. It should be safe calling it from
 628   // here, given that we can only reach here after all thread have
 629   // offered termination, i.e., after there is no more work to be
 630   // done. It will also disable promotion tracking for the rest of
 631   // this GC as it's not necessary to be on during reference processing.
 632   _old_gen->par_oop_since_save_marks_iterate_done((int) worker_id);
 633 }
 634 
 635 ParNewGeneration::ParNewGeneration(ReservedSpace rs, size_t initial_byte_size)
 636   : DefNewGeneration(rs, initial_byte_size, "PCopy"),
 637   _overflow_list(NULL),


< prev index next >