src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetUtils.hpp
branchJEP-349-branch
changeset 57991 a101d496334a
parent 57983 a57907813a83
child 58049 10ecdb5d3574
equal deleted inserted replaced
57990:b08487c6eb4d 57991:a101d496334a
   180  public:
   180  public:
   181   LeakPredicate(bool class_unload) {}
   181   LeakPredicate(bool class_unload) {}
   182   bool operator()(const Method* method) {
   182   bool operator()(const Method* method) {
   183     assert(method != NULL, "invariant");
   183     assert(method != NULL, "invariant");
   184     return IS_METHOD_LEAKP_USED(method);
   184     return IS_METHOD_LEAKP_USED(method);
   185   }
       
   186 };
       
   187 
       
   188 template <typename T, int compare(const T&, const T&)>
       
   189 class UniquePredicate {
       
   190  private:
       
   191   GrowableArray<T> _seen;
       
   192  public:
       
   193    UniquePredicate(bool) : _seen() {}
       
   194    bool operator()(T const& value) {
       
   195      bool not_unique;
       
   196      _seen.template find_sorted<T, compare>(value, not_unique);
       
   197      if (not_unique) {
       
   198        return false;
       
   199      }
       
   200      _seen.template insert_sorted<compare>(value);
       
   201      return true;
       
   202    }
       
   203 };
       
   204 
       
   205 template <typename T, int compare(const T&, const T&)>
       
   206 class CompositeLeakPredicate {
       
   207   LeakPredicate<T> _leak_predicate;
       
   208   UniquePredicate<T, compare> _unique;
       
   209  public:
       
   210   CompositeLeakPredicate(bool class_unload) : _leak_predicate(class_unload), _unique(class_unload) {}
       
   211   bool operator()(T const& value) {
       
   212     return _leak_predicate(value) && _unique(value);
       
   213   }
   185   }
   214 };
   186 };
   215 
   187 
   216 template <typename T, typename IdType>
   188 template <typename T, typename IdType>
   217 class ListEntry : public JfrHashtableEntry<T, IdType> {
   189 class ListEntry : public JfrHashtableEntry<T, IdType> {