JDK-8254335 : logging/logStream.hpp includes memory/resourceArea.hpp but doesn't need it
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2020-10-09
  • Updated: 2020-10-15
  • Resolved: 2020-10-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16
16 b20Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
While cleaning up the logging in Erik's new code for:

    JDK-8253064 monitor list simplifications and getting rid of TSM

I noticed that logging/logStream.hpp includes memory/resourceArea.hpp
but doesn't need it.

That include was added to logging/logStream.hpp by:

    JDK-8153659 Create a CHeap backed LogStream class

but logging/logStream.hpp has since evolved to no longer
use ResourceMarks in the header file. Looks like that work
was done via:

    JDK-8181917: Refactor UL LogStreams to avoid using resource area

Of course, removing the include of memory/resourceArea.hpp reveals
other code that uses ResourceMark(s), but never bothered to include
memory/resourceArea.hpp.

I created this issue to pull on the sweater threads in order
to clean this up.

Update: It was a sub-task of JDK-8253064, but, after thinking about it,
I think it makes more sense as a standalone issue.
Comments
Changeset: cc52358c Author: Daniel D. Daugherty <dcubed@openjdk.org> Date: 2020-10-10 13:38:55 +0000 URL: https://git.openjdk.java.net/jdk/commit/cc52358c
10-10-2020

Here's the initial fix: $ git diff src/hotspot/share/logging/logStream.hpp diff --git a/src/hotspot/share/logging/logStream.hpp b/src/hotspot/share/logging/logStream.hpp index 7da8be05dd9..b141be65a6a 100644 --- a/src/hotspot/share/logging/logStream.hpp +++ b/src/hotspot/share/logging/logStream.hpp @@ -27,7 +27,6 @@ #include "logging/log.hpp" #include "logging/logHandle.hpp" -#include "memory/resourceArea.hpp" #include "utilities/ostream.hpp" The obvious follow-on to that fix is the corresponding logStream.cpp file: $ git diff src/hotspot/share/logging/logStream.cpp diff --git a/src/hotspot/share/logging/logStream.cpp b/src/hotspot/share/logging/logStream.cpp index f8c7c54a719..4adeb596bb6 100644 --- a/src/hotspot/share/logging/logStream.cpp +++ b/src/hotspot/share/logging/logStream.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" +#include "utilities/align.hpp" LogStream::LineBuffer::LineBuffer() : _buf(_smallbuf), _cap(sizeof(_smallbuf)), _pos(0) The remainder of the files need to include "memory/resourceArea.hpp". Here's one example file: $ git diff src/hotspot/share/gc/g1/g1FullGCScope.hpp diff --git a/src/hotspot/share/gc/g1/g1FullGCScope.hpp b/src/hotspot/share/gc/g1/g1FullGCScope.hpp index 8d62e1f9b9b..1fc09094ce9 100644 --- a/src/hotspot/share/gc/g1/g1FullGCScope.hpp +++ b/src/hotspot/share/gc/g1/g1FullGCScope.hpp @@ -34,6 +34,7 @@ #include "gc/shared/gcVMOperations.hpp" #include "gc/shared/isGCActiveMark.hpp" #include "memory/allocation.hpp" +#include "memory/resourceArea.hpp" #include "services/memoryService.hpp" class GCMemoryManager; All files in the patch except for src/hotspot/share/logging/logStream.[ch]pp mention ResourceMark in the file.
09-10-2020