-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
8332139: SymbolTableHash::Node allocations allocates twice the required memory #19214
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back aboldtch! A progress list of the required criteria for merging this PR into |
@xmas92 This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 131 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
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.
LGTM!
The symbols are inline and allocated together with the ConcurrentHashTable (CHT) Nodes. The calculation used for the required size is
alloc_size = size + value.byte_size() + value.effective_length();
Where
size == sizeof(SymbolTableHash::Node) == sizeof(void*) + sizeof(Symbol)
value.byte_size() == dynamic_sizeof(Symbol) == sizeof(Symbol) + <bytes beyond object>
value.effective_length() == dynamic_sizeof(Symbol) - sizeof(Symbol) == <bytes beyond object>
So
alloc_size
ends up beingsizeof(void*) /* node metadata */ + 2 * dynamic_sizeof(Symbol)
Because using the CHT with dynamically sized (and inlined) types requires knowing about its implementation details I chose to make the functionality for calculating the the allocation size a property of the CHT. It now queries the CHT for the node allocation size given the dynamic size required for the VALUE.
The only current (implicit) restriction regarding using dynamically sized (and inlined) types in CHT is that the _value field C++ object ends where the Node object ends, so there is not padding bytes where the dynamic payload is allocated. (effectively
sizeof(VALUE) % alignof(Node) == 0
as long as there are no non-standard alignment fields in the Node metadata). I chose to test this as a runtime assert that the _value ends where the Node object ends, instead of a static assert with the alignment as it seemed to more explicitly show the intent of the check.Running testing tier1-7
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19214/head:pull/19214
$ git checkout pull/19214
Update a local copy of the PR:
$ git checkout pull/19214
$ git pull https://git.openjdk.org/jdk.git pull/19214/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19214
View PR using the GUI difftool:
$ git pr show -t 19214
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19214.diff
Webrev
Link to Webrev Comment