Skip to content

Commit 98a395a

Browse files
committed
8254880: ZGC: Let ZList iterators be alias templates
Reviewed-by: ayang, kbarrett, tschatzl
1 parent 011dd0d commit 98a395a

File tree

2 files changed

+3
-33
lines changed

2 files changed

+3
-33
lines changed

src/hotspot/share/gc/z/zList.hpp

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -111,26 +111,8 @@ class ZListRemoveIteratorImpl : public StackObj {
111111
bool next(T** elem);
112112
};
113113

114-
// Iterator types
115-
#define ZLIST_FORWARD true
116-
#define ZLIST_REVERSE false
117-
118-
template <typename T>
119-
class ZListIterator : public ZListIteratorImpl<T, ZLIST_FORWARD> {
120-
public:
121-
ZListIterator(const ZList<T>* list);
122-
};
123-
124-
template <typename T>
125-
class ZListReverseIterator : public ZListIteratorImpl<T, ZLIST_REVERSE> {
126-
public:
127-
ZListReverseIterator(const ZList<T>* list);
128-
};
129-
130-
template <typename T>
131-
class ZListRemoveIterator : public ZListRemoveIteratorImpl<T, ZLIST_FORWARD> {
132-
public:
133-
ZListRemoveIterator(ZList<T>* list);
134-
};
114+
template <typename T> using ZListIterator = ZListIteratorImpl<T, true /* Forward */>;
115+
template <typename T> using ZListReverseIterator = ZListIteratorImpl<T, false /* Forward */>;
116+
template <typename T> using ZListRemoveIterator = ZListRemoveIteratorImpl<T, true /* Forward */>;
135117

136118
#endif // SHARE_GC_Z_ZLIST_HPP

src/hotspot/share/gc/z/zList.inline.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,4 @@ inline bool ZListRemoveIteratorImpl<T, Forward>::next(T** elem) {
232232
return *elem != NULL;
233233
}
234234

235-
template <typename T>
236-
inline ZListIterator<T>::ZListIterator(const ZList<T>* list) :
237-
ZListIteratorImpl<T, ZLIST_FORWARD>(list) {}
238-
239-
template <typename T>
240-
inline ZListReverseIterator<T>::ZListReverseIterator(const ZList<T>* list) :
241-
ZListIteratorImpl<T, ZLIST_REVERSE>(list) {}
242-
243-
template <typename T>
244-
inline ZListRemoveIterator<T>::ZListRemoveIterator(ZList<T>* list) :
245-
ZListRemoveIteratorImpl<T, ZLIST_FORWARD>(list) {}
246-
247235
#endif // SHARE_GC_Z_ZLIST_INLINE_HPP

0 commit comments

Comments
 (0)