src/hotspot/share/gc/shared/parallelCleaning.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File open Sdiff src/hotspot/share/gc/shared

src/hotspot/share/gc/shared/parallelCleaning.cpp

Print this page




  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/symbolTable.hpp"
  27 #include "classfile/stringTable.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "gc/shared/parallelCleaning.hpp"
  30 #include "logging/log.hpp"
  31 #include "memory/resourceArea.hpp"
  32 #include "logging/log.hpp"



  33 
  34 StringDedupCleaningTask::StringDedupCleaningTask(BoolObjectClosure* is_alive,
  35                                                  OopClosure* keep_alive,
  36                                                  bool resize_table) :
  37   AbstractGangTask("String Dedup Cleaning"),
  38   _dedup_closure(is_alive, keep_alive) {
  39 
  40   if (StringDedup::is_enabled()) {
  41     StringDedup::gc_prologue(resize_table);
  42   }
  43 }
  44 
  45 StringDedupCleaningTask::~StringDedupCleaningTask() {
  46   if (StringDedup::is_enabled()) {
  47     StringDedup::gc_epilogue();
  48   }
  49 }
  50 
  51 void StringDedupCleaningTask::work(uint worker_id) {
  52   if (StringDedup::is_enabled()) {


 141 
 142   // this can be null so don't call InstanceKlass::cast
 143   return static_cast<InstanceKlass*>(klass);
 144 }
 145 
 146 void KlassCleaningTask::work() {
 147   ResourceMark rm;
 148 
 149   // One worker will clean the subklass/sibling klass tree.
 150   if (claim_clean_klass_tree_task()) {
 151     Klass::clean_subklass_tree();
 152   }
 153 
 154   // All workers will help cleaning the classes,
 155   InstanceKlass* klass;
 156   while ((klass = claim_next_klass()) != NULL) {
 157     clean_klass(klass);
 158   }
 159 }
 160 






















 161 ParallelCleaningTask::ParallelCleaningTask(BoolObjectClosure* is_alive,
 162                                            uint num_workers,
 163                                            bool unloading_occurred,
 164                                            bool resize_dedup_table) :
 165   AbstractGangTask("Parallel Cleaning"),
 166   _unloading_occurred(unloading_occurred),
 167   _string_dedup_task(is_alive, NULL, resize_dedup_table),
 168   _code_cache_task(num_workers, is_alive, unloading_occurred),



 169   _klass_cleaning_task() {
 170 }
 171 
 172 // The parallel work done by all worker threads.
 173 void ParallelCleaningTask::work(uint worker_id) {
 174   // Do first pass of code cache cleaning.
 175   _code_cache_task.work(worker_id);
 176 
 177   // Clean the string dedup data structures.
 178   _string_dedup_task.work(worker_id);
 179 
 180   // Clean all klasses that were not unloaded.
 181   // The weak metadata in klass doesn't need to be
 182   // processed if there was no unloading.
 183   if (_unloading_occurred) {
 184     _klass_cleaning_task.work();

 185   }
 186 }


  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/symbolTable.hpp"
  27 #include "classfile/stringTable.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "gc/shared/parallelCleaning.hpp"
  30 #include "logging/log.hpp"
  31 #include "memory/resourceArea.hpp"
  32 #include "logging/log.hpp"
  33 #if INCLUDE_JVMCI
  34 #include "jvmci/jvmci.hpp"
  35 #endif
  36 
  37 StringDedupCleaningTask::StringDedupCleaningTask(BoolObjectClosure* is_alive,
  38                                                  OopClosure* keep_alive,
  39                                                  bool resize_table) :
  40   AbstractGangTask("String Dedup Cleaning"),
  41   _dedup_closure(is_alive, keep_alive) {
  42 
  43   if (StringDedup::is_enabled()) {
  44     StringDedup::gc_prologue(resize_table);
  45   }
  46 }
  47 
  48 StringDedupCleaningTask::~StringDedupCleaningTask() {
  49   if (StringDedup::is_enabled()) {
  50     StringDedup::gc_epilogue();
  51   }
  52 }
  53 
  54 void StringDedupCleaningTask::work(uint worker_id) {
  55   if (StringDedup::is_enabled()) {


 144 
 145   // this can be null so don't call InstanceKlass::cast
 146   return static_cast<InstanceKlass*>(klass);
 147 }
 148 
 149 void KlassCleaningTask::work() {
 150   ResourceMark rm;
 151 
 152   // One worker will clean the subklass/sibling klass tree.
 153   if (claim_clean_klass_tree_task()) {
 154     Klass::clean_subklass_tree();
 155   }
 156 
 157   // All workers will help cleaning the classes,
 158   InstanceKlass* klass;
 159   while ((klass = claim_next_klass()) != NULL) {
 160     clean_klass(klass);
 161   }
 162 }
 163 
 164 #if INCLUDE_JVMCI
 165 JVMCICleaningTask::JVMCICleaningTask(BoolObjectClosure* is_alive) :
 166   _is_alive(is_alive),
 167   _cleaning_claimed(0) {
 168 }
 169 
 170 bool JVMCICleaningTask::claim_cleaning_task() {
 171   if (_cleaning_claimed) {
 172     return false;
 173   }
 174 
 175   return Atomic::cmpxchg(1, &_cleaning_claimed, 0) == 0;
 176 }
 177 
 178 void JVMCICleaningTask::work(bool unloading_occurred) {
 179   // One worker will clean JVMCI metadata handles.
 180   if (EnableJVMCI && claim_cleaning_task()) {
 181     JVMCI::do_unloading(_is_alive, unloading_occurred);
 182   }
 183 }
 184 #endif // INCLUDE_JVMCI
 185 
 186 ParallelCleaningTask::ParallelCleaningTask(BoolObjectClosure* is_alive,
 187                                            uint num_workers,
 188                                            bool unloading_occurred,
 189                                            bool resize_dedup_table) :
 190   AbstractGangTask("Parallel Cleaning"),
 191   _unloading_occurred(unloading_occurred),
 192   _string_dedup_task(is_alive, NULL, resize_dedup_table),
 193   _code_cache_task(num_workers, is_alive, unloading_occurred),
 194 #if INCLUDE_JVMCI
 195   _jvmci_cleaning_task(is_alive),
 196 #endif
 197   _klass_cleaning_task() {
 198 }
 199 
 200 // The parallel work done by all worker threads.
 201 void ParallelCleaningTask::work(uint worker_id) {
 202   // Do first pass of code cache cleaning.
 203   _code_cache_task.work(worker_id);
 204 
 205   // Clean the string dedup data structures.
 206   _string_dedup_task.work(worker_id);
 207 
 208   // Clean all klasses that were not unloaded.
 209   // The weak metadata in klass doesn't need to be
 210   // processed if there was no unloading.
 211   if (_unloading_occurred) {
 212     _klass_cleaning_task.work();
 213     JVMCI_ONLY(_jvmci_cleaning_task.work(_unloading_occurred);)
 214   }
 215 }
src/hotspot/share/gc/shared/parallelCleaning.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File