< prev index next >

src/hotspot/share/gc/shared/barrierSet.hpp

8198949_arraycopy
 #include "oops/accessBackend.hpp"
 #include "oops/oopsHierarchy.hpp"
 #include "utilities/fakeRttiSupport.hpp"
 
 class JavaThread;
+class BarrierSetCodeGen;
 
 // This class provides the interface between a barrier implementation and
 // the rest of the system.
 
 class BarrierSet: public CHeapObj<mtGC> {

@@ -85,51 +86,39 bool is_a(BarrierSet::Name bsn) const { return _fake_rtti.has_tag(bsn); } // End of fake RTTI support. protected: - BarrierSet(const FakeRtti& fake_rtti) : _fake_rtti(fake_rtti) { } + BarrierSet(const FakeRtti& fake_rtti) : _fake_rtti(fake_rtti), _code_gen(NULL) { } ~BarrierSet() { } + BarrierSetCodeGen* _code_gen; + virtual BarrierSetCodeGen* make_code_gen() = 0; public: - // Operations on arrays, or general regions (e.g., for "clone") may be - // optimized by some barriers. - - // Below length is the # array elements being written - virtual void write_ref_array_pre(oop* dst, int length, - bool dest_uninitialized = false) {} - virtual void write_ref_array_pre(narrowOop* dst, int length, - bool dest_uninitialized = false) {} - // Below count is the # array elements being written, starting - // at the address "start", which may not necessarily be HeapWord-aligned - inline void write_ref_array(HeapWord* start, size_t count); - - // Static versions, suitable for calling from generated code; - // count is # array elements being written, starting with "start", - // which may not necessarily be HeapWord-aligned. - static void static_write_ref_array_pre(HeapWord* start, size_t count); - static void static_write_ref_array_post(HeapWord* start, size_t count); - // 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. virtual void on_slowpath_allocation_exit(JavaThread* thread, oop new_obj) {} virtual void on_thread_attach(JavaThread* thread) {} virtual void on_thread_detach(JavaThread* thread) {} virtual void make_parsable(JavaThread* thread) {} -protected: - virtual void write_ref_array_work(MemRegion mr) = 0; - public: // Print a description of the memory for the barrier set virtual void print_on(outputStream* st) const = 0; static void set_bs(BarrierSet* bs) { _bs = bs; } + virtual void initialize(); + + BarrierSetCodeGen* code_gen() { + assert(_code_gen != NULL, "should be set"); + return _code_gen; + } + // 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.
< prev index next >