-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8271569: Clean up the use of CDS constants and field offsets #5450
Closed
Closed
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
30ede36
8271569: Rename cdsoffsets.cpp to cdsConstants.cpp
7bb5ee2
Make array of offsets and constants member of class CDSConstants and …
c290e7c
Rollled back _base_region_crc to private, changed CDSConst's value fr…
4f045e3
offsets and constants should be private
5eaf079
remove including <cstddef>, instead include globalDefinitions.hpp exp…
dfd6525
Reorder friend classes
10ef5a4
Add back <cstddef> for additional platforms
d23e70e
Include stddef.h in cds.h
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,6 +181,7 @@ class FileMapRegion: private CDSFileMapRegion { | |
|
||
class FileMapHeader: private CDSFileMapHeaderBase { | ||
friend class VMStructs; | ||
friend class CDSConstants; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's better to sort the classes alphabetically. CDSConstants should come before VMStructs. |
||
|
||
private: | ||
size_t _header_size; | ||
|
@@ -208,11 +209,9 @@ class FileMapHeader: private CDSFileMapHeaderBase { | |
// The following fields are all sanity checks for whether this archive | ||
// will function correctly with this JVM and the bootclasspath it's | ||
// invoked with. | ||
public: | ||
char _jvm_ident[JVM_IDENT_MAX]; // identifier string of the jvm that created this dump | ||
// size of the base archive name including NULL terminator | ||
size_t _base_archive_name_size; | ||
private: | ||
|
||
// The following is a table of all the boot/app/module path entries that were used | ||
// during dumping. At run time, we validate these entries according to their | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not stated in the style guide, but I think most files include the system headers after the HotSpot headers, separated by a blank line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this even needed now? I don't see it being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear, the layout that I'd like to see is:
However, I think the more appropriate change is to include globalDefinitions.hpp instead of explicitly including cstddef.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pre-submit tests failed to build hotspot for linux on arm/ppc/s390 etc after removed. needed for defining size_t. So will add it back at last section of 'include'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is here in cdsConstants.hpp
globalDefinitions.hpp should be included here for the declaration of
size_t
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it still failed for non-pch since cds.h is before cdsConstants.hpp. size_t in cds.h is not defined yet. Should I add it to cds.h?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit complicated. The file is src/hotspot/share/include/cds.h, and the HotSpot convention for including files in this directory usually drops the "include/" part. E.g.,
But this will put
#include "cds.h"
at the very beginning of all includes, so it doesn't take upsize_t
which is indirectly declared later via globalDefinitions.hpp.However, header files in src/hotspot/share/ may be included by C/C++ files outside of HotSpot. As a result, these headers cannot include other HotSpot headers. I.e., you cannot put
#include "utilities/globalDefinitions.hpp"
in cds.h, because cds.h is included by src/jdk.hotspot.agent/share/native/libsaproc/ps_core_common.c.I think one compromise is to add
#include <stddefs.h>
in cds.h. Since cds.h can be included by C source code, we cannot use#include <cstddef>
which is a C++ thing.<stddefs.h>
is part of ANSI C standard and we already include it inside share/utilities/debug.hpp, so we can safely assume that it exists for all compilers that can build HotSpot.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Ioi - use stddefs.h in cds.h