OpenJDK / jdk / hs
changeset 29331:b788134d664a
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
author | jwilhelm |
---|---|
date | Wed, 04 Mar 2015 02:23:38 +0100 |
parents | 8eddda51cd29 |
children | c2364e06aa8d 02c245ad3ec9 |
files | hotspot/src/share/vm/memory/barrierSet.hpp |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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