13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_GC_SHARED_BARRIERSET_HPP
26 #define SHARE_GC_SHARED_BARRIERSET_HPP
27
28 #include "gc/shared/barrierSetConfig.hpp"
29 #include "memory/memRegion.hpp"
30 #include "oops/access.hpp"
31 #include "oops/accessBackend.hpp"
32 #include "oops/oopsHierarchy.hpp"
33 #include "utilities/fakeRttiSupport.hpp"
34 #include "utilities/macros.hpp"
35
36 class BarrierSetAssembler;
37 class BarrierSetC1;
38 class BarrierSetC2;
39 class BarrierSetNMethod;
40 class BarrierSetStackChunk;
41 class JavaThread;
42
43 // This class provides the interface between a barrier implementation and
44 // the rest of the system.
45
46 class BarrierSet: public CHeapObj<mtGC> {
47 friend class VMStructs;
48
49 static BarrierSet* _barrier_set;
50
51 public:
52 enum Name {
295
296 template <typename T>
297 static void oop_store_not_in_heap(T* addr, oop value) {
298 Raw::oop_store(addr, value);
299 }
300
301 template <typename T>
302 static oop oop_atomic_cmpxchg_not_in_heap(T* addr, oop compare_value, oop new_value) {
303 return Raw::oop_atomic_cmpxchg(addr, compare_value, new_value);
304 }
305
306 template <typename T>
307 static oop oop_atomic_xchg_not_in_heap(T* addr, oop new_value) {
308 return Raw::oop_atomic_xchg(addr, new_value);
309 }
310
311 // Clone barrier support
312 static void clone_in_heap(oop src, oop dst, size_t size) {
313 Raw::clone(src, dst, size);
314 }
315 };
316 };
317
318 template<typename T>
319 inline T* barrier_set_cast(BarrierSet* bs) {
320 assert(bs->is_a(BarrierSet::GetName<T>::value), "wrong type of barrier set");
321 return static_cast<T*>(bs);
322 }
323
324 #endif // SHARE_GC_SHARED_BARRIERSET_HPP
|
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_GC_SHARED_BARRIERSET_HPP
26 #define SHARE_GC_SHARED_BARRIERSET_HPP
27
28 #include "gc/shared/barrierSetConfig.hpp"
29 #include "memory/memRegion.hpp"
30 #include "oops/access.hpp"
31 #include "oops/accessBackend.hpp"
32 #include "oops/oopsHierarchy.hpp"
33 #include "utilities/exceptions.hpp"
34 #include "utilities/fakeRttiSupport.hpp"
35 #include "utilities/macros.hpp"
36
37 class BarrierSetAssembler;
38 class BarrierSetC1;
39 class BarrierSetC2;
40 class BarrierSetNMethod;
41 class BarrierSetStackChunk;
42 class JavaThread;
43
44 // This class provides the interface between a barrier implementation and
45 // the rest of the system.
46
47 class BarrierSet: public CHeapObj<mtGC> {
48 friend class VMStructs;
49
50 static BarrierSet* _barrier_set;
51
52 public:
53 enum Name {
296
297 template <typename T>
298 static void oop_store_not_in_heap(T* addr, oop value) {
299 Raw::oop_store(addr, value);
300 }
301
302 template <typename T>
303 static oop oop_atomic_cmpxchg_not_in_heap(T* addr, oop compare_value, oop new_value) {
304 return Raw::oop_atomic_cmpxchg(addr, compare_value, new_value);
305 }
306
307 template <typename T>
308 static oop oop_atomic_xchg_not_in_heap(T* addr, oop new_value) {
309 return Raw::oop_atomic_xchg(addr, new_value);
310 }
311
312 // Clone barrier support
313 static void clone_in_heap(oop src, oop dst, size_t size) {
314 Raw::clone(src, dst, size);
315 }
316
317 static void value_copy_in_heap(void* src, void* dst, InlineKlass* md, LayoutKind lk) {
318 Raw::value_copy(src, dst, md, lk);
319 }
320
321 };
322 };
323
324 template<typename T>
325 inline T* barrier_set_cast(BarrierSet* bs) {
326 assert(bs->is_a(BarrierSet::GetName<T>::value), "wrong type of barrier set");
327 return static_cast<T*>(bs);
328 }
329
330 #endif // SHARE_GC_SHARED_BARRIERSET_HPP
|