diff --git a/src/hotspot/share/gc/shared/barrierSet.hpp b/src/hotspot/share/gc/shared/barrierSet.hpp index 52cab8a..6a81fc0 100644 --- a/src/hotspot/share/gc/shared/barrierSet.hpp +++ b/src/hotspot/share/gc/shared/barrierSet.hpp @@ -33,6 +33,7 @@ #include "utilities/fakeRttiSupport.hpp" class JavaThread; +class BarrierSetCodeGen; // This class provides the interface between a barrier implementation and // the rest of the system. @@ -87,28 +88,12 @@ public: // 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 @@ -119,15 +104,19 @@ public: 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