Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8252224: ZGC: Convert ZValue to use alias templates
Reviewed-by: pliden, kbarrett
  • Loading branch information
stefank committed Aug 27, 2020
1 parent 75a8c71 commit c24e7ba0b41261efbed770f79cf641a43c2b6de2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 116 deletions.
@@ -96,33 +96,10 @@ class ZValue : public CHeapObj<mtGC> {
void set_all(const T& value);
};

template <typename T>
class ZContended : public ZValue<ZContendedStorage, T> {
public:
ZContended();
ZContended(const T& value);
};

template <typename T>
class ZPerCPU : public ZValue<ZPerCPUStorage, T> {
public:
ZPerCPU();
ZPerCPU(const T& value);
};

template <typename T>
class ZPerNUMA : public ZValue<ZPerNUMAStorage, T> {
public:
ZPerNUMA();
ZPerNUMA(const T& value);
};

template <typename T>
class ZPerWorker : public ZValue<ZPerWorkerStorage, T> {
public:
ZPerWorker();
ZPerWorker(const T& value);
};
template <typename T> using ZContended = ZValue<ZContendedStorage, T>;
template <typename T> using ZPerCPU = ZValue<ZPerCPUStorage, T>;
template <typename T> using ZPerNUMA = ZValue<ZPerNUMAStorage, T>;
template <typename T> using ZPerWorker = ZValue<ZPerWorkerStorage, T>;

//
// Iterator
@@ -140,23 +117,9 @@ class ZValueIterator {
bool next(T** value);
};

template <typename T>
class ZPerCPUIterator : public ZValueIterator<ZPerCPUStorage, T> {
public:
ZPerCPUIterator(ZPerCPU<T>* value);
};

template <typename T>
class ZPerNUMAIterator : public ZValueIterator<ZPerNUMAStorage, T> {
public:
ZPerNUMAIterator(ZPerNUMA<T>* value);
};

template <typename T>
class ZPerWorkerIterator : public ZValueIterator<ZPerWorkerStorage, T> {
public:
ZPerWorkerIterator(ZPerWorker<T>* value);
};
template <typename T> using ZPerCPUIterator = ZValueIterator<ZPerCPUStorage, T>;
template <typename T> using ZPerNUMAIterator = ZValueIterator<ZPerNUMAStorage, T>;
template <typename T> using ZPerWorkerIterator = ZValueIterator<ZPerWorkerStorage, T>;

template <typename S, typename T>
class ZValueConstIterator {
@@ -170,22 +133,8 @@ class ZValueConstIterator {
bool next(const T** value);
};

template <typename T>
class ZPerCPUConstIterator : public ZValueConstIterator<ZPerCPUStorage, T> {
public:
ZPerCPUConstIterator(const ZPerCPU<T>* value);
};

template <typename T>
class ZPerNUMAConstIterator : public ZValueConstIterator<ZPerNUMAStorage, T> {
public:
ZPerNUMAConstIterator(const ZPerNUMA<T>* value);
};

template <typename T>
class ZPerWorkerConstIterator : public ZValueConstIterator<ZPerWorkerStorage, T> {
public:
ZPerWorkerConstIterator(const ZPerWorker<T>* value);
};
template <typename T> using ZPerCPUConstIterator = ZValueConstIterator<ZPerCPUStorage, T>;
template <typename T> using ZPerNUMAConstIterator = ZValueConstIterator<ZPerNUMAStorage, T>;
template <typename T> using ZPerWorkerConstIterator = ZValueConstIterator<ZPerWorkerStorage, T>;

#endif // SHARE_GC_Z_ZVALUE_HPP
@@ -173,38 +173,6 @@ inline void ZValue<S, T>::set_all(const T& value) {
}
}

template <typename T>
inline ZContended<T>::ZContended() :
ZValue<ZContendedStorage, T>() {}

template <typename T>
inline ZContended<T>::ZContended(const T& value) :
ZValue<ZContendedStorage, T>(value) {}

template <typename T>
inline ZPerCPU<T>::ZPerCPU() :
ZValue<ZPerCPUStorage, T>() {}

template <typename T>
inline ZPerCPU<T>::ZPerCPU(const T& value) :
ZValue<ZPerCPUStorage, T>(value) {}

template <typename T>
inline ZPerNUMA<T>::ZPerNUMA() :
ZValue<ZPerNUMAStorage, T>() {}

template <typename T>
inline ZPerNUMA<T>::ZPerNUMA(const T& value) :
ZValue<ZPerNUMAStorage, T>(value) {}

template <typename T>
inline ZPerWorker<T>::ZPerWorker() :
ZValue<ZPerWorkerStorage, T>() {}

template <typename T>
inline ZPerWorker<T>::ZPerWorker(const T& value) :
ZValue<ZPerWorkerStorage, T>(value) {}

//
// Iterator
//
@@ -223,18 +191,6 @@ inline bool ZValueIterator<S, T>::next(T** value) {
return false;
}

template <typename T>
inline ZPerCPUIterator<T>::ZPerCPUIterator(ZPerCPU<T>* value) :
ZValueIterator<ZPerCPUStorage, T>(value) {}

template <typename T>
inline ZPerNUMAIterator<T>::ZPerNUMAIterator(ZPerNUMA<T>* value) :
ZValueIterator<ZPerNUMAStorage, T>(value) {}

template <typename T>
inline ZPerWorkerIterator<T>::ZPerWorkerIterator(ZPerWorker<T>* value) :
ZValueIterator<ZPerWorkerStorage, T>(value) {}

template <typename S, typename T>
inline ZValueConstIterator<S, T>::ZValueConstIterator(const ZValue<S, T>* value) :
_value(value),
@@ -249,16 +205,5 @@ inline bool ZValueConstIterator<S, T>::next(const T** value) {
return false;
}

template <typename T>
inline ZPerCPUConstIterator<T>::ZPerCPUConstIterator(const ZPerCPU<T>* value) :
ZValueConstIterator<ZPerCPUStorage, T>(value) {}

template <typename T>
inline ZPerNUMAConstIterator<T>::ZPerNUMAConstIterator(const ZPerNUMA<T>* value) :
ZValueConstIterator<ZPerNUMAStorage, T>(value) {}

template <typename T>
inline ZPerWorkerConstIterator<T>::ZPerWorkerConstIterator(const ZPerWorker<T>* value) :
ZValueConstIterator<ZPerWorkerStorage, T>(value) {}

#endif // SHARE_GC_Z_ZVALUE_INLINE_HPP

0 comments on commit c24e7ba

Please sign in to comment.