52 #include "gc/g1/g1RemSet.hpp"
53 #include "gc/g1/g1RootClosures.hpp"
54 #include "gc/g1/g1RootProcessor.hpp"
55 #include "gc/g1/g1StringDedup.hpp"
56 #include "gc/g1/g1ThreadLocalData.hpp"
57 #include "gc/g1/g1YCTypes.hpp"
58 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
59 #include "gc/g1/heapRegion.inline.hpp"
60 #include "gc/g1/heapRegionRemSet.hpp"
61 #include "gc/g1/heapRegionSet.inline.hpp"
62 #include "gc/g1/vm_operations_g1.hpp"
63 #include "gc/shared/adaptiveSizePolicy.hpp"
64 #include "gc/shared/gcHeapSummary.hpp"
65 #include "gc/shared/gcId.hpp"
66 #include "gc/shared/gcLocker.hpp"
67 #include "gc/shared/gcTimer.hpp"
68 #include "gc/shared/gcTrace.hpp"
69 #include "gc/shared/gcTraceTime.inline.hpp"
70 #include "gc/shared/generationSpec.hpp"
71 #include "gc/shared/isGCActiveMark.hpp"
72 #include "gc/shared/preservedMarks.inline.hpp"
73 #include "gc/shared/suspendibleThreadSet.hpp"
74 #include "gc/shared/referenceProcessor.inline.hpp"
75 #include "gc/shared/taskqueue.inline.hpp"
76 #include "gc/shared/weakProcessor.hpp"
77 #include "logging/log.hpp"
78 #include "memory/allocation.hpp"
79 #include "memory/iterator.hpp"
80 #include "memory/resourceArea.hpp"
81 #include "oops/access.inline.hpp"
82 #include "oops/compressedOops.inline.hpp"
83 #include "oops/oop.inline.hpp"
84 #include "prims/resolvedMethodTable.hpp"
85 #include "runtime/atomic.hpp"
86 #include "runtime/flags/flagSetting.hpp"
87 #include "runtime/handles.inline.hpp"
88 #include "runtime/init.hpp"
89 #include "runtime/orderAccess.inline.hpp"
90 #include "runtime/threadSMR.hpp"
91 #include "runtime/vmThread.hpp"
3201 double strong_roots_ms,
3202 double term_ms,
3203 size_t term_attempts,
3204 size_t alloc_buffer_waste,
3205 size_t undo_waste) const {
3206 log_debug(gc, task, stats)
3207 ("%3d %9.2f %9.2f %6.2f "
3208 "%9.2f %6.2f " SIZE_FORMAT_W(8) " "
3209 SIZE_FORMAT_W(7) " " SIZE_FORMAT_W(7) " " SIZE_FORMAT_W(7),
3210 worker_id, elapsed_ms, strong_roots_ms, strong_roots_ms * 100 / elapsed_ms,
3211 term_ms, term_ms * 100 / elapsed_ms, term_attempts,
3212 (alloc_buffer_waste + undo_waste) * HeapWordSize / K,
3213 alloc_buffer_waste * HeapWordSize / K,
3214 undo_waste * HeapWordSize / K);
3215 }
3216
3217 class G1StringAndSymbolCleaningTask : public AbstractGangTask {
3218 private:
3219 BoolObjectClosure* _is_alive;
3220 G1StringDedupUnlinkOrOopsDoClosure _dedup_closure;
3221
3222 int _initial_string_table_size;
3223 int _initial_symbol_table_size;
3224
3225 bool _process_strings;
3226 int _strings_processed;
3227 int _strings_removed;
3228
3229 bool _process_symbols;
3230 int _symbols_processed;
3231 int _symbols_removed;
3232
3233 bool _process_string_dedup;
3234
3235 public:
3236 G1StringAndSymbolCleaningTask(BoolObjectClosure* is_alive, bool process_strings, bool process_symbols, bool process_string_dedup) :
3237 AbstractGangTask("String/Symbol Unlinking"),
3238 _is_alive(is_alive),
3239 _dedup_closure(is_alive, NULL, false),
3240 _process_strings(process_strings), _strings_processed(0), _strings_removed(0),
3241 _process_symbols(process_symbols), _symbols_processed(0), _symbols_removed(0),
3242 _process_string_dedup(process_string_dedup) {
3243
3244 _initial_string_table_size = StringTable::the_table()->table_size();
3245 _initial_symbol_table_size = SymbolTable::the_table()->table_size();
3246 if (process_strings) {
3247 StringTable::clear_parallel_claimed_index();
3248 }
3249 if (process_symbols) {
3250 SymbolTable::clear_parallel_claimed_index();
3251 }
3252 }
3253
3254 ~G1StringAndSymbolCleaningTask() {
3255 guarantee(!_process_strings || StringTable::parallel_claimed_index() >= _initial_string_table_size,
3256 "claim value %d after unlink less than initial string table size %d",
3257 StringTable::parallel_claimed_index(), _initial_string_table_size);
3258 guarantee(!_process_symbols || SymbolTable::parallel_claimed_index() >= _initial_symbol_table_size,
3259 "claim value %d after unlink less than initial symbol table size %d",
3260 SymbolTable::parallel_claimed_index(), _initial_symbol_table_size);
3261
3262 log_info(gc, stringtable)(
3263 "Cleaned string and symbol table, "
3264 "strings: " SIZE_FORMAT " processed, " SIZE_FORMAT " removed, "
3265 "symbols: " SIZE_FORMAT " processed, " SIZE_FORMAT " removed",
3266 strings_processed(), strings_removed(),
3267 symbols_processed(), symbols_removed());
3268 }
3269
3270 void work(uint worker_id) {
3271 int strings_processed = 0;
3272 int strings_removed = 0;
3273 int symbols_processed = 0;
3274 int symbols_removed = 0;
3275 if (_process_strings) {
3276 StringTable::possibly_parallel_unlink(_is_alive, &strings_processed, &strings_removed);
3277 Atomic::add(strings_processed, &_strings_processed);
3278 Atomic::add(strings_removed, &_strings_removed);
3279 }
3280 if (_process_symbols) {
3281 SymbolTable::possibly_parallel_unlink(&symbols_processed, &symbols_removed);
3282 Atomic::add(symbols_processed, &_symbols_processed);
3283 Atomic::add(symbols_removed, &_symbols_removed);
3284 }
3285 if (_process_string_dedup) {
3286 G1StringDedup::parallel_unlink(&_dedup_closure, worker_id);
3287 }
3288 }
3289
3290 size_t strings_processed() const { return (size_t)_strings_processed; }
3291 size_t strings_removed() const { return (size_t)_strings_removed; }
3292
3293 size_t symbols_processed() const { return (size_t)_symbols_processed; }
3294 size_t symbols_removed() const { return (size_t)_symbols_removed; }
3295 };
3296
|
52 #include "gc/g1/g1RemSet.hpp"
53 #include "gc/g1/g1RootClosures.hpp"
54 #include "gc/g1/g1RootProcessor.hpp"
55 #include "gc/g1/g1StringDedup.hpp"
56 #include "gc/g1/g1ThreadLocalData.hpp"
57 #include "gc/g1/g1YCTypes.hpp"
58 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
59 #include "gc/g1/heapRegion.inline.hpp"
60 #include "gc/g1/heapRegionRemSet.hpp"
61 #include "gc/g1/heapRegionSet.inline.hpp"
62 #include "gc/g1/vm_operations_g1.hpp"
63 #include "gc/shared/adaptiveSizePolicy.hpp"
64 #include "gc/shared/gcHeapSummary.hpp"
65 #include "gc/shared/gcId.hpp"
66 #include "gc/shared/gcLocker.hpp"
67 #include "gc/shared/gcTimer.hpp"
68 #include "gc/shared/gcTrace.hpp"
69 #include "gc/shared/gcTraceTime.inline.hpp"
70 #include "gc/shared/generationSpec.hpp"
71 #include "gc/shared/isGCActiveMark.hpp"
72 #include "gc/shared/oopStorageParState.hpp"
73 #include "gc/shared/preservedMarks.inline.hpp"
74 #include "gc/shared/suspendibleThreadSet.hpp"
75 #include "gc/shared/referenceProcessor.inline.hpp"
76 #include "gc/shared/taskqueue.inline.hpp"
77 #include "gc/shared/weakProcessor.hpp"
78 #include "logging/log.hpp"
79 #include "memory/allocation.hpp"
80 #include "memory/iterator.hpp"
81 #include "memory/resourceArea.hpp"
82 #include "oops/access.inline.hpp"
83 #include "oops/compressedOops.inline.hpp"
84 #include "oops/oop.inline.hpp"
85 #include "prims/resolvedMethodTable.hpp"
86 #include "runtime/atomic.hpp"
87 #include "runtime/flags/flagSetting.hpp"
88 #include "runtime/handles.inline.hpp"
89 #include "runtime/init.hpp"
90 #include "runtime/orderAccess.inline.hpp"
91 #include "runtime/threadSMR.hpp"
92 #include "runtime/vmThread.hpp"
3202 double strong_roots_ms,
3203 double term_ms,
3204 size_t term_attempts,
3205 size_t alloc_buffer_waste,
3206 size_t undo_waste) const {
3207 log_debug(gc, task, stats)
3208 ("%3d %9.2f %9.2f %6.2f "
3209 "%9.2f %6.2f " SIZE_FORMAT_W(8) " "
3210 SIZE_FORMAT_W(7) " " SIZE_FORMAT_W(7) " " SIZE_FORMAT_W(7),
3211 worker_id, elapsed_ms, strong_roots_ms, strong_roots_ms * 100 / elapsed_ms,
3212 term_ms, term_ms * 100 / elapsed_ms, term_attempts,
3213 (alloc_buffer_waste + undo_waste) * HeapWordSize / K,
3214 alloc_buffer_waste * HeapWordSize / K,
3215 undo_waste * HeapWordSize / K);
3216 }
3217
3218 class G1StringAndSymbolCleaningTask : public AbstractGangTask {
3219 private:
3220 BoolObjectClosure* _is_alive;
3221 G1StringDedupUnlinkOrOopsDoClosure _dedup_closure;
3222 OopStorage::ParState<false /* concurrent */, false /* const */> _par_state_string;
3223
3224 int _initial_string_table_size;
3225 int _initial_symbol_table_size;
3226
3227 bool _process_strings;
3228 int _strings_processed;
3229 int _strings_removed;
3230
3231 bool _process_symbols;
3232 int _symbols_processed;
3233 int _symbols_removed;
3234
3235 bool _process_string_dedup;
3236
3237 public:
3238 G1StringAndSymbolCleaningTask(BoolObjectClosure* is_alive, bool process_strings, bool process_symbols, bool process_string_dedup) :
3239 AbstractGangTask("String/Symbol Unlinking"),
3240 _is_alive(is_alive),
3241 _dedup_closure(is_alive, NULL, false),
3242 _par_state_string(StringTable::weak_storage()),
3243 _process_strings(process_strings), _strings_processed(0), _strings_removed(0),
3244 _process_symbols(process_symbols), _symbols_processed(0), _symbols_removed(0),
3245 _process_string_dedup(process_string_dedup) {
3246
3247 _initial_string_table_size = (int) StringTable::the_table()->table_size();
3248 _initial_symbol_table_size = SymbolTable::the_table()->table_size();
3249 if (process_symbols) {
3250 SymbolTable::clear_parallel_claimed_index();
3251 }
3252 }
3253
3254 ~G1StringAndSymbolCleaningTask() {
3255 guarantee(!_process_symbols || SymbolTable::parallel_claimed_index() >= _initial_symbol_table_size,
3256 "claim value %d after unlink less than initial symbol table size %d",
3257 SymbolTable::parallel_claimed_index(), _initial_symbol_table_size);
3258
3259 log_info(gc, stringtable)(
3260 "Cleaned string and symbol table, "
3261 "strings: " SIZE_FORMAT " processed, " SIZE_FORMAT " removed, "
3262 "symbols: " SIZE_FORMAT " processed, " SIZE_FORMAT " removed",
3263 strings_processed(), strings_removed(),
3264 symbols_processed(), symbols_removed());
3265 }
3266
3267 void work(uint worker_id) {
3268 int strings_processed = 0;
3269 int strings_removed = 0;
3270 int symbols_processed = 0;
3271 int symbols_removed = 0;
3272 if (_process_strings) {
3273 StringTable::possibly_parallel_unlink(&_par_state_string, _is_alive, &strings_processed, &strings_removed);
3274 Atomic::add(strings_processed, &_strings_processed);
3275 Atomic::add(strings_removed, &_strings_removed);
3276 }
3277 if (_process_symbols) {
3278 SymbolTable::possibly_parallel_unlink(&symbols_processed, &symbols_removed);
3279 Atomic::add(symbols_processed, &_symbols_processed);
3280 Atomic::add(symbols_removed, &_symbols_removed);
3281 }
3282 if (_process_string_dedup) {
3283 G1StringDedup::parallel_unlink(&_dedup_closure, worker_id);
3284 }
3285 }
3286
3287 size_t strings_processed() const { return (size_t)_strings_processed; }
3288 size_t strings_removed() const { return (size_t)_strings_removed; }
3289
3290 size_t symbols_processed() const { return (size_t)_symbols_processed; }
3291 size_t symbols_removed() const { return (size_t)_symbols_removed; }
3292 };
3293
|