336 WorkGangBarrierSync _second_overflow_barrier_sync; 337 338 // This is set by any task, when an overflow on the global data 339 // structures is detected 340 volatile bool _has_overflown; 341 // True: marking is concurrent, false: we're in remark 342 volatile bool _concurrent; 343 // Set at the end of a Full GC so that marking aborts 344 volatile bool _has_aborted; 345 346 // Used when remark aborts due to an overflow to indicate that 347 // another concurrent marking phase should start 348 volatile bool _restart_for_overflow; 349 350 // This is true from the very start of concurrent marking until the 351 // point when all the tasks complete their work. It is really used 352 // to determine the points between the end of concurrent marking and 353 // time of remark. 354 volatile bool _concurrent_marking_in_progress; 355 356 // All of these times are in ms 357 NumberSeq _init_times; 358 NumberSeq _remark_times; 359 NumberSeq _remark_mark_times; 360 NumberSeq _remark_weak_ref_times; 361 NumberSeq _cleanup_times; 362 double _total_counting_time; 363 double _total_rs_scrub_time; 364 365 double* _accum_task_vtime; // Accumulated task vtime 366 367 WorkGang* _parallel_workers; 368 369 void weakRefsWorkParallelPart(BoolObjectClosure* is_alive, bool purged_classes); 370 void weakRefsWork(bool clear_all_soft_refs); 371 372 void swapMarkBitMaps(); 373 374 // It resets the global marking data structures, as well as the 375 // task local ones; should be called during initial mark. 442 CMTaskQueue* task_queue(int id) { 443 assert(0 <= id && id < (int) _active_tasks, 444 "task queue id not within active bounds"); 445 return (CMTaskQueue*) _task_queues->queue(id); 446 } 447 448 // Returns the task queue set 449 CMTaskQueueSet* task_queues() { return _task_queues; } 450 451 // Access / manipulation of the overflow flag which is set to 452 // indicate that the global stack has overflown 453 bool has_overflown() { return _has_overflown; } 454 void set_has_overflown() { _has_overflown = true; } 455 void clear_has_overflown() { _has_overflown = false; } 456 bool restart_for_overflow() { return _restart_for_overflow; } 457 458 // Methods to enter the two overflow sync barriers 459 void enter_first_sync_barrier(uint worker_id); 460 void enter_second_sync_barrier(uint worker_id); 461 462 // Live Data Counting data structures... 463 // These data structures are initialized at the start of 464 // marking. They are written to while marking is active. 465 // They are aggregated during remark; the aggregated values 466 // are then used to populate the _region_bm, _card_bm, and 467 // the total live bytes, which are then subsequently updated 468 // during cleanup. 469 470 // An array of bitmaps (one bit map per task). Each bitmap 471 // is used to record the cards spanned by the live objects 472 // marked by that task/worker. 473 BitMap* _count_card_bitmaps; 474 475 // Used to record the number of marked live bytes 476 // (for each region, by worker thread). 477 size_t** _count_marked_bytes; 478 479 // Card index of the bottom of the G1 heap. Used for biasing indices into 480 // the card bitmaps. 481 intptr_t _heap_bottom_card_num; 497 return true; 498 } 499 void mark_stack_pop(oop* arr, int max, int* n) { 500 _markStack.par_pop_arr(arr, max, n); 501 } 502 size_t mark_stack_size() { return _markStack.size(); } 503 size_t partial_mark_stack_size_target() { return _markStack.maxElems()/3; } 504 bool mark_stack_overflow() { return _markStack.overflow(); } 505 bool mark_stack_empty() { return _markStack.isEmpty(); } 506 507 CMRootRegions* root_regions() { return &_root_regions; } 508 509 bool concurrent_marking_in_progress() { 510 return _concurrent_marking_in_progress; 511 } 512 void set_concurrent_marking_in_progress() { 513 _concurrent_marking_in_progress = true; 514 } 515 void clear_concurrent_marking_in_progress() { 516 _concurrent_marking_in_progress = false; 517 } 518 519 void update_accum_task_vtime(int i, double vtime) { 520 _accum_task_vtime[i] += vtime; 521 } 522 523 double all_task_accum_vtime() { 524 double ret = 0.0; 525 for (uint i = 0; i < _max_worker_id; ++i) 526 ret += _accum_task_vtime[i]; 527 return ret; 528 } 529 530 // Attempts to steal an object from the task queues of other tasks 531 bool try_stealing(uint worker_id, int* hash_seed, oop& obj); 532 533 ConcurrentMark(G1CollectedHeap* g1h, 534 G1RegionToSpaceMapper* prev_bitmap_storage, 535 G1RegionToSpaceMapper* next_bitmap_storage); 536 ~ConcurrentMark(); | 336 WorkGangBarrierSync _second_overflow_barrier_sync; 337 338 // This is set by any task, when an overflow on the global data 339 // structures is detected 340 volatile bool _has_overflown; 341 // True: marking is concurrent, false: we're in remark 342 volatile bool _concurrent; 343 // Set at the end of a Full GC so that marking aborts 344 volatile bool _has_aborted; 345 346 // Used when remark aborts due to an overflow to indicate that 347 // another concurrent marking phase should start 348 volatile bool _restart_for_overflow; 349 350 // This is true from the very start of concurrent marking until the 351 // point when all the tasks complete their work. It is really used 352 // to determine the points between the end of concurrent marking and 353 // time of remark. 354 volatile bool _concurrent_marking_in_progress; 355 356 // True only inside of markFromRoots(). 357 // Similar to _concurrent_marking_in_progress but this is set to false 358 // when CMConcurrentMarkingTask is finished. 359 volatile bool _concurrent_marking_from_roots; 360 361 // All of these times are in ms 362 NumberSeq _init_times; 363 NumberSeq _remark_times; 364 NumberSeq _remark_mark_times; 365 NumberSeq _remark_weak_ref_times; 366 NumberSeq _cleanup_times; 367 double _total_counting_time; 368 double _total_rs_scrub_time; 369 370 double* _accum_task_vtime; // Accumulated task vtime 371 372 WorkGang* _parallel_workers; 373 374 void weakRefsWorkParallelPart(BoolObjectClosure* is_alive, bool purged_classes); 375 void weakRefsWork(bool clear_all_soft_refs); 376 377 void swapMarkBitMaps(); 378 379 // It resets the global marking data structures, as well as the 380 // task local ones; should be called during initial mark. 447 CMTaskQueue* task_queue(int id) { 448 assert(0 <= id && id < (int) _active_tasks, 449 "task queue id not within active bounds"); 450 return (CMTaskQueue*) _task_queues->queue(id); 451 } 452 453 // Returns the task queue set 454 CMTaskQueueSet* task_queues() { return _task_queues; } 455 456 // Access / manipulation of the overflow flag which is set to 457 // indicate that the global stack has overflown 458 bool has_overflown() { return _has_overflown; } 459 void set_has_overflown() { _has_overflown = true; } 460 void clear_has_overflown() { _has_overflown = false; } 461 bool restart_for_overflow() { return _restart_for_overflow; } 462 463 // Methods to enter the two overflow sync barriers 464 void enter_first_sync_barrier(uint worker_id); 465 void enter_second_sync_barrier(uint worker_id); 466 467 // Start measuring concurrent mark from ConcurrentMark::markFromRoots(). 468 void register_mark_from_roots_phase_start(); 469 470 // End measuring concurrent mark from ConcurrentMark::markFromRoots(). 471 void register_mark_from_roots_phase_end(); 472 473 // Live Data Counting data structures... 474 // These data structures are initialized at the start of 475 // marking. They are written to while marking is active. 476 // They are aggregated during remark; the aggregated values 477 // are then used to populate the _region_bm, _card_bm, and 478 // the total live bytes, which are then subsequently updated 479 // during cleanup. 480 481 // An array of bitmaps (one bit map per task). Each bitmap 482 // is used to record the cards spanned by the live objects 483 // marked by that task/worker. 484 BitMap* _count_card_bitmaps; 485 486 // Used to record the number of marked live bytes 487 // (for each region, by worker thread). 488 size_t** _count_marked_bytes; 489 490 // Card index of the bottom of the G1 heap. Used for biasing indices into 491 // the card bitmaps. 492 intptr_t _heap_bottom_card_num; 508 return true; 509 } 510 void mark_stack_pop(oop* arr, int max, int* n) { 511 _markStack.par_pop_arr(arr, max, n); 512 } 513 size_t mark_stack_size() { return _markStack.size(); } 514 size_t partial_mark_stack_size_target() { return _markStack.maxElems()/3; } 515 bool mark_stack_overflow() { return _markStack.overflow(); } 516 bool mark_stack_empty() { return _markStack.isEmpty(); } 517 518 CMRootRegions* root_regions() { return &_root_regions; } 519 520 bool concurrent_marking_in_progress() { 521 return _concurrent_marking_in_progress; 522 } 523 void set_concurrent_marking_in_progress() { 524 _concurrent_marking_in_progress = true; 525 } 526 void clear_concurrent_marking_in_progress() { 527 _concurrent_marking_in_progress = false; 528 } 529 530 bool concurrent_marking_from_roots() const { 531 return _concurrent_marking_from_roots; 532 } 533 534 void update_accum_task_vtime(int i, double vtime) { 535 _accum_task_vtime[i] += vtime; 536 } 537 538 double all_task_accum_vtime() { 539 double ret = 0.0; 540 for (uint i = 0; i < _max_worker_id; ++i) 541 ret += _accum_task_vtime[i]; 542 return ret; 543 } 544 545 // Attempts to steal an object from the task queues of other tasks 546 bool try_stealing(uint worker_id, int* hash_seed, oop& obj); 547 548 ConcurrentMark(G1CollectedHeap* g1h, 549 G1RegionToSpaceMapper* prev_bitmap_storage, 550 G1RegionToSpaceMapper* next_bitmap_storage); 551 ~ConcurrentMark(); |