From fe77a289444605e3fbd9aee1073bbbaf3aa99332 Mon Sep 17 00:00:00 2001 From: kvn Date: Thu, 27 Oct 2011 18:20:50 -0700 Subject: [PATCH] 7105611: Set::print() is broken Summary: Reimplemented class VSetI_ to restore Set::print(). Reviewed-by: never --- src/share/vm/libadt/vectset.cpp | 15 +++++++++++++++ src/share/vm/libadt/vectset.hpp | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/share/vm/libadt/vectset.cpp b/src/share/vm/libadt/vectset.cpp index 93cb48d69..0042ca762 100644 --- a/src/share/vm/libadt/vectset.cpp +++ b/src/share/vm/libadt/vectset.cpp @@ -350,6 +350,21 @@ int VectorSet::hash() const return (int)_xor; } +//------------------------------iterate---------------------------------------- +// Used by Set::print(). +class VSetI_ : public SetI_ { + VectorSetI vsi; +public: + VSetI_( const VectorSet *vset, uint &elem ) : vsi(vset) { elem = vsi.elem; } + + uint next(void) { ++vsi; return vsi.elem; } + int test(void) { return vsi.test(); } +}; + +SetI_ *VectorSet::iterate(uint &elem) const { + return new(ResourceObj::C_HEAP) VSetI_(this, elem); +} + //============================================================================= //------------------------------next------------------------------------------- // Find and return the next element of a vector set, or return garbage and diff --git a/src/share/vm/libadt/vectset.hpp b/src/share/vm/libadt/vectset.hpp index c184773ca..552fdd17b 100644 --- a/src/share/vm/libadt/vectset.hpp +++ b/src/share/vm/libadt/vectset.hpp @@ -151,7 +151,7 @@ public: private: - SetI_ *iterate(uint&) const { ShouldNotCallThis(); return NULL; } // Removed + SetI_ *iterate(uint&) const; }; //------------------------------Iteration-------------------------------------- -- GitLab