8294037: Using alias template to unify hashtables in AsyncLogWriter

Reviewed-by: coleenp, simonis
This commit is contained in:
Xin Liu 2022-09-22 16:36:01 +00:00
parent 48cc15602b
commit 696287d6e8
2 changed files with 7 additions and 9 deletions

View File

@ -116,10 +116,7 @@ AsyncLogWriter::AsyncLogWriter()
void AsyncLogWriter::write() {
ResourceMark rm;
// Similar to AsyncLogMap but on resource_area
ResourceHashtable<LogFileStreamOutput*, uint32_t,
17/*table_size*/, ResourceObj::RESOURCE_AREA,
mtLogging> snapshot;
AsyncLogMap<ResourceObj::RESOURCE_AREA> snapshot;
// lock protection. This guarantees I/O jobs don't block logsites.
{

View File

@ -58,11 +58,12 @@ class AsyncLogWriter : public NonJavaThread {
friend class AsyncLogTest;
friend class AsyncLogTest_logBuffer_vm_Test;
class AsyncLogLocker;
// account for dropped messages
template <ResourceObj::allocation_type ALLOC_TYPE>
using AsyncLogMap = ResourceHashtable<LogFileStreamOutput*,
uint32_t,
17, /*table_size*/
ResourceObj::C_HEAP,
mtLogging>;
uint32_t, 17, /*table_size*/
ALLOC_TYPE, mtLogging>;
// Messsage is the envelop of a log line and its associative data.
// Its length is variable because of the zero-terminated c-str. It is only valid when we create it using placement new
@ -154,7 +155,7 @@ class AsyncLogWriter : public NonJavaThread {
PlatformMonitor _lock;
bool _data_available;
volatile bool _initialized;
AsyncLogMap _stats; // statistics for dropped messages
AsyncLogMap<ResourceObj::C_HEAP> _stats;
// ping-pong buffers
Buffer* _buffer;