diff --git a/src/hotspot/share/utilities/growableArray.hpp b/src/hotspot/share/utilities/growableArray.hpp index 4c5a491..eb59003 100644 --- a/src/hotspot/share/utilities/growableArray.hpp +++ b/src/hotspot/share/utilities/growableArray.hpp @@ -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 @@ template class GrowableArray : public GenericGrowableArray { 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 @@ template class GrowableArray : public GenericGrowableArray { 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; }