RFR (S) Allow ResourceHashtable size to be specified at runtime

Jiangli Zhou jiangli.zhou at oracle.com
Wed Nov 14 00:05:03 UTC 2018


Hi Ioi,

The change looks reasonable to me in general. It would be helpful to see 
the performance difference with the expendable table. Do you have any 
data when large number of classes are loaded (>20000)? How much saving 
does it provide?

Thanks,

Jiangli


On 11/8/18 10:35 PM, Ioi Lam wrote:
> https://bugs.openjdk.java.net/browse/JDK-8213587
> http://cr.openjdk.java.net/~iklam/jdk12/8213587-configurable-resource-hash.v01/ 
>
>
> TL;DR: -- add a subclass to ResourceHashtable to allow the table size 
> to be
>           dynamically specified when the table is constructed.
>
>
>         *** C++ template guru alert ***
>
>
> I don't know much about C++ templates, so my attempt on doing this may be
> ill-advised.
>
> I *think* that with my patch, the performance of existing code, which 
> uses
> a statically-defined SIZE,  should not be affected, as the C++ compiler
> should be able to constant-propagate and reduce the new code:
>
>   ALWAYSINLINE unsigned size() const {
>     if (SIZE != CONFIGURABLE_SIZE) {
>       return SIZE;
>     } else {
>       return _configured_table_size;
>     }
>   }
>
>   ALWAYSINLINE Node** get_table() const {
>     if (SIZE != CONFIGURABLE_SIZE) {
>       return (Node**)(&_static_table[0]);
>     } else {
>       return _configured_table;
>     }
>   }
>
>   Node** lookup_node(unsigned hash, K const& key) {
>     unsigned index = hash % size();    <-----
>     Node** table = get_table();
>     Node** ptr = &table[index];   <-----
>
> back to the old code:
>
>   Node** lookup_node(unsigned hash, K const& key) {
>     unsigned index = hash % SIZE;      <-----
>     Node** ptr = &_table[index];       <-----
>
>
> If anyone has a better way of doing this, I'd love to hear it!
>
> Thanks!
> - Ioi
>
>
>
>



More information about the hotspot-dev mailing list