< prev index next >

src/hotspot/share/utilities/growableArray.hpp

roman_version
 
 #ifndef SHARE_VM_UTILITIES_GROWABLEARRAY_HPP
 #define SHARE_VM_UTILITIES_GROWABLEARRAY_HPP
 
 #include "memory/allocation.hpp"
+#include "oops/oop.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/ostream.hpp"
 
 // A growable array.

@@ -209,10 +210,19 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;
@@ -293,11 +303,11 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; + if (safe_equals(_data[i], elem)) return true; } return false; } int find(const E& elem) const {
< prev index next >