RFR 8056084: Refactor Hashtable to allow implementations without rehashing support
Mikael Gerdin
mikael.gerdin at oracle.com
Tue Aug 26 15:26:29 UTC 2014
Hi all,
For JDK-8048268 I need to do some refactoring of the Hashtable class template.
>From the bug description:
In order to simplify usage of the Hashtable<T, F> class the code to perform
rehashing of the SymbolTable and StringTable should be factored out to an
intermediate class common to those two tables.
Also factor out HashtableEntry freelist allocation to allow implementors an
easier route for providing their own memory management.
Introducing the new intermediary superclass requires some calls to superclass
functions to be qualified using the "this->" syntax due to the C++ template
name lookup rules.
a comment about hashtable.cpp RehashableHashtable::dump_table:
- int bucket_bytes = (int)num_buckets * sizeof(bucket(0));
+ int bucket_bytes = (int)num_buckets * sizeof(HashtableBucket<F>);
I decided to change the sizeof to count the size of the hashtable bucket class
instead of the HashtableEntry* returned by bucket(0), even though they may be
of the same size currently.
Note that the webrev url refers to another bug.
Webrev: http://cr.openjdk.java.net/~mgerdin/8048268/hashtable-refactor/webrev/
Buglink: https://bugs.openjdk.java.net/browse/JDK-8056084
Testing: JPRT.
More information about the hotspot-dev
mailing list