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 "gc_implementation/g1/concurrentMark.inline.hpp"
28 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
29 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
30 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
31 #include "gc_implementation/g1/g1ErgoVerbose.hpp"
32 #include "gc_implementation/g1/g1Log.hpp"
33 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
34 #include "gc_implementation/g1/g1RemSet.hpp"
35 #include "gc_implementation/g1/heapRegion.inline.hpp"
36 #include "gc_implementation/g1/heapRegionRemSet.hpp"
37 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
38 #include "gc_implementation/shared/vmGCOperations.hpp"
39 #include "gc_implementation/shared/gcTimer.hpp"
40 #include "gc_implementation/shared/gcTrace.hpp"
41 #include "gc_implementation/shared/gcTraceTime.hpp"
42 #include "memory/genOopClosures.inline.hpp"
43 #include "memory/referencePolicy.hpp"
44 #include "memory/resourceArea.hpp"
45 #include "oops/oop.inline.hpp"
46 #include "runtime/handles.inline.hpp"
47 #include "runtime/java.hpp"
48 #include "services/memTracker.hpp"
49
50 // Concurrent marking bit map wrapper
51
52 CMBitMapRO::CMBitMapRO(int shifter) :
53 _bm(),
54 _shifter(shifter) {
55 _bmStartWord = 0;
56 _bmWordSize = 0;
57 }
2516
2517 if (_markStack.overflow()) {
2518 // This should have been done already when we tried to push an
2519 // entry on to the global mark stack. But let's do it again.
2520 set_has_overflown();
2521 }
2522
2523 assert(rp->num_q() == active_workers, "why not");
2524
2525 rp->enqueue_discovered_references(executor);
2526
2527 rp->verify_no_references_recorded();
2528 assert(!rp->discovery_enabled(), "Post condition");
2529 }
2530
2531 if (has_overflown()) {
2532 // We can not trust g1_is_alive if the marking stack overflowed
2533 return;
2534 }
2535
2536 g1h->unlink_string_and_symbol_table(&g1_is_alive,
2537 /* process_strings */ false, // currently strings are always roots
2538 /* process_symbols */ true);
2539 }
2540
2541 void ConcurrentMark::swapMarkBitMaps() {
2542 CMBitMapRO* temp = _prevMarkBitMap;
2543 _prevMarkBitMap = (CMBitMapRO*)_nextMarkBitMap;
2544 _nextMarkBitMap = (CMBitMap*) temp;
2545 }
2546
2547 class CMRemarkTask: public AbstractGangTask {
2548 private:
2549 ConcurrentMark* _cm;
2550 bool _is_serial;
2551 public:
2552 void work(uint worker_id) {
2553 // Since all available tasks are actually started, we should
2554 // only proceed if we're supposed to be active.
2555 if (worker_id < _cm->active_tasks()) {
|
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 "gc_implementation/g1/concurrentMark.inline.hpp"
28 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
29 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
30 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
31 #include "gc_implementation/g1/g1ErgoVerbose.hpp"
32 #include "gc_implementation/g1/g1Log.hpp"
33 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
34 #include "gc_implementation/g1/g1RemSet.hpp"
35 #include "gc_implementation/g1/heapRegion.inline.hpp"
36 #include "gc_implementation/g1/heapRegionRemSet.hpp"
37 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
38 #include "gc_implementation/g1/stringDedup.hpp"
39 #include "gc_implementation/shared/vmGCOperations.hpp"
40 #include "gc_implementation/shared/gcTimer.hpp"
41 #include "gc_implementation/shared/gcTrace.hpp"
42 #include "gc_implementation/shared/gcTraceTime.hpp"
43 #include "memory/genOopClosures.inline.hpp"
44 #include "memory/referencePolicy.hpp"
45 #include "memory/resourceArea.hpp"
46 #include "oops/oop.inline.hpp"
47 #include "runtime/handles.inline.hpp"
48 #include "runtime/java.hpp"
49 #include "services/memTracker.hpp"
50
51 // Concurrent marking bit map wrapper
52
53 CMBitMapRO::CMBitMapRO(int shifter) :
54 _bm(),
55 _shifter(shifter) {
56 _bmStartWord = 0;
57 _bmWordSize = 0;
58 }
2517
2518 if (_markStack.overflow()) {
2519 // This should have been done already when we tried to push an
2520 // entry on to the global mark stack. But let's do it again.
2521 set_has_overflown();
2522 }
2523
2524 assert(rp->num_q() == active_workers, "why not");
2525
2526 rp->enqueue_discovered_references(executor);
2527
2528 rp->verify_no_references_recorded();
2529 assert(!rp->discovery_enabled(), "Post condition");
2530 }
2531
2532 if (has_overflown()) {
2533 // We can not trust g1_is_alive if the marking stack overflowed
2534 return;
2535 }
2536
2537 // Unlink stale oops in string deduplication queue/table
2538 StringDedup::unlink(&g1_is_alive);
2539
2540 g1h->unlink_string_and_symbol_table(&g1_is_alive,
2541 /* process_strings */ false, // currently strings are always roots
2542 /* process_symbols */ true);
2543 }
2544
2545 void ConcurrentMark::swapMarkBitMaps() {
2546 CMBitMapRO* temp = _prevMarkBitMap;
2547 _prevMarkBitMap = (CMBitMapRO*)_nextMarkBitMap;
2548 _nextMarkBitMap = (CMBitMap*) temp;
2549 }
2550
2551 class CMRemarkTask: public AbstractGangTask {
2552 private:
2553 ConcurrentMark* _cm;
2554 bool _is_serial;
2555 public:
2556 void work(uint worker_id) {
2557 // Since all available tasks are actually started, we should
2558 // only proceed if we're supposed to be active.
2559 if (worker_id < _cm->active_tasks()) {
|