8074319: barrier_set_cast defined via friend injection
authorjwilhelm
Wed, 04 Mar 2015 02:23:38 +0100
changeset 29331 b788134d664a
parent 29330 8eddda51cd29
child 29332 c2364e06aa8d
child 29464 02c245ad3ec9
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
hotspot/src/share/vm/memory/barrierSet.hpp
--- 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