--- old/src/hotspot/share/utilities/growableArray.hpp 2019-03-11 14:27:29.038354009 +0100 +++ new/src/hotspot/share/utilities/growableArray.hpp 2019-03-11 14:27:28.826354012 +0100 @@ -26,6 +26,7 @@ #define SHARE_UTILITIES_GROWABLEARRAY_HPP #include "memory/allocation.hpp" +#include "oops/array.hpp" #include "oops/oop.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" @@ -402,6 +403,12 @@ } } + void appendAll(const Array* l) { + for (int i = 0; i < l->length(); i++) { + raw_at_put_grow(_len, l->at(i), E()); + } + } + void sort(int f(E*,E*)) { qsort(_data, length(), sizeof(E), (_sort_Fn)f); } @@ -540,10 +547,10 @@ UnaryPredicate _predicate; // Unary predicate the elements of the GrowableArray should satisfy public: - GrowableArrayFilterIterator(const GrowableArrayIterator& begin, UnaryPredicate filter_predicate) - : _array(begin._array), _position(begin._position), _predicate(filter_predicate) { + GrowableArrayFilterIterator(const GrowableArray* array, UnaryPredicate filter_predicate) + : _array(array), _position(0), _predicate(filter_predicate) { // Advance to first element satisfying the predicate - while(_position != _array->length() && !_predicate(_array->at(_position))) { + while(!at_end() && !_predicate(_array->at(_position))) { ++_position; } } @@ -552,7 +559,7 @@ do { // Advance to next element satisfying the predicate ++_position; - } while(_position != _array->length() && !_predicate(_array->at(_position))); + } while(!at_end() && !_predicate(_array->at(_position))); return *this; } @@ -577,6 +584,10 @@ assert(_array == rhs._array, "iterator belongs to different array"); return _position != rhs._position; } + + bool at_end() const { + return _array == NULL || _position == _array->end()._position; + } }; // Arrays for basic types