RFR: 8294037: Using alias template to unify hashtables in AsyncLogWriter
Xin Liu
xliu at openjdk.org
Mon Sep 19 21:10:28 UTC 2022
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.
-------------
Commit messages:
- 8294037: Using alias template to unify hashtables in AsyncLogWriter
Changes: https://git.openjdk.org/jdk/pull/10350/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10350&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8294037
Stats: 12 lines in 2 files changed: 3 ins; 5 del; 4 mod
Patch: https://git.openjdk.org/jdk/pull/10350.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/10350/head:pull/10350
PR: https://git.openjdk.org/jdk/pull/10350
More information about the hotspot-runtime-dev
mailing list