Description
The ResourceHashtable interface has less boilerplate, so we should use it for Dictionary, ModuleEntry, and other Hashtable/BasicHashtable's in the VM.
Eventually, all of these should be replaced with some std:: one, but there are more difficult issues with allocators that I don't know (and reading that code is close to impossible), so this could be a first step.
The reason to do this conversion: a. hashtable.hpp has undefined behavior. The entries are CHEAP allocated but not by new so they aren’t actually properly constructed. There was some reason (historical) for that. They aren't properly destroyed either. b. The buckets() bucket_addr() and other functions needed to be exported and used explicitly by the client hashtables. They export implementation. c. The ResourceHashtable looks a lot like std::unordered_map and is quite concise. It allows for iteration and lambdas which I really like. Essentially though, you define a table and call get() and put() on it. It’s really that simple.
After these tables are converted, and hashtable.hpp/inline.hpp/cpp are removed, it makes sense to rename ResourceHashtable since ResourceHashtable is a historical name. This hashtable was originally implemented as a ResourceObj alternative to Hashtable, but then was extended to have CHEAP allocation.
Eventually, all of these should be replaced with some std:: one, but there are more difficult issues with allocators that I don't know (and reading that code is close to impossible), so this could be a first step.
The reason to do this conversion: a. hashtable.hpp has undefined behavior. The entries are CHEAP allocated but not by new so they aren’t actually properly constructed. There was some reason (historical) for that. They aren't properly destroyed either. b. The buckets() bucket_addr() and other functions needed to be exported and used explicitly by the client hashtables. They export implementation. c. The ResourceHashtable looks a lot like std::unordered_map and is quite concise. It allows for iteration and lambdas which I really like. Essentially though, you define a table and call get() and put() on it. It’s really that simple.
After these tables are converted, and hashtable.hpp/inline.hpp/cpp are removed, it makes sense to rename ResourceHashtable since ResourceHashtable is a historical name. This hashtable was originally implemented as a ResourceObj alternative to Hashtable, but then was extended to have CHEAP allocation.
Attachments
Issue Links
- relates to
-
JDK-8269004 Implement ResizableResourceHashtable
-
- Resolved
-
-
JDK-8267752 KVHashtable doesn't deallocate entries
-
- Resolved
-