diff --git a/src/hotspot/share/gc/shared/barrierSetConfig.hpp b/src/hotspot/share/gc/shared/barrierSetConfig.hpp index 04b23e1a684fb..ae197466d2e87 100644 --- a/src/hotspot/share/gc/shared/barrierSetConfig.hpp +++ b/src/hotspot/share/gc/shared/barrierSetConfig.hpp @@ -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) diff --git a/src/hotspot/share/gc/shared/cardTable.cpp b/src/hotspot/share/gc/shared/cardTable.cpp index 4f2e0abbe9596..9a9986aa97a3b 100644 --- a/src/hotspot/share/gc/shared/cardTable.cpp +++ b/src/hotspot/share/gc/shared/cardTable.cpp @@ -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; diff --git a/src/hotspot/share/gc/shared/gctk/gcPlan.hpp b/src/hotspot/share/gc/shared/gctk/gcPlan.hpp index 2e6a440c07cc2..35acfefc79a0f 100644 --- a/src/hotspot/share/gc/shared/gctk/gcPlan.hpp +++ b/src/hotspot/share/gc/shared/gctk/gcPlan.hpp @@ -33,7 +33,9 @@ class MemoryPool; class GCPlan: public CHeapObj { public: virtual bool moves_objects() = 0; - + + virtual size_t heap_alignment(); + virtual size_t space_alignment(); }; diff --git a/src/hotspot/share/gc/shared/gctk/thirdPartyBarrierSet.hpp b/src/hotspot/share/gc/shared/gctk/thirdPartyBarrierSet.hpp index fa850267bb7dd..6e577579a2ab0 100644 --- a/src/hotspot/share/gc/shared/gctk/thirdPartyBarrierSet.hpp +++ b/src/hotspot/share/gc/shared/gctk/thirdPartyBarrierSet.hpp @@ -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(); @@ -37,8 +39,10 @@ class ThirdPartyBarrierSet: public BarrierSet { virtual void on_thread_create(Thread* thread); virtual void on_thread_destroy(Thread* thread); - template - class AccessBarrier: public BarrierSet::AccessBarrier {}; + template + class AccessBarrier: public BarrierSet::AccessBarrier {}; }; template<> @@ -51,6 +55,29 @@ struct BarrierSet::GetType { typedef ::ThirdPartyBarrierSet type; }; +class ThirdPartyCardTableBarrierSet: public CardTableBarrierSet { +public: + ThirdPartyCardTableBarrierSet(); + + void on_thread_create(Thread* thread) override; + void on_thread_destroy(Thread* thread) override; + + template + class AccessBarrier: public BarrierSet::AccessBarrier {}; +}; + +template<> +struct BarrierSet::GetName { + static const BarrierSet::Name value = + BarrierSet::ThirdPartyCardTableBarrierSet; +}; + +template<> +struct BarrierSet::GetType { + typedef ::ThirdPartyBarrierSet type; +}; #endif // SHARE_GC_SHARED_GCTK_THIRDPARTYBARRIERSET_HPP diff --git a/src/hotspot/share/gc/shared/gctk/thirdPartyGCInitLogger.hpp b/src/hotspot/share/gc/shared/gctk/thirdPartyGCInitLogger.hpp new file mode 100644 index 0000000000000..d5d96383b1323 --- /dev/null +++ b/src/hotspot/share/gc/shared/gctk/thirdPartyGCInitLogger.hpp @@ -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