1.1 --- a/src/share/vm/utilities/hashtable.hpp Fri May 05 06:07:11 2017 -0700 1.2 +++ b/src/share/vm/utilities/hashtable.hpp Mon May 15 12:20:15 2017 +0200 1.3 @@ -164,11 +164,11 @@ 1.4 // Instance variables 1.5 int _table_size; 1.6 HashtableBucket<F>* _buckets; 1.7 - BasicHashtableEntry<F>* _free_list; 1.8 + BasicHashtableEntry<F>* volatile _free_list; 1.9 char* _first_free_entry; 1.10 char* _end_block; 1.11 int _entry_size; 1.12 - int _number_of_entries; 1.13 + volatile int _number_of_entries; 1.14 1.15 protected: 1.16 1.17 @@ -215,6 +215,24 @@ 1.18 // Free the buckets in this hashtable 1.19 void free_buckets(); 1.20 1.21 + // Helper data structure containing context for the bucket entry unlink process, 1.22 + // storing the unlinked buckets in a linked list. 1.23 + // Also avoids the need to pass around these four members as parameters everywhere. 1.24 + struct BucketUnlinkContext { 1.25 + int _num_processed; 1.26 + int _num_removed; 1.27 + // Head and tail pointers for the linked list of removed entries. 1.28 + BasicHashtableEntry<F>* _removed_head; 1.29 + BasicHashtableEntry<F>* _removed_tail; 1.30 + 1.31 + BucketUnlinkContext() : _num_processed(0), _num_removed(0), _removed_head(NULL), _removed_tail(NULL) { 1.32 + } 1.33 + 1.34 + void free_entry(BasicHashtableEntry<F>* entry); 1.35 + }; 1.36 + // Add of bucket entries linked together in the given context to the global free list. This method 1.37 + // is mt-safe wrt. to other calls of this method. 1.38 + void bulk_free_entries(BucketUnlinkContext* context); 1.39 public: 1.40 int table_size() { return _table_size; } 1.41 void set_entry(int index, BasicHashtableEntry<F>* entry);