RFR: 8281631: HashMap.putAll can cause redundant space waste [v6]
Stuart Marks
smarks at openjdk.java.net
Tue Feb 15 03:48:09 UTC 2022
On Tue, 15 Feb 2022 02:12:48 GMT, XenoAmess <duke at openjdk.java.net> wrote:
> A test will fail if not change codes there. Every pr should pass ci, so I have no choice.
Hm, yes I recall in the preliminary email that there was some mention of a test. However, the test seemed to use the same (incorrect) calculation, so maybe the test needs to be fixed instead.
> Good question. Can I get a list of classes where I should check?(I guesd I shall start at LinkedHashMap and hash sets, but have no further ideas)
Offhand, the HashMap/LinkedHashMap and the corresponding Set classes, and WeakHashMap, are the main places to look. IdentityHashMap and the Map.of() implementations use a different organization so are probably unrelated. ConcurrentHashMap is another obvious place; you might want to investigate there, but depending on the fix (if any) we might want to handle it separately. I'd search for "loadFactor" or "LOAD_FACTOR" and see if anything else turns up.
> OK I will have a try... a hard part is how to read private field in class but I think I can find some clue in the existed tests.
There is an incantation in the test header to ensure that the java.base module is opened for reflection. Let me know if you have trouble with it.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7431
More information about the core-libs-dev
mailing list