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

Xin Liu xliu at openjdk.org
Thu Sep 22 16:40:29 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.

This pull request has now been integrated.

Changeset: 696287d6
Author:    Xin Liu <xliu at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/696287d6e8bf621c225b88f10481966a35c61ffc
Stats:     12 lines in 2 files changed: 3 ins; 5 del; 4 mod

8294037: Using alias template to unify hashtables in AsyncLogWriter

Reviewed-by: coleenp, simonis

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

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


More information about the hotspot-runtime-dev mailing list