Skip to content

Commit

Permalink
8294037: Using alias template to unify hashtables in AsyncLogWriter
Browse files Browse the repository at this point in the history
Reviewed-by: coleenp, simonis
  • Loading branch information
Xin Liu committed Sep 22, 2022
1 parent 48cc156 commit 696287d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
5 changes: 1 addition & 4 deletions src/hotspot/share/logging/logAsyncWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
{
Expand Down
11 changes: 6 additions & 5 deletions src/hotspot/share/logging/logAsyncWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

1 comment on commit 696287d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.