RFR: 8281631: HashMap copy constructor and putAll can over-allocate table [v28]

XenoAmess duke at openjdk.java.net
Thu Mar 10 16:26:46 UTC 2022


On Thu, 10 Mar 2022 16:15:03 GMT, XenoAmess <duke at openjdk.java.net> wrote:

>> XenoAmess has updated the pull request incrementally with five additional commits since the last revision:
>> 
>>  - clean out tests
>>  - Remove 'randomness' keyword.
>>  - Cleanup and commenting.
>>  - initial rewrite of WhiteBoxResizeTest
>>  - Restore WhiteBoxResizeTest.java
>
> test/jdk/java/util/HashMap/WhiteBoxResizeTest.java line 116:
> 
>> 114:     }
>> 115: 
>> 116:     void putN(Map<Integer, Integer> map, int n) {
> 
> @stuart-marks well we know this is correct for WeakHashMap when n < IntegerCache.high because we have Integer constant pool, but I think it be better to manlly make it sure it is referenced, as IntegerCache.high is configurable.

@stuart-marks please have a look in changes in the latest commit, I think we'd better to manually create references for keys like that.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7431


More information about the core-libs-dev mailing list