RFR: 8238863: Refactor out static initialization from Dict constructors

Claes Redestad claes.redestad at oracle.com
Thu Feb 13 11:15:07 UTC 2020


While I'm sympathetic to this notion, I think it's more work than it's
worth.

The effect of someone altering shft or xsum in an unexpected way is that
the hashing function for strings get a little... different. Which could
cause performance issues - or even improvements. Since tuning
performance would be the most likely reason anyone would touch these,
adding a test to ensure the implementation/values doesn't ever change
seems counter-productive.

Thanks!

/Claes

On 2020-02-11 19:55, Nils Eliasson wrote:
> Or a gtest.
> 
> //Nils
> 
> On 2020-02-11 18:43, Dean Long wrote:
>> How about if non-product or debug builds verify the pre-built table 
>> using the old algorithm?  That should catch the case where someone 
>> changes shft[] but not xsum[].
>> I'm not proposing it, but it seems like this table could also be 
>> generated at build time using awk :-)
>>
>> dl
>>
>> On 2/11/20 6:24 AM, Claes Redestad wrote:
>>> Hi,
>>>
>>> I stumbled upon some static initialization in Dict and after reading it
>>> twice I think we would be better off by spelling it out as a constant
>>> rather than calculating it at runtime.
>>>
>>> Webrev: http://cr.openjdk.java.net/~redestad/8238863/open.00/
>>> Bug:    https://bugs.openjdk.java.net/browse/JDK-8238863
>>>
>>> Testing: tier1+2
>>>
>>> /Claes
>>


More information about the hotspot-compiler-dev mailing list