2008-06-05 15:57:56 -07:00
|
|
|
/*
|
2019-01-10 15:13:51 -05:00
|
|
|
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
|
2008-06-05 15:57:56 -07:00
|
|
|
* 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.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2008-06-05 15:57:56 -07:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#ifndef SHARE_GC_G1_G1BARRIERSET_HPP
|
|
|
|
#define SHARE_GC_G1_G1BARRIERSET_HPP
|
2010-11-23 13:22:55 -08:00
|
|
|
|
2018-04-12 08:25:30 +02:00
|
|
|
#include "gc/g1/dirtyCardQueue.hpp"
|
2018-08-09 22:51:48 +02:00
|
|
|
#include "gc/g1/g1SATBMarkQueueSet.hpp"
|
2018-03-19 07:38:18 +01:00
|
|
|
#include "gc/shared/cardTableBarrierSet.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
|
2008-06-05 15:57:56 -07:00
|
|
|
class DirtyCardQueueSet;
|
2018-02-26 09:34:12 +01:00
|
|
|
class CardTable;
|
|
|
|
class G1CardTable;
|
2008-06-05 15:57:56 -07:00
|
|
|
|
|
|
|
// This barrier is specialized to use a logging barrier to support
|
|
|
|
// snapshot-at-the-beginning marking.
|
|
|
|
|
2018-03-19 07:38:18 +01:00
|
|
|
class G1BarrierSet: public CardTableBarrierSet {
|
2015-10-08 12:49:30 -10:00
|
|
|
friend class VMStructs;
|
2018-03-06 08:36:44 +01:00
|
|
|
private:
|
2018-11-15 19:59:10 -05:00
|
|
|
BufferNode::Allocator _satb_mark_queue_buffer_allocator;
|
|
|
|
BufferNode::Allocator _dirty_card_queue_buffer_allocator;
|
2018-08-13 18:21:26 -04:00
|
|
|
G1SATBMarkQueueSet _satb_mark_queue_set;
|
|
|
|
DirtyCardQueueSet _dirty_card_queue_set;
|
|
|
|
|
|
|
|
static G1BarrierSet* g1_barrier_set() {
|
|
|
|
return barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
|
|
|
|
}
|
2018-03-06 08:36:44 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
G1BarrierSet(G1CardTable* table);
|
|
|
|
~G1BarrierSet() { }
|
2015-01-27 13:50:31 -05:00
|
|
|
|
2008-06-05 15:57:56 -07:00
|
|
|
// Add "pre_val" to a set of objects that may have been disconnected from the
|
|
|
|
// pre-marking object graph.
|
|
|
|
static void enqueue(oop pre_val);
|
|
|
|
|
2018-06-12 18:12:59 -04:00
|
|
|
static void enqueue_if_weak(DecoratorSet decorators, oop value);
|
2008-06-05 15:57:56 -07:00
|
|
|
|
2018-03-21 14:38:32 +01:00
|
|
|
template <class T> void write_ref_array_pre_work(T* dst, size_t count);
|
|
|
|
virtual void write_ref_array_pre(oop* dst, size_t count, bool dest_uninitialized);
|
|
|
|
virtual void write_ref_array_pre(narrowOop* dst, size_t count, bool dest_uninitialized);
|
|
|
|
|
2017-11-20 13:07:44 +01:00
|
|
|
template <DecoratorSet decorators, typename T>
|
|
|
|
void write_ref_field_pre(T* field);
|
2014-08-19 14:09:10 +02:00
|
|
|
|
2008-06-05 15:57:56 -07:00
|
|
|
// NB: if you do a whole-heap invalidation, the "usual invariant" defined
|
|
|
|
// above no longer applies.
|
2016-11-24 16:48:22 +03:00
|
|
|
void invalidate(MemRegion mr);
|
2008-06-05 15:57:56 -07:00
|
|
|
|
2018-01-10 22:48:27 +01:00
|
|
|
void write_region(MemRegion mr) { invalidate(mr); }
|
2008-06-05 15:57:56 -07:00
|
|
|
void write_ref_array_work(MemRegion mr) { invalidate(mr); }
|
2017-11-20 13:07:44 +01:00
|
|
|
|
|
|
|
template <DecoratorSet decorators, typename T>
|
|
|
|
void write_ref_field_post(T* field, oop new_val);
|
|
|
|
void write_ref_field_post_slow(volatile jbyte* byte);
|
|
|
|
|
2018-04-12 08:25:56 +02:00
|
|
|
virtual void on_thread_create(Thread* thread);
|
|
|
|
virtual void on_thread_destroy(Thread* thread);
|
2018-02-16 12:18:09 +01:00
|
|
|
virtual void on_thread_attach(JavaThread* thread);
|
|
|
|
virtual void on_thread_detach(JavaThread* thread);
|
2018-01-10 22:48:27 +01:00
|
|
|
|
2018-11-15 19:59:10 -05:00
|
|
|
BufferNode::Allocator& satb_mark_queue_buffer_allocator();
|
|
|
|
BufferNode::Allocator& dirty_card_queue_buffer_allocator();
|
|
|
|
|
2018-08-13 18:21:26 -04:00
|
|
|
static G1SATBMarkQueueSet& satb_mark_queue_set() {
|
|
|
|
return g1_barrier_set()->_satb_mark_queue_set;
|
2018-04-12 08:25:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static DirtyCardQueueSet& dirty_card_queue_set() {
|
2018-08-13 18:21:26 -04:00
|
|
|
return g1_barrier_set()->_dirty_card_queue_set;
|
2018-04-12 08:25:30 +02:00
|
|
|
}
|
|
|
|
|
2017-11-20 13:07:44 +01:00
|
|
|
// Callbacks for runtime accesses.
|
2018-03-06 08:36:44 +01:00
|
|
|
template <DecoratorSet decorators, typename BarrierSetT = G1BarrierSet>
|
2017-11-20 13:07:44 +01:00
|
|
|
class AccessBarrier: public ModRefBarrierSet::AccessBarrier<decorators, BarrierSetT> {
|
|
|
|
typedef ModRefBarrierSet::AccessBarrier<decorators, BarrierSetT> ModRef;
|
|
|
|
typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Needed for loads on non-heap weak references
|
|
|
|
template <typename T>
|
|
|
|
static oop oop_load_not_in_heap(T* addr);
|
|
|
|
|
|
|
|
// Needed for non-heap stores
|
|
|
|
template <typename T>
|
|
|
|
static void oop_store_not_in_heap(T* addr, oop new_value);
|
|
|
|
|
|
|
|
// Needed for weak references
|
|
|
|
static oop oop_load_in_heap_at(oop base, ptrdiff_t offset);
|
|
|
|
|
|
|
|
// Defensive: will catch weak oops at addresses in heap
|
|
|
|
template <typename T>
|
|
|
|
static oop oop_load_in_heap(T* addr);
|
|
|
|
};
|
2008-06-05 15:57:56 -07:00
|
|
|
};
|
|
|
|
|
2015-02-27 19:52:48 -05:00
|
|
|
template<>
|
2018-03-06 08:36:44 +01:00
|
|
|
struct BarrierSet::GetName<G1BarrierSet> {
|
|
|
|
static const BarrierSet::Name value = BarrierSet::G1BarrierSet;
|
2015-02-27 19:52:48 -05:00
|
|
|
};
|
|
|
|
|
2017-11-20 13:07:44 +01:00
|
|
|
template<>
|
2018-03-06 08:36:44 +01:00
|
|
|
struct BarrierSet::GetType<BarrierSet::G1BarrierSet> {
|
|
|
|
typedef ::G1BarrierSet type;
|
2017-11-20 13:07:44 +01:00
|
|
|
};
|
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#endif // SHARE_GC_G1_G1BARRIERSET_HPP
|