src/hotspot/share/utilities/concurrentHashTable.hpp
changeset 52717 b22da519f2e3
parent 52516 d5eebe1e03fe
child 53149 259c36ef27df
equal deleted inserted replaced
52716:877dd2b0f36c 52717:b22da519f2e3
   311   VALUE* internal_get(Thread* thread, LOOKUP_FUNC& lookup_f,
   311   VALUE* internal_get(Thread* thread, LOOKUP_FUNC& lookup_f,
   312                       bool* grow_hint = NULL);
   312                       bool* grow_hint = NULL);
   313 
   313 
   314   // Insert which handles a number of cases.
   314   // Insert which handles a number of cases.
   315   template <typename LOOKUP_FUNC, typename VALUE_FUNC, typename CALLBACK_FUNC>
   315   template <typename LOOKUP_FUNC, typename VALUE_FUNC, typename CALLBACK_FUNC>
   316   bool internal_insert(Thread* thread, LOOKUP_FUNC& lookup_f, VALUE_FUNC& value_f,
   316   bool internal_get_insert(Thread* thread, LOOKUP_FUNC& lookup_f, VALUE_FUNC& value_f,
   317                        CALLBACK_FUNC& callback, bool* grow_hint = NULL, bool* clean_hint = NULL);
   317                            CALLBACK_FUNC& callback_f, bool* grow_hint = NULL, bool* clean_hint = NULL);
       
   318 
       
   319   // Plain insert.
       
   320   template <typename LOOKUP_FUNC>
       
   321   bool internal_insert(Thread* thread, LOOKUP_FUNC& lookup_f, const VALUE& value,
       
   322                        bool* grow_hint, bool* clean_hint);
   318 
   323 
   319   // Returns true if an item matching LOOKUP_FUNC is removed.
   324   // Returns true if an item matching LOOKUP_FUNC is removed.
   320   // Calls DELETE_FUNC before destroying the node.
   325   // Calls DELETE_FUNC before destroying the node.
   321   template <typename LOOKUP_FUNC, typename DELETE_FUNC>
   326   template <typename LOOKUP_FUNC, typename DELETE_FUNC>
   322   bool internal_remove(Thread* thread, LOOKUP_FUNC& lookup_f,
   327   bool internal_remove(Thread* thread, LOOKUP_FUNC& lookup_f,
   400   // and CALLBACK_FUNC is called with new or old value. Returns true if the
   405   // and CALLBACK_FUNC is called with new or old value. Returns true if the
   401   // value already exists.
   406   // value already exists.
   402   template <typename LOOKUP_FUNC, typename VALUE_FUNC, typename CALLBACK_FUNC>
   407   template <typename LOOKUP_FUNC, typename VALUE_FUNC, typename CALLBACK_FUNC>
   403   bool get_insert_lazy(Thread* thread, LOOKUP_FUNC& lookup_f, VALUE_FUNC& val_f,
   408   bool get_insert_lazy(Thread* thread, LOOKUP_FUNC& lookup_f, VALUE_FUNC& val_f,
   404                        CALLBACK_FUNC& callback_f, bool* grow_hint = NULL, bool* clean_hint = NULL) {
   409                        CALLBACK_FUNC& callback_f, bool* grow_hint = NULL, bool* clean_hint = NULL) {
   405     return !internal_insert(thread, lookup_f, val_f, callback_f, grow_hint, clean_hint);
   410     return !internal_get_insert(thread, lookup_f, val_f, callback_f, grow_hint, clean_hint);
   406   }
   411   }
   407 
   412 
   408   // Same without CALLBACK_FUNC.
   413   // Same without CALLBACK_FUNC.
   409   template <typename LOOKUP_FUNC, typename VALUE_FUNC>
   414   template <typename LOOKUP_FUNC, typename VALUE_FUNC>
   410   bool get_insert_lazy(Thread* thread, LOOKUP_FUNC& lookup_f, VALUE_FUNC& val_f,
   415   bool get_insert_lazy(Thread* thread, LOOKUP_FUNC& lookup_f, VALUE_FUNC& val_f,
   440   // Returns true true if the item was inserted, duplicates are found with
   445   // Returns true true if the item was inserted, duplicates are found with
   441   // LOOKUP_FUNC.
   446   // LOOKUP_FUNC.
   442   template <typename LOOKUP_FUNC>
   447   template <typename LOOKUP_FUNC>
   443   bool insert(Thread* thread, LOOKUP_FUNC& lookup_f, const VALUE& value,
   448   bool insert(Thread* thread, LOOKUP_FUNC& lookup_f, const VALUE& value,
   444               bool* grow_hint = NULL, bool* clean_hint = NULL) {
   449               bool* grow_hint = NULL, bool* clean_hint = NULL) {
   445     LazyValueRetrieve vp(value);
   450     return internal_insert(thread, lookup_f, value, grow_hint, clean_hint);
   446     return internal_insert(thread, lookup_f, vp, noOp, grow_hint, clean_hint);
       
   447   }
   451   }
   448 
   452 
   449   // This does a fast unsafe insert and can thus only be used when there is no
   453   // This does a fast unsafe insert and can thus only be used when there is no
   450   // risk for a duplicates and no other threads uses this table.
   454   // risk for a duplicates and no other threads uses this table.
   451   bool unsafe_insert(const VALUE& value);
   455   bool unsafe_insert(const VALUE& value);