< prev index next >
src/share/vm/memory/barrierSet.hpp
Print this page
*** 66,80 ****
template<typename T> struct GetName;
// Downcast argument to a derived barrier set type.
// The cast is checked in a debug build.
// T must have a specialization for BarrierSet::GetName<T>.
! template<typename T>
! friend T* barrier_set_cast(BarrierSet* bs) {
! assert(bs->is_a(BarrierSet::GetName<T>::value), "wrong type of barrier set");
! return static_cast<T*>(bs);
! }
public:
// Note: This is not presently the Name corresponding to the
// concrete class of this object.
BarrierSet::Name kind() const { return _fake_rtti.concrete_tag(); }
--- 66,76 ----
template<typename T> struct GetName;
// Downcast argument to a derived barrier set type.
// The cast is checked in a debug build.
// T must have a specialization for BarrierSet::GetName<T>.
! template<typename T> friend T* barrier_set_cast(BarrierSet* bs);
public:
// Note: This is not presently the Name corresponding to the
// concrete class of this object.
BarrierSet::Name kind() const { return _fake_rtti.concrete_tag(); }
*** 214,219 ****
--- 210,221 ----
// Print a description of the memory for the barrier set
virtual void print_on(outputStream* st) const = 0;
};
+ template<typename T>
+ inline T* barrier_set_cast(BarrierSet* bs) {
+ assert(bs->is_a(BarrierSet::GetName<T>::value), "wrong type of barrier set");
+ return static_cast<T*>(bs);
+ }
+
#endif // SHARE_VM_MEMORY_BARRIERSET_HPP
< prev index next >