8074319: barrier_set_cast defined via friend injection
Summary: Changed the in-class definition to a friend declaration and move the definition to namespace scope
Reviewed-by: jwilhelm, simonis
Contributed-by: kim.barrett@oracle.com
--- a/hotspot/src/share/vm/memory/barrierSet.hpp Tue Mar 03 19:21:45 2015 +0100
+++ b/hotspot/src/share/vm/memory/barrierSet.hpp Wed Mar 04 02:23:38 2015 +0100
@@ -68,11 +68,7 @@
// 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);
- }
+ template<typename T> friend T* barrier_set_cast(BarrierSet* bs);
public:
// Note: This is not presently the Name corresponding to the
@@ -216,4 +212,10 @@
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