-
Bug
-
Resolution: Fixed
-
P4
-
18, 19, 20
DumpClassListCLDClosure wants to use a hash table for dumped classes with the initial size of 1987 and the maximum size of 61333. It chose ResizeableResourceHashtable (open hashing table) which it uses incorrectly:
1. An instance of ResizeableResourceHashtable is constructed with ResizeableResourceHashtable(INITIAL_TABLE_SIZE) which means ResizeableResourceHashtable(/* size= */ INITIAL_TABLE_SIZE, /* max_size= */ 0). It should be ResizeableResourceHashtable(INITIAL_TABLE_SIZE, MAX_TABLE_SIZE) instead.
2. It calls ResizeableResourceHashtable::maybe_grow(int load_factor). ResizeableResourceHashtable::maybe_grow increases the hash table size and re-balances it depending on the provided load factor. If the hash table maximum size is set to 0, it does nothing. As the table for dumped classes is created with the max size set to 0, the call does nothing. If the table is created with ResizeableResourceHashtable(INITIAL_TABLE_SIZE, MAX_TABLE_SIZE) the call will still be incorrect. The function is called with MAX_TABLE_SIZE which makes the function to use 61333 as a load factor. The hash table load factor is number_of_entries / table size. The call will work when number_of_entries > 61333*1987=121,868,671. This does not look reasonable. The correct call should be without arguments (the default load factor) or with a reasonable load factor.
This bug can cause the search in the dumped classes table to become linear and slow down DumpClassListCLDClosure::dump.
1. An instance of ResizeableResourceHashtable is constructed with ResizeableResourceHashtable(INITIAL_TABLE_SIZE) which means ResizeableResourceHashtable(/* size= */ INITIAL_TABLE_SIZE, /* max_size= */ 0). It should be ResizeableResourceHashtable(INITIAL_TABLE_SIZE, MAX_TABLE_SIZE) instead.
2. It calls ResizeableResourceHashtable::maybe_grow(int load_factor). ResizeableResourceHashtable::maybe_grow increases the hash table size and re-balances it depending on the provided load factor. If the hash table maximum size is set to 0, it does nothing. As the table for dumped classes is created with the max size set to 0, the call does nothing. If the table is created with ResizeableResourceHashtable(INITIAL_TABLE_SIZE, MAX_TABLE_SIZE) the call will still be incorrect. The function is called with MAX_TABLE_SIZE which makes the function to use 61333 as a load factor. The hash table load factor is number_of_entries / table size. The call will work when number_of_entries > 61333*1987=121,868,671. This does not look reasonable. The correct call should be without arguments (the default load factor) or with a reasonable load factor.
This bug can cause the search in the dumped classes table to become linear and slow down DumpClassListCLDClosure::dump.