33 #include "utilities/fakeRttiSupport.hpp" |
33 #include "utilities/fakeRttiSupport.hpp" |
34 #include "utilities/macros.hpp" |
34 #include "utilities/macros.hpp" |
35 |
35 |
36 class BarrierSetAssembler; |
36 class BarrierSetAssembler; |
37 class BarrierSetC1; |
37 class BarrierSetC1; |
|
38 class BarrierSetC2; |
38 class JavaThread; |
39 class JavaThread; |
39 |
40 |
40 // This class provides the interface between a barrier implementation and |
41 // This class provides the interface between a barrier implementation and |
41 // the rest of the system. |
42 // the rest of the system. |
42 |
43 |
68 |
69 |
69 private: |
70 private: |
70 FakeRtti _fake_rtti; |
71 FakeRtti _fake_rtti; |
71 BarrierSetAssembler* _barrier_set_assembler; |
72 BarrierSetAssembler* _barrier_set_assembler; |
72 BarrierSetC1* _barrier_set_c1; |
73 BarrierSetC1* _barrier_set_c1; |
|
74 BarrierSetC2* _barrier_set_c2; |
73 |
75 |
74 public: |
76 public: |
75 // Metafunction mapping a class derived from BarrierSet to the |
77 // Metafunction mapping a class derived from BarrierSet to the |
76 // corresponding Name enum tag. |
78 // corresponding Name enum tag. |
77 template<typename T> struct GetName; |
79 template<typename T> struct GetName; |
90 // End of fake RTTI support. |
92 // End of fake RTTI support. |
91 |
93 |
92 protected: |
94 protected: |
93 BarrierSet(BarrierSetAssembler* barrier_set_assembler, |
95 BarrierSet(BarrierSetAssembler* barrier_set_assembler, |
94 BarrierSetC1* barrier_set_c1, |
96 BarrierSetC1* barrier_set_c1, |
|
97 BarrierSetC2* barrier_set_c2, |
95 const FakeRtti& fake_rtti) : |
98 const FakeRtti& fake_rtti) : |
96 _fake_rtti(fake_rtti), |
99 _fake_rtti(fake_rtti), |
97 _barrier_set_assembler(barrier_set_assembler), |
100 _barrier_set_assembler(barrier_set_assembler), |
98 _barrier_set_c1(barrier_set_c1) {} |
101 _barrier_set_c1(barrier_set_c1), |
|
102 _barrier_set_c2(barrier_set_c2) {} |
99 ~BarrierSet() { } |
103 ~BarrierSet() { } |
100 |
104 |
101 template <class BarrierSetAssemblerT> |
105 template <class BarrierSetAssemblerT> |
102 BarrierSetAssembler* make_barrier_set_assembler() { |
106 BarrierSetAssembler* make_barrier_set_assembler() { |
103 return NOT_ZERO(new BarrierSetAssemblerT()) ZERO_ONLY(NULL); |
107 return NOT_ZERO(new BarrierSetAssemblerT()) ZERO_ONLY(NULL); |
104 } |
108 } |
105 |
109 |
106 template <class BarrierSetC1T> |
110 template <class BarrierSetC1T> |
107 BarrierSetC1* make_barrier_set_c1() { |
111 BarrierSetC1* make_barrier_set_c1() { |
108 return COMPILER1_PRESENT(new BarrierSetC1T()) NOT_COMPILER1(NULL); |
112 return COMPILER1_PRESENT(new BarrierSetC1T()) NOT_COMPILER1(NULL); |
|
113 } |
|
114 |
|
115 template <class BarrierSetC2T> |
|
116 BarrierSetC2* make_barrier_set_c2() { |
|
117 return COMPILER2_PRESENT(new BarrierSetC2T()) NOT_COMPILER2(NULL); |
109 } |
118 } |
110 |
119 |
111 public: |
120 public: |
112 // Support for optimizing compilers to call the barrier set on slow path allocations |
121 // Support for optimizing compilers to call the barrier set on slow path allocations |
113 // that did not enter a TLAB. Used for e.g. ReduceInitialCardMarks. |
122 // that did not enter a TLAB. Used for e.g. ReduceInitialCardMarks. |
134 } |
143 } |
135 |
144 |
136 BarrierSetC1* barrier_set_c1() { |
145 BarrierSetC1* barrier_set_c1() { |
137 assert(_barrier_set_c1 != NULL, "should be set"); |
146 assert(_barrier_set_c1 != NULL, "should be set"); |
138 return _barrier_set_c1; |
147 return _barrier_set_c1; |
|
148 } |
|
149 |
|
150 BarrierSetC2* barrier_set_c2() { |
|
151 assert(_barrier_set_c2 != NULL, "should be set"); |
|
152 return _barrier_set_c2; |
139 } |
153 } |
140 |
154 |
141 // The AccessBarrier of a BarrierSet subclass is called by the Access API |
155 // The AccessBarrier of a BarrierSet subclass is called by the Access API |
142 // (cf. oops/access.hpp) to perform decorated accesses. GC implementations |
156 // (cf. oops/access.hpp) to perform decorated accesses. GC implementations |
143 // may override these default access operations by declaring an |
157 // may override these default access operations by declaring an |