comparison src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @ 4728:441e946dc1af

7121618: Change type of number of GC workers to unsigned int. Summary: Change variables representing the number of GC workers to uint from int and size_t. Change the parameter in work(int i) to work(uint worker_id). Reviewed-by: brutisso, tonyp
author jmasa
date Wed, 14 Dec 2011 13:34:57 -0800
parents bca17e38de00
children d903bf750e9f
comparison
equal deleted inserted replaced
4727:67fdcb391461 4728:441e946dc1af
588 // called in GangWorker loop() and which is called under the 588 // called in GangWorker loop() and which is called under the
589 // which is called under the protection of the gang monitor and is 589 // which is called under the protection of the gang monitor and is
590 // called after a task is started. So "i" is based on 590 // called after a task is started. So "i" is based on
591 // first-come-first-served. 591 // first-come-first-served.
592 592
593 void ParNewGenTask::work(int i) { 593 void ParNewGenTask::work(uint worker_id) {
594 GenCollectedHeap* gch = GenCollectedHeap::heap(); 594 GenCollectedHeap* gch = GenCollectedHeap::heap();
595 // Since this is being done in a separate thread, need new resource 595 // Since this is being done in a separate thread, need new resource
596 // and handle marks. 596 // and handle marks.
597 ResourceMark rm; 597 ResourceMark rm;
598 HandleMark hm; 598 HandleMark hm;
599 // We would need multiple old-gen queues otherwise. 599 // We would need multiple old-gen queues otherwise.
600 assert(gch->n_gens() == 2, "Par young collection currently only works with one older gen."); 600 assert(gch->n_gens() == 2, "Par young collection currently only works with one older gen.");
601 601
602 Generation* old_gen = gch->next_gen(_gen); 602 Generation* old_gen = gch->next_gen(_gen);
603 603
604 ParScanThreadState& par_scan_state = _state_set->thread_state(i); 604 ParScanThreadState& par_scan_state = _state_set->thread_state(worker_id);
605 assert(_state_set->is_valid(i), "Should not have been called"); 605 assert(_state_set->is_valid(worker_id), "Should not have been called");
606 606
607 par_scan_state.set_young_old_boundary(_young_old_boundary); 607 par_scan_state.set_young_old_boundary(_young_old_boundary);
608 608
609 par_scan_state.start_strong_roots(); 609 par_scan_state.start_strong_roots();
610 gch->gen_process_strong_roots(_gen->level(), 610 gch->gen_process_strong_roots(_gen->level(),
753 Generation& next_gen, 753 Generation& next_gen,
754 HeapWord* young_old_boundary, 754 HeapWord* young_old_boundary,
755 ParScanThreadStateSet& state_set); 755 ParScanThreadStateSet& state_set);
756 756
757 private: 757 private:
758 virtual void work(int i); 758 virtual void work(uint worker_id);
759 virtual void set_for_termination(int active_workers) { 759 virtual void set_for_termination(int active_workers) {
760 _state_set.terminator()->reset_for_reuse(active_workers); 760 _state_set.terminator()->reset_for_reuse(active_workers);
761 } 761 }
762 private: 762 private:
763 ParNewGeneration& _gen; 763 ParNewGeneration& _gen;
779 _young_old_boundary(young_old_boundary), 779 _young_old_boundary(young_old_boundary),
780 _state_set(state_set) 780 _state_set(state_set)
781 { 781 {
782 } 782 }
783 783
784 void ParNewRefProcTaskProxy::work(int i) 784 void ParNewRefProcTaskProxy::work(uint worker_id)
785 { 785 {
786 ResourceMark rm; 786 ResourceMark rm;
787 HandleMark hm; 787 HandleMark hm;
788 ParScanThreadState& par_scan_state = _state_set.thread_state(i); 788 ParScanThreadState& par_scan_state = _state_set.thread_state(worker_id);
789 par_scan_state.set_young_old_boundary(_young_old_boundary); 789 par_scan_state.set_young_old_boundary(_young_old_boundary);
790 _task.work(i, par_scan_state.is_alive_closure(), 790 _task.work(worker_id, par_scan_state.is_alive_closure(),
791 par_scan_state.keep_alive_closure(), 791 par_scan_state.keep_alive_closure(),
792 par_scan_state.evacuate_followers_closure()); 792 par_scan_state.evacuate_followers_closure());
793 } 793 }
794 794
795 class ParNewRefEnqueueTaskProxy: public AbstractGangTask { 795 class ParNewRefEnqueueTaskProxy: public AbstractGangTask {
800 ParNewRefEnqueueTaskProxy(EnqueueTask& task) 800 ParNewRefEnqueueTaskProxy(EnqueueTask& task)
801 : AbstractGangTask("ParNewGeneration parallel reference enqueue"), 801 : AbstractGangTask("ParNewGeneration parallel reference enqueue"),
802 _task(task) 802 _task(task)
803 { } 803 { }
804 804
805 virtual void work(int i) 805 virtual void work(uint worker_id)
806 { 806 {
807 _task.work(i); 807 _task.work(worker_id);
808 } 808 }
809 }; 809 };
810 810
811 811
812 void ParNewRefProcTaskExecutor::execute(ProcessTask& task) 812 void ParNewRefProcTaskExecutor::execute(ProcessTask& task)