< prev index next >

src/share/vm/utilities/growableArray.hpp

Print this page

        

*** 25,34 **** --- 25,35 ---- #ifndef SHARE_VM_UTILITIES_GROWABLEARRAY_HPP #define SHARE_VM_UTILITIES_GROWABLEARRAY_HPP #include "memory/allocation.hpp" #include "memory/allocation.inline.hpp" + #include "oops/oop.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/top.hpp" // A growable array.
*** 204,213 **** --- 205,223 ---- bool is_full() const { return _len == _max; } DEBUG_ONLY(E* data_addr() const { return _data; }) void print(); + inline static bool safe_equals(oop obj1, oop obj2) { + return oopDesc::equals(obj1, obj2); + } + + template <class X> + inline static bool safe_equals(X i1, X i2) { + return i1 == i2; + } + int append(const E& elem) { check_nesting(); if (_len == _max) grow(_len); int idx = _len++; _data[idx] = elem;
*** 284,294 **** raw_at_put_grow(i, elem, fill); } bool contains(const E& elem) const { for (int i = 0; i < _len; i++) { ! if (_data[i] == elem) return true; } return false; } int find(const E& elem) const { --- 294,304 ---- raw_at_put_grow(i, elem, fill); } bool contains(const E& elem) const { for (int i = 0; i < _len; i++) { ! if (safe_equals(_data[i], elem)) return true; } return false; } int find(const E& elem) const {
< prev index next >