/* * Copyright (c) 2000, 2022, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
protected: // Fake RTTI support. For a derived class T to participate // - T must have a corresponding Name entry. // - GetName<T> must be specialized to return the corresponding Name // entry. // - If T is a base class, the constructor must have a FakeRtti // parameter and pass it up to its base class, with the tag set // augmented with the corresponding Name entry. // - If T is a concrete class, the constructor must create a // FakeRtti object whose tag set includes the corresponding Name // entry, and pass it up to its base class. typedef FakeRttiSupport<BarrierSet, Name> FakeRtti;
public: // Metafunction mapping a class derived from BarrierSet to the // corresponding Name enum tag. template<typename T> struct GetName;
// Metafunction mapping a Name enum type to the corresponding // lass derived from BarrierSet. template<BarrierSet::Name T> struct GetType;
// Note: This is not presently the Name corresponding to the // concrete class of this object.
BarrierSet::Name kind() const { return _fake_rtti.concrete_tag(); }
// Test whether this object is of the type corresponding to bsn. bool is_a(BarrierSet::Name bsn) const { return _fake_rtti.has_tag(bsn); }
public: // Support for optimizing compilers to call the barrier set on slow path allocations // that did not enter a TLAB. Used for e.g. ReduceInitialCardMarks. // The allocation is safe to use iff it returns true. If not, the slow-path allocation // is redone until it succeeds. This can e.g. prevent allocations from the slow path // to be in old. virtualvoid on_slowpath_allocation_exit(JavaThread* thread, oop new_obj) {} virtualvoid on_thread_create(Thread* thread) {} virtualvoid on_thread_destroy(Thread* thread) {}
// These perform BarrierSet-related initialization/cleanup before the thread // is added to or removed from the corresponding set of threads. The // argument thread is the current thread. These are called either holding // the Threads_lock (for a JavaThread) and so not at a safepoint, or holding // the NonJavaThreadsList_lock (for a NonJavaThread) locked by the // caller. That locking ensures the operation is "atomic" with the list // modification wrto operations that hold the NJTList_lock and either also // hold the Threads_lock or are at a safepoint. virtualvoid on_thread_attach(Thread* thread); virtualvoid on_thread_detach(Thread* thread) {}
virtualvoid make_parsable(JavaThread* thread) {}
public: // Print a description of the memory for the barrier set virtualvoid print_on(outputStream* st) const = 0;
// The AccessBarrier of a BarrierSet subclass is called by the Access API // (cf. oops/access.hpp) to perform decorated accesses. GC implementations // may override these default access operations by declaring an // AccessBarrier class in its BarrierSet. Its accessors will then be // automatically resolved at runtime. // // In order to register a new FooBarrierSet::AccessBarrier with the Access API, // the following steps should be taken: // 1) Provide an enum "name" for the BarrierSet in barrierSetConfig.hpp // 2) Make sure the barrier set headers are included from barrierSetConfig.inline.hpp // 3) Provide specializations for BarrierSet::GetName and BarrierSet::GetType. template <DecoratorSet decorators, typename BarrierSetT> class AccessBarrier: protected RawAccessBarrier<decorators> { private: typedef RawAccessBarrier<decorators> Raw;
public: // Primitive heap accesses. These accessors get resolved when // IN_HEAP is set (e.g. when using the HeapAccess API), it is // not an oop_* overload, and the barrier strength is AS_NORMAL. template <typename T> static T load_in_heap(T* addr) { return Raw::template load<T>(addr);
}
// Heap oop accesses. These accessors get resolved when // IN_HEAP is set (e.g. when using the HeapAccess API), it is // an oop_* overload, and the barrier strength is AS_NORMAL. template <typename T> static oop oop_load_in_heap(T* addr) { return Raw::template oop_load<oop>(addr);
}
// Off-heap oop accesses. These accessors get resolved when // IN_HEAP is not set (e.g. when using the NativeAccess API), it is // an oop* overload, and the barrier strength is AS_NORMAL. template <typename T> static oop oop_load_not_in_heap(T* addr) { return Raw::template oop_load<oop>(addr);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.