Skip to content
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

8263002: Remove CDS MiscCode region #2861

Closed
wants to merge 6 commits into from

Conversation

iklam
Copy link
Member

@iklam iklam commented Mar 7, 2021

The CDS MiscCode region is used for:
(a) C++ vtables
(b) Method trampolines

(a) can be moved to the ReadWrite region
(b) were introduced in JDK-8145221 so we can delay writing into Methods. This was intended to improve copy-on-write sharing to reduce memory footprint. However, this hasn't been shown to have any significant effect (footprint of metadata usually is much smaller than the Java heap), and introduces a lot of complexity in the HotSpot code.

Removing (b) will make it easier to implement JDK-8026297 (Generating AdapterHandlerEntry during CDS dump), which will further improve start-up time.

============
Other benefits of removing the MiscCode region:

  • We no longer have a read/write/executable region. This address the concern in JDK-8262922.
  • We can enable CDS on macOS/AArch64, which does not allow read/write/executable regions. (JDK-8253795)

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/2861/head:pull/2861
$ git checkout pull/2861

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 7, 2021

👋 Welcome back iklam! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Mar 7, 2021

@iklam The following labels will be automatically applied to this pull request:

  • hotspot
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org labels Mar 7, 2021
@iklam
Copy link
Member Author

iklam commented Mar 7, 2021

/label remove serviceability

@openjdk
Copy link

openjdk bot commented Mar 7, 2021

@iklam
The serviceability label was successfully removed.

@openjdk openjdk bot removed the serviceability serviceability-dev@openjdk.org label Mar 7, 2021
@iklam iklam marked this pull request as ready for review March 7, 2021 06:37
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 7, 2021
@mlbridge
Copy link

mlbridge bot commented Mar 7, 2021

Webrevs

@iklam iklam changed the title 8263002 Remove CDS MiscCode region 8263002: Remove CDS MiscCode region Mar 8, 2021
Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

wow. Looks good to me.

*p += _buffer_to_requested_delta;
assert(_builder->is_in_requested_static_archive(*p), "new pointer must point inside requested archive");
if (!_builder->is_in_buffer_space(*p)) {
tty->print_cr("ohashii %p %p", p, *p);
Copy link
Contributor

Choose a reason for hiding this comment

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

What is ohashii ? Should this be an assert? Or log_error instead of tty->print

Copy link
Member Author

Choose a reason for hiding this comment

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

This was debug code that I left behind by mistake. I've removed it.

@@ -215,7 +215,7 @@ CppVtableInfo** CppVtables::_index = NULL;
char* CppVtables::dumptime_init() {
assert(DumpSharedSpaces, "must");
size_t vtptrs_bytes = _num_cloned_vtable_kinds * sizeof(CppVtableInfo*);
_index = (CppVtableInfo**)ArchiveBuilder::current()->mc_region()->allocate(vtptrs_bytes);
_index = (CppVtableInfo**)ArchiveBuilder::current()->rw_region()->allocate(vtptrs_bytes);
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought these would be read-only?

Copy link
Member Author

Choose a reason for hiding this comment

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

The vtables contain function pointers and need to be updated at runtime to match the latest location of libjvm.so, so they need to be R/W.

@@ -107,7 +103,7 @@ void DumpAllocStats::print_stats(int ro_all, int rw_all, int mc_all) {
all_count, all_bytes, all_perc);

assert(all_ro_bytes == ro_all, "everything should have been counted");
assert(all_rw_bytes == rw_all, "everything should have been counted");
//assert(all_rw_bytes == rw_all, "everything should have been counted"); FIXME!
Copy link
Contributor

Choose a reason for hiding this comment

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

? Does this need to be fixed?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is fixed in the latest version. I added accounting for the vtables.

@openjdk
Copy link

openjdk bot commented Mar 9, 2021

@iklam 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:

8263002: Remove CDS MiscCode region

Reviewed-by: coleenp, dholmes

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 9, 2021
Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Hi Ioi,

This looks really good from a code simplification point of view!

I can't claim to fully understand all the code involved though.

Thanks,
David

@iklam
Copy link
Member Author

iklam commented Mar 10, 2021

Thanks @coleenp and @dholmes-ora for the review!
/integrate

@openjdk openjdk bot closed this Mar 10, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 10, 2021
@openjdk
Copy link

openjdk bot commented Mar 10, 2021

@iklam Since your change was applied there has been 1 commit pushed to the master branch:

  • 67ea3bd: 8263102: Expand documention of Method.isBridge

Your commit was automatically rebased without conflicts.

Pushed as commit d8a9c3c.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@y1yang0
Copy link
Member

y1yang0 commented Mar 20, 2021

Hi @iklam, sorry to bother you, I found there are some comments that still refer to lingering mc regions.

@iklam
Copy link
Member Author

iklam commented Mar 22, 2021

Hi @iklam, sorry to bother you, I found there are some comments that still refer to lingering mc regions.

Thanks @kelthuzadx , I have filed JDK-8263998 (Remove mentions of mc region in comments)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

5 participants