Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
LizBing committed Aug 26, 2024
1 parent b625251 commit c4d3020
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/hotspot/share/gc/shared/barrierSetConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
SHENANDOAHGC_ONLY(f(ShenandoahBarrierSet)) \
ZGC_ONLY(f(XBarrierSet)) \
ZGC_ONLY(f(ZBarrierSet)) \
GCTK_ONLY(f(ThirdPartyBarrierSet))
GCTK_ONLY(f(ThirdPartyBarrierSet)) \
GCTK_ONLY(f(ThirdPartyCardTableBarrierSet))

#define FOR_EACH_ABSTRACT_BARRIER_SET_DO(f) \
f(ModRef)
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/cardTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ uint CardTable::_card_size = 0;
uint CardTable::_card_size_in_words = 0;

void CardTable::initialize_card_size() {
assert(UseG1GC || UseParallelGC || UseSerialGC,
assert(UseG1GC || UseParallelGC || UseSerialGC || EnableThirdPartyGCs,
"Initialize card size should only be called by card based collectors.");

_card_size = GCCardSizeInBytes;
Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/gc/shared/gctk/gcPlan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ class MemoryPool;
class GCPlan: public CHeapObj<mtGC> {
public:
virtual bool moves_objects() = 0;


virtual size_t heap_alignment();
virtual size_t space_alignment();
};


Expand Down
35 changes: 31 additions & 4 deletions src/hotspot/share/gc/shared/gctk/thirdPartyBarrierSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
#define SHARE_GC_SHARED_GCTK_THIRDPARTYBARRIERSET_HPP

#include "gc/shared/barrierSet.hpp"
#include "gc/shared/cardTableBarrierSet.inline.hpp"

// The default third party barrier set does nothing.
// To define ones that qualify for your own plans,
// please follow the guide written in 'barrierSet.hpp'.
class ThirdPartyBarrierSet: public BarrierSet {
friend class VMStructs;

public:
ThirdPartyBarrierSet();

Expand All @@ -37,8 +39,10 @@ class ThirdPartyBarrierSet: public BarrierSet {
virtual void on_thread_create(Thread* thread);
virtual void on_thread_destroy(Thread* thread);

template <DecoratorSet decorators, typename BarrierSetT = ThirdPartyBarrierSet>
class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> {};
template <DecoratorSet decorators, typename BarrierSetT =
ThirdPartyBarrierSet>
class AccessBarrier: public BarrierSet::AccessBarrier<decorators,
BarrierSetT> {};
};

template<>
Expand All @@ -51,6 +55,29 @@ struct BarrierSet::GetType<BarrierSet::ThirdPartyBarrierSet> {
typedef ::ThirdPartyBarrierSet type;
};

class ThirdPartyCardTableBarrierSet: public CardTableBarrierSet {
public:
ThirdPartyCardTableBarrierSet();

void on_thread_create(Thread* thread) override;
void on_thread_destroy(Thread* thread) override;

template <DecoratorSet decorators, typename BarrierSetT =
ThirdPartyCardTableBarrierSet>
class AccessBarrier: public BarrierSet::AccessBarrier<decorators,
BarrierSetT> {};
};

template<>
struct BarrierSet::GetName<ThirdPartyCardTableBarrierSet> {
static const BarrierSet::Name value =
BarrierSet::ThirdPartyCardTableBarrierSet;
};

template<>
struct BarrierSet::GetType<BarrierSet::ThirdPartyCardTableBarrierSet> {
typedef ::ThirdPartyBarrierSet type;
};

#endif // SHARE_GC_SHARED_GCTK_THIRDPARTYBARRIERSET_HPP

32 changes: 32 additions & 0 deletions src/hotspot/share/gc/shared/gctk/thirdPartyGCInitLogger.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2024, Lei Zaakjyu. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Lei Zaakjyu(E-mail: leizaakjyu@163.com) if you need additional
* information or have any questions.
*
*/

#ifndef SHARE_GC_SHARED_GCTK_THIRDPARTYGCINITLOGGER_HPP
#define SHARE_GC_SHARED_GCTK_THIRDPARTYGCINITLOGGER_HPP

#include "gc/shared/gcInitLogger.hpp"

class ThirdPartyGCInitLogger : public GCInitLogger {};


#endif // SHARE_GC_SHARED_GCTK_THIRDPARTYGCINITLOGGER_HPP

0 comments on commit c4d3020

Please sign in to comment.