RFR: 8294037: Using alias template to unify hashtables in AsyncLogWriter

Xin Liu xliu at openjdk.org
Thu Sep 22 16:20:26 UTC 2022


On Wed, 21 Sep 2022 13:28:28 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> This change is only for clear code. No functional change is intended.
>> 
>> Currently, there are two hashtables. One is this on c-heap.
>> 
>>   using AsyncLogMap = ResourceHashtable<LogFileStreamOutput*,
>>                           uint32_t,
>>                           17, /*table_size*/
>>                           ResourceObj::C_HEAP,
>>                           mtLogging>;
>> 
>> and the other one is its mirror on ResourceArena. It's not accident. The 2nd one is the snapshot of prior one. 
>> We use this approach to release lock early. Flushing snapshot doesn't require lock protection and therefore 
>> won't block logsites.
>> 
>> 
>>   ResourceMark rm;
>>   // Similar to AsyncLogMap but on resource_area
>>   ResourceHashtable<LogFileStreamOutput*, uint32_t,
>>                           17/*table_size*/, ResourceObj::RESOURCE_AREA,
>>                           mtLogging> snapshot;
>> 
>> C++11 has a new feature called [alias template](https://en.cppreference.com/w/cpp/language/type_alias). We can
>> use this feature to unify two types.
>
> Marked as reviewed by coleenp (Reviewer).

hi, @coleenp and @simonis , 
thank you for reviewing this patch!

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

PR: https://git.openjdk.org/jdk/pull/10350


More information about the hotspot-runtime-dev mailing list