diff -r 45071514f87a -r 8237a91c1cca src/hotspot/share/utilities/growableArray.hpp --- a/src/hotspot/share/utilities/growableArray.hpp Tue Apr 03 10:27:46 2018 +0200 +++ b/src/hotspot/share/utilities/growableArray.hpp Tue Apr 03 13:15:27 2018 +0200 @@ -26,6 +26,7 @@ #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" @@ -211,6 +212,15 @@ void print(); + inline static bool safe_equals(oop obj1, oop obj2) { + return oopDesc::equals(obj1, obj2); + } + + template + inline static bool safe_equals(X i1, X i2) { + return i1 == i2; + } + int append(const E& elem) { check_nesting(); if (_len == _max) grow(_len); @@ -295,7 +305,7 @@ 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; }