Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8255019: Shenandoah: Split STW and concurrent mark into separate classes #1009

Closed
wants to merge 37 commits into from
Closed
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4798cc2
8255019: Shenandoah: Split STW and concurrent mark into separate classes
zhengyu123 Oct 30, 2020
787e6ca
Split finish mark and pre-evaculation
zhengyu123 Oct 31, 2020
6b75cf0
Make ShenandoahMarkCompact stack allocated
zhengyu123 Nov 2, 2020
e4113c3
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Nov 2, 2020
a616a46
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Nov 2, 2020
824165f
Merge
zhengyu123 Nov 4, 2020
b4efedb
Merge branch 'JDK-8255019-sh-mark' of github.com:zhengyu123/jdk into …
zhengyu123 Nov 4, 2020
bb72dea
Move weak reference processing out of STWMark and fix its timings
zhengyu123 Nov 4, 2020
9c5d0d3
Merge
zhengyu123 Nov 5, 2020
75e6a85
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Nov 5, 2020
fe93d95
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Nov 9, 2020
6896e06
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Nov 11, 2020
71b38b4
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Nov 11, 2020
91886ed
Removed obsoleted class
zhengyu123 Nov 12, 2020
4322490
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Nov 13, 2020
7524feb
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Nov 14, 2020
701880d
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Nov 17, 2020
f65e3da
Merge
zhengyu123 Nov 18, 2020
403ec58
Moved task queues to marking context
zhengyu123 Nov 18, 2020
8c58f6f
Merge
zhengyu123 Nov 20, 2020
9301167
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Nov 23, 2020
c9842ef
Removed ShenandoahConcurrentMark parameter from concurrent GC entry/o…
zhengyu123 Nov 23, 2020
0c7b594
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Dec 1, 2020
367c9fc
Silent valgrind on potential memory leak
zhengyu123 Dec 1, 2020
c16fd77
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Dec 3, 2020
05faa44
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Dec 9, 2020
0cb404d
Concurrent mark does not expect forwarded objects
zhengyu123 Dec 11, 2020
85a4469
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Dec 11, 2020
cde2011
Merge
zhengyu123 Jan 4, 2021
4b367ed
Update copyright years
zhengyu123 Jan 4, 2021
b7390c0
Merge
zhengyu123 Jan 5, 2021
8cd3f9d
@shade's comments
zhengyu123 Jan 5, 2021
dd57c07
Silent MacOSX build
zhengyu123 Jan 5, 2021
a6540b9
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Jan 5, 2021
37cda8b
Fixes based on shade's comments
zhengyu123 Jan 11, 2021
4fbbfd2
Merge branch 'master' into JDK-8255019-sh-mark
zhengyu123 Jan 13, 2021
8a6d94b
Merge
zhengyu123 Jan 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

Large diffs are not rendered by default.

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Red Hat, Inc. All rights reserved.
* Copyright (c) 2013, 2021, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,69 +27,38 @@

#include "gc/shared/taskqueue.hpp"
#include "gc/shared/taskTerminator.hpp"
#include "gc/shenandoah/shenandoahMark.hpp"
#include "gc/shenandoah/shenandoahOopClosures.hpp"
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
#include "gc/shenandoah/shenandoahTaskqueue.hpp"

class ShenandoahStrDedupQueue;
class ShenandoahReferenceProcessor;

class ShenandoahConcurrentMark: public CHeapObj<mtGC> {
private:
ShenandoahHeap* _heap;
ShenandoahObjToScanQueueSet* _task_queues;
class ShenandoahConcurrentMark: public ShenandoahMark {
friend class ShenandoahConcurrentMarkingTask;
friend class ShenandoahFinalMarkingTask;

public:
void initialize(uint workers);
void cancel();

// ---------- Marking loop and tasks
//
private:
template <class T>
inline void do_task(ShenandoahObjToScanQueue* q, T* cl, ShenandoahLiveData* live_data, ShenandoahMarkTask* task);
ShenandoahConcurrentMark();

template <class T>
inline void do_chunked_array_start(ShenandoahObjToScanQueue* q, T* cl, oop array, bool weak);
// When concurrent stack processing is not supported
void mark_stw_roots();
void mark_concurrent_roots();

template <class T>
inline void do_chunked_array(ShenandoahObjToScanQueue* q, T* cl, oop array, int chunk, int pow, bool weak);
// Concurrent mark
void concurrent_mark();
// Finish mark at a safepoint
void finish_mark();

inline void count_liveness(ShenandoahLiveData* live_data, oop obj);

template <class T, bool CANCELLABLE>
void mark_loop_work(T* cl, ShenandoahLiveData* live_data, uint worker_id, TaskTerminator *t);

template <bool CANCELLABLE>
void mark_loop_prework(uint worker_id, TaskTerminator *terminator, ShenandoahReferenceProcessor* rp, bool strdedup);

public:
void mark_loop(uint worker_id, TaskTerminator* terminator, ShenandoahReferenceProcessor* rp,
bool cancellable, bool strdedup) {
if (cancellable) {
mark_loop_prework<true>(worker_id, terminator, rp, strdedup);
} else {
mark_loop_prework<false>(worker_id, terminator, rp, strdedup);
}
}
static void cancel();

template<class T, UpdateRefsMode UPDATE_REFS, StringDedupMode STRING_DEDUP>
static inline void mark_through_ref(T* p, ShenandoahHeap* heap, ShenandoahObjToScanQueue* q, ShenandoahMarkingContext* const mark_context, bool weak);

void mark_from_roots();
void finish_mark_from_roots(bool full_gc);

void mark_roots(ShenandoahPhaseTimings::Phase root_phase);
void update_roots(ShenandoahPhaseTimings::Phase root_phase);
void update_thread_roots(ShenandoahPhaseTimings::Phase root_phase);

// ---------- Helpers
// Used from closures, need to be public
//
public:
ShenandoahObjToScanQueue* get_queue(uint worker_id);
ShenandoahObjToScanQueueSet* task_queues() { return _task_queues; }
// TODO: where to put them
static void update_roots(ShenandoahPhaseTimings::Phase root_phase);
static void update_thread_roots(ShenandoahPhaseTimings::Phase root_phase);
zhengyu123 marked this conversation as resolved.
Show resolved Hide resolved

private:
void finish_mark_work();
};

#endif // SHARE_GC_SHENANDOAH_SHENANDOAHCONCURRENTMARK_HPP
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Red Hat, Inc. All rights reserved.
* Copyright (c) 2013, 2021, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,12 +24,13 @@

#include "precompiled.hpp"

#include "gc/shenandoah/shenandoahConcurrentMark.inline.hpp"
#include "gc/shenandoah/shenandoahConcurrentMark.hpp"
#include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
#include "gc/shenandoah/shenandoahControlThread.hpp"
#include "gc/shenandoah/shenandoahFreeSet.hpp"
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahMark.inline.hpp"
#include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
#include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
#include "gc/shenandoah/shenandoahUtils.hpp"
@@ -397,6 +398,10 @@ void ShenandoahControlThread::service_concurrent_normal_cycle(GCCause::Cause cau
// Start initial mark under STW
heap->vmop_entry_init_mark();

// Concurrent mark roots
heap->entry_mark_roots();
if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_outside_cycle)) return;

// Continue concurrent mark
heap->entry_mark();
if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_mark)) return;