RFR: 8153659: Create a CHeap backed LogStream class

Stefan Karlsson stefan.karlsson at oracle.com
Wed Apr 6 17:54:50 UTC 2016

Hi all,

Please review this patch to add a LogStream class that allocates its 
backing buffer from CHeap memory instead of Resource memory.


The main motivation for this is that we can't use Resource allocated 
memory during initialization, until Thread::current() has been 
initialized. So, a CHeap backed LogStream is desirable when we execute, 
for example, the following code during large pages initialization:

void os::trace_page_sizes(const char* str, const size_t* page_sizes, int 
   if (TracePageSizes) {
     tty->print("%s: ", str);
     for (int i = 0; i < count; ++i) {
       tty->print(" " SIZE_FORMAT, page_sizes[i]);

The patch restructures the code and creates a LogStreamBase template 
base class, which takes the backing outputStream class as a template 
parameter. We then have three concrete LogStream classes:

  LogStream - Buffer resource allocated with an embedded ResourceMark
  LogStreamNoResourceMark - Buffer resource allocated without an 
embedded ResourceMark
  LogStreamCHeap - Buffer CHeap allocated

I moved the LogStream class from the logStream.inline.hpp file to 
logStream.hpp, for consistency. If that's causing problems while 
reviewing this, I can move it in a separate patch.

Tested with JPRT with the TracePageSizes patch ( JDK-8152491) and 
internal VM tests.


More information about the hotspot-dev mailing list