1.1 --- a/src/share/vm/utilities/hashtable.cpp Fri Jun 22 15:39:16 2012 -0700 1.2 +++ b/src/share/vm/utilities/hashtable.cpp Mon Jun 25 21:33:35 2012 -0400 1.3 @@ -24,6 +24,7 @@ 1.4 1.5 #include "precompiled.hpp" 1.6 #include "memory/allocation.inline.hpp" 1.7 +#include "memory/filemap.hpp" 1.8 #include "memory/resourceArea.hpp" 1.9 #include "oops/oop.inline.hpp" 1.10 #include "runtime/safepoint.hpp" 1.11 @@ -119,8 +120,16 @@ 1.12 // Get a new index relative to the new table (can also change size) 1.13 int index = new_table->hash_to_index(hashValue); 1.14 p->set_hash(hashValue); 1.15 + // Keep the shared bit in the Hashtable entry to indicate that this entry 1.16 + // can't be deleted. The shared bit is the LSB in the _next field so 1.17 + // walking the hashtable past these entries requires 1.18 + // BasicHashtableEntry::make_ptr() call. 1.19 + bool keep_shared = p->is_shared(); 1.20 unlink_entry(p); 1.21 new_table->add_entry(index, p); 1.22 + if (keep_shared) { 1.23 + p->set_shared(); 1.24 + } 1.25 p = next; 1.26 } 1.27 } 1.28 @@ -135,6 +144,19 @@ 1.29 free_buckets(); 1.30 } 1.31 1.32 +void BasicHashtable::free_buckets() { 1.33 + if (NULL != _buckets) { 1.34 + // Don't delete the buckets in the shared space. They aren't 1.35 + // allocated by os::malloc 1.36 + if (!UseSharedSpaces || 1.37 + !FileMapInfo::current_info()->is_in_shared_space(_buckets)) { 1.38 + FREE_C_HEAP_ARRAY(HashtableBucket, _buckets); 1.39 + } 1.40 + _buckets = NULL; 1.41 + } 1.42 +} 1.43 + 1.44 + 1.45 // Reverse the order of elements in the hash buckets. 1.46 1.47 void BasicHashtable::reverse() {