RFR: 8184765: Dynamically resize SystemDictionary

Gerard Ziemski gerard.ziemski at oracle.com
Mon Oct 30 15:24:25 UTC 2017


hi Coleen,


> On Oct 30, 2017, at 10:12 AM, coleen.phillimore at oracle.com wrote:
> 
> 
> Hi Gerard,
> 
> This looks great.  One small question:
> + // straight forward brute force
> + inline static int _next_prime(int n) {
> +   int p = n;
> +   for (int i = n; i < (n * n); i++) {
> +     if ((i % 2) != 0) {
> +       p = i;
> +       break;
> +     }
> +   }
> +   return p;
> + }
> 
> Is this how you calculate next prime?  Wouldn't you check if it can mod by 3 and 5 as well?

As long as it’s not even i.e. mod 2 (and strictly speaking larger than 1). 3 and 5 are prime, so no need to check them.

Thank you for the review!


cheers


> Thanks,
> Coleen
> 
> 
> On 10/27/17 2:25 PM, Gerard Ziemski wrote:
>> hi Coleen,
>> 
>> Thank you for the review.
>> 
>> Updated webrev: 
>> http://cr.openjdk.java.net/~gziemski/8184765_rev2
>> 
>> 
>> 
>>> On Oct 11, 2017, at 9:10 AM, coleen.phillimore at oracle.com
>>>  wrote:
>>> 
>>> 
>>> Gerard, some preliminary comments.
>>> 
>>> 
>>> http://cr.openjdk.java.net/~gziemski/8184765_rev1/src/hotspot/share/classfile/systemDictionary.cpp.udiff.html
>>> 
>>> 
>>> *+{*
>>> *!_MutexLocker mu(SystemDictionary_lock, THREAD_);*
>>> *!_Klass* probe = dictionary->find(_d_hash, name, protection_domain);*
>>> *if (probe != NULL) return probe;*
>>> **
>>> *+ }*
>>> 
>>> I don't think you need this because dictionary->find() should have the NoSafepointVerifier, so the index will not change.
>>> 
>> Done, good catch.
>> 
>> 
>> 
>>> http://cr.openjdk.java.net/~gziemski/8184765_rev1/src/hotspot/share/classfile/classLoaderData.cpp.udiff.html
>>> 
>>> 
>>> I think we want a global _some_dictionary_needs_resizing to avoid walking through the CLDG.
>>> 
>>> And have Dictionary have a field _resizing_needed to avoid the calculation during the safepoint, which is set when adding an entry.
>>> 
>>> _resizing_needed = *(number_of_entries() > (_resize_load_trigger*table_size());
>>> *CLDG::_any_resizing_needed |= _resizing_needed;   // or something like that.
>>> 
>>> I can write more about the rationale of this change in the bug report, if needed.
>>> 
>> Done.
>> 
>> 
>> 
>>> Thank you for doing this change.
>>> Coleen
>>> 
>>> 
>>> On 10/10/17 4:40 PM, Gerard Ziemski wrote:
>>> 
>>>> hi all,
>>>> 
>>>> Please review this change that adds dynamic resizing of system dictionaries.
>>>> 
>>>> The biggest change is refactoring of the code that protects calculating of the table entry’s index using SystemDictionary_lock
>>>> 
>>>> A few notes:
>>>> 
>>>> - dynamic resizing is off when either dumping or using shared spaces
>>>> - we remove the experimental runtime option “PredictedLoadedClassCount” and add “DynamicallyResizeSystemDictionaries” to turn the resizing off (it’s on by default)
>>>> - the jtreg test uses stream of bytes to dynamically load numbered classes from memory instead of disk (thank you Ioi)
>>>> 
>>>> bug:    
>>>> https://bugs.openjdk.java.net/browse/JDK-8184765
>>>> 
>>>> webrev: 
>>>> http://cr.openjdk.java.net/~gziemski/8184765_rev1
>>>> 
>>>> 
>>>> 
>>>> cheers
>>>> 
>>>> 
> 



More information about the hotspot-runtime-dev mailing list