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

Coleen Phillimore coleenp at openjdk.org
Wed Sep 21 13:46:43 UTC 2022


On Mon, 19 Sep 2022 21:02:12 GMT, Xin Liu <xliu 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).

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

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


More information about the hotspot-runtime-dev mailing list