1.1 --- a/src/share/vm/memory/barrierSet.hpp Wed Jun 04 13:51:09 2008 -0700 1.2 +++ b/src/share/vm/memory/barrierSet.hpp Thu Jun 05 15:57:56 2008 -0700 1.3 @@ -32,6 +32,8 @@ 1.4 ModRef, 1.5 CardTableModRef, 1.6 CardTableExtension, 1.7 + G1SATBCT, 1.8 + G1SATBCTLogging, 1.9 Other, 1.10 Uninit 1.11 }; 1.12 @@ -42,14 +44,16 @@ 1.13 1.14 public: 1.15 1.16 + BarrierSet() { _kind = Uninit; } 1.17 // To get around prohibition on RTTI. 1.18 - virtual BarrierSet::Name kind() { return _kind; } 1.19 + BarrierSet::Name kind() { return _kind; } 1.20 virtual bool is_a(BarrierSet::Name bsn) = 0; 1.21 1.22 // These operations indicate what kind of barriers the BarrierSet has. 1.23 virtual bool has_read_ref_barrier() = 0; 1.24 virtual bool has_read_prim_barrier() = 0; 1.25 virtual bool has_write_ref_barrier() = 0; 1.26 + virtual bool has_write_ref_pre_barrier() = 0; 1.27 virtual bool has_write_prim_barrier() = 0; 1.28 1.29 // These functions indicate whether a particular access of the given 1.30 @@ -57,7 +61,8 @@ 1.31 virtual bool read_ref_needs_barrier(void* field) = 0; 1.32 virtual bool read_prim_needs_barrier(HeapWord* field, size_t bytes) = 0; 1.33 virtual bool write_ref_needs_barrier(void* field, oop new_val) = 0; 1.34 - virtual bool write_prim_needs_barrier(HeapWord* field, size_t bytes, juint val1, juint val2) = 0; 1.35 + virtual bool write_prim_needs_barrier(HeapWord* field, size_t bytes, 1.36 + juint val1, juint val2) = 0; 1.37 1.38 // The first four operations provide a direct implementation of the 1.39 // barrier set. An interpreter loop, for example, could call these 1.40 @@ -75,6 +80,13 @@ 1.41 // (For efficiency reasons, this operation is specialized for certain 1.42 // barrier types. Semantically, it should be thought of as a call to the 1.43 // virtual "_work" function below, which must implement the barrier.) 1.44 + // First the pre-write versions... 1.45 + inline void write_ref_field_pre(void* field, oop new_val); 1.46 +protected: 1.47 + virtual void write_ref_field_pre_work(void* field, oop new_val) {}; 1.48 +public: 1.49 + 1.50 + // ...then the post-write version. 1.51 inline void write_ref_field(void* field, oop new_val); 1.52 protected: 1.53 virtual void write_ref_field_work(void* field, oop new_val) = 0; 1.54 @@ -92,6 +104,7 @@ 1.55 // the particular barrier. 1.56 virtual bool has_read_ref_array_opt() = 0; 1.57 virtual bool has_read_prim_array_opt() = 0; 1.58 + virtual bool has_write_ref_array_pre_opt() { return true; } 1.59 virtual bool has_write_ref_array_opt() = 0; 1.60 virtual bool has_write_prim_array_opt() = 0; 1.61 1.62 @@ -104,7 +117,13 @@ 1.63 virtual void read_ref_array(MemRegion mr) = 0; 1.64 virtual void read_prim_array(MemRegion mr) = 0; 1.65 1.66 + virtual void write_ref_array_pre(MemRegion mr) {} 1.67 inline void write_ref_array(MemRegion mr); 1.68 + 1.69 + // Static versions, suitable for calling from generated code. 1.70 + static void static_write_ref_array_pre(HeapWord* start, size_t count); 1.71 + static void static_write_ref_array_post(HeapWord* start, size_t count); 1.72 + 1.73 protected: 1.74 virtual void write_ref_array_work(MemRegion mr) = 0; 1.75 public: 1.76 @@ -120,33 +139,6 @@ 1.77 virtual void write_region_work(MemRegion mr) = 0; 1.78 public: 1.79 1.80 - // The remaining sets of operations are called by compilers or other code 1.81 - // generators to insert barriers into generated code. There may be 1.82 - // several such code generators; the signatures of these 1.83 - // barrier-generating functions may differ from generator to generator. 1.84 - // There will be a set of four function signatures for each code 1.85 - // generator, which accomplish the generation of barriers of the four 1.86 - // kinds listed above. 1.87 - 1.88 -#ifdef TBD 1.89 - // Generates code to invoke the barrier, if any, necessary when reading 1.90 - // the ref field at "offset" in "obj". 1.91 - virtual void gen_read_ref_field() = 0; 1.92 - 1.93 - // Generates code to invoke the barrier, if any, necessary when reading 1.94 - // the primitive field of "bytes" bytes at offset" in "obj". 1.95 - virtual void gen_read_prim_field() = 0; 1.96 - 1.97 - // Generates code to invoke the barrier, if any, necessary when writing 1.98 - // "new_val" into the ref field at "offset" in "obj". 1.99 - virtual void gen_write_ref_field() = 0; 1.100 - 1.101 - // Generates code to invoke the barrier, if any, necessary when writing 1.102 - // the "bytes"-byte value "new_val" into the primitive field at "offset" 1.103 - // in "obj". 1.104 - virtual void gen_write_prim_field() = 0; 1.105 -#endif 1.106 - 1.107 // Some barrier sets create tables whose elements correspond to parts of 1.108 // the heap; the CardTableModRefBS is an example. Such barrier sets will 1.109 // normally reserve space for such tables, and commit parts of the table