RFR(XL): 8167108 - SMR and JavaThread Lifecycle

Daniel D. Daugherty daniel.daugherty at oracle.com
Wed Nov 22 13:10:58 UTC 2017


On 11/22/17 8:06 AM, Erik Österlund wrote:
> Hi Dan,
>
> On 2017-11-22 13:53, Daniel D. Daugherty wrote:
>> On 11/22/17 4:07 AM, Erik Österlund wrote:
>>> Hi,
>>>
>>> Some replies...
>>>
>>> On 2017-11-21 17:28, Daniel D. Daugherty wrote:
>>>> Hi Coleen!
>>>>
>>>> Thanks for making time to review the Thread-SMR stuff again!!
>>>>
>>>> I have added back the other three OpenJDK aliases... This review is
>>>> being done on _four_ different OpenJDK aliases.
>>>>
>>>> As always, replies are embedded below...
>>>>
>>>>
>>>> On 11/20/17 3:12 PM, coleen.phillimore at oracle.com wrote:
>>>>> http://cr.openjdk.java.net/~dcubed/8167108-webrev/jdk10-09-full/src/hotspot/share/runtime/threadSMR.cpp.html 
>>>>>
>>>>>
>>>>>   32 ThreadsList::ThreadsList(int entries) : _length(entries), 
>>>>> _threads(NEW_C_HEAP_ARRAY(JavaThread*, entries + 1, mtGC)), 
>>>>> _next_list(NULL) {
>>>>>
>>>>> Seems like it should be mtThread rather than mtGC.
>>>>
>>>> Fixed. Definitely an artifact of Erik's original prototype when he
>>>> extracted Thread-SMR from his GC work... Thanks for catching it.
>>>>
>>>
>>> Confirmed. At the time I considered the Threads list overheads GC 
>>> overheads, but I agree mtThread is a better fit today.
>>>
>>>>
>>>>>
>>>>> + return (unsigned int)(((uint32_t)(uintptr_t)s1) * 2654435761u);
>>>>>
>>>>> Can you add a comment about where this number came from?
>>>>
>>>> I'll have to get that from Erik...
>>>
>>> Wow, that looks like code I wrote a *very* long time ago. :) That is 
>>> a variation of Knuth's multiplicative hash which is outlined in a 
>>> comment in synchronizer.cpp and referred to in that comment as a 
>>> phi-based scheme. Basically the magic number is 2^32 * Phi (the 
>>> golden ratio), which happens to be a useful value for building a 
>>> reasonably simple yet pretty good hash function. It is not the 
>>> optimal hash function, but seemed to definitely be good enough for 
>>> our purposes.
>>
>> So a reasonable comment would be:
>>
>> // The literal value is 2^32 * Phi (the golden ratio).
>>
>
> Yes.
>
>> If so, then I'll add it in my wrap up round...
>
> Excellent, thanks Dan.


Thanks for confirmation!

Dan


>
> /Erik
>
>> Dan
>>
>>>
>>> Thanks,
>>> /Erik
>>
>



More information about the hotspot-compiler-dev mailing list