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

8329332: Remove CompiledMethod and CodeBlobLayout classes #18554

Closed
wants to merge 6 commits into from

Conversation

vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Mar 29, 2024

Revert JDK-8152664 RFE changes which was used for AOT JEP 295 implementation in JDK 9. The code was left in HotSpot assuming it will help in a future. But during work on Leyden we decided to not use it. In Leyden cached compiled code will be restored in CodeCache as normal nmethods: no need to change VM's runtime and GC code to process them.

I may work on optimizing CodeBlob and nmethod fields layout to reduce header size in separate changes. In these changes I did simple fields reordering to keep small (1 byte) fields together.

I do not see (and not expected) performance difference with these changes.

Tested tier1-5, xcomp, stress. Running performance testing.

I need help with testing on platforms which Oracle does not support.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8329332: Remove CompiledMethod and CodeBlobLayout classes (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18554/head:pull/18554
$ git checkout pull/18554

Update a local copy of the PR:
$ git checkout pull/18554
$ git pull https://git.openjdk.org/jdk.git pull/18554/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 18554

View PR using the GUI difftool:
$ git pr show -t 18554

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18554.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 29, 2024

👋 Welcome back kvn! 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 29, 2024

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

8329332: Remove CompiledMethod and CodeBlobLayout classes

Reviewed-by: vlivanov, stefank

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 18 new commits pushed to the master branch:

  • 6382a12: 8326666: Remove the Java Management Extension (JMX) Subject Delegation feature
  • d90e5b5: 8329546: Assume sized integral types are available
  • f3db279: 8327410: Add hostname option for UL file names
  • 21867c9: 8313332: Simplify lazy jmethodID cache in InstanceKlass
  • b9da140: 8329594: G1: Consistent Titles to Thread Work Items.
  • a169c06: 8329580: Parallel: Remove VerifyObjectStartArray
  • 8efd7aa: 8328786: [AIX] move some important warnings/errors from trcVerbose to UL
  • f26e430: 8327110: Refactor create_bool_from_template_assertion_predicate() to separate class and fix identical cloning cases used for Loop Unswitching and Split If
  • e5e21a8: 8328702: C2: Crash during parsing because sub type check is not folded
  • f762637: 8326962: C2 SuperWord: cache VPointer
  • ... and 8 more: https://git.openjdk.org/jdk/compare/8dc43aa0fe8cdba2a2953258de02c6afa072987a...master

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 master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Mar 29, 2024

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

  • graal
  • hotspot
  • serviceability
  • shenandoah

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 graal graal-dev@openjdk.org serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Mar 29, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 30, 2024
@mlbridge
Copy link

mlbridge bot commented Mar 30, 2024

Webrevs

@RealFYang
Copy link
Member

Hi, I also performed some tests (tier1-3 and hotspot:tier4) on linux-riscv64 platform. Result looks good.

@offamitkumar
Copy link
Member

I performed the build + testing {fastdebug, release, slowdebug} X {tier1} on s390x and result looks fine.

@dean-long
Copy link
Member

The not_used state was introduced for AOT. It can go away now.

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 1, 2024

@RealFYang and @offamitkumar thank you for testing.

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 1, 2024

The not_used state was introduced for AOT. It can go away now.

Good catch, Dean.

I want to keep nmethod::make_not_used() method because we use it in Leyden to keep AOT code (outside of CodeCache): nmethod.hpp#L476
It does not use this flag value.

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 1, 2024

I did not change src/hotspot/share/code//codeHeapState.cpp code which counts nmethods with not_used state by checking (!nm->is_not_entrant() after (nm->is_in_use()). Removing not_used does not affect it.
The code is complicated and needs separate RFE if we decide to clean it.

Copy link

@iwanowww iwanowww left a comment

Choose a reason for hiding this comment

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

Nice cleanup! Overall, looks very good.

What about CompiledMethod_lock? There's no CompiledMethod anymore, but the lock name still refers to it.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 3, 2024
Copy link
Member

@stefank stefank left a comment

Choose a reason for hiding this comment

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

Nice!

We've wanted to clean up some interfaces between the CodeCache and the GC code by using nmethod closures instead of CodeBlob closures. This change (and the Sweeper removal) makes it possible to do those cleanups.

I've made a superficial pass over the patch to and left a few comments. Most of those comments are things that would be nice to fix, but could also be left as follow-up RFEs (if they are deemed to be worthy ideas to pursue).

src/hotspot/os/posix/signals_posix.cpp Outdated Show resolved Hide resolved
src/hotspot/share/code/codeBlob.hpp Outdated Show resolved Hide resolved
src/hotspot/share/code/codeBlob.hpp Outdated Show resolved Hide resolved
src/hotspot/share/code/codeBlob.hpp Show resolved Hide resolved
src/hotspot/share/code/codeCache.cpp Show resolved Hide resolved
src/hotspot/share/prims/whitebox.cpp Show resolved Hide resolved
src/hotspot/share/runtime/continuationEntry.hpp Outdated Show resolved Hide resolved
src/hotspot/share/runtime/continuationEntry.hpp Outdated Show resolved Hide resolved
src/hotspot/share/runtime/frame.cpp Show resolved Hide resolved
src/hotspot/share/runtime/vframe.cpp Outdated Show resolved Hide resolved
@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 3, 2024

What about CompiledMethod_lock? There's no CompiledMethod anymore, but the lock name still refers to it.

It was different changes JDK-8226705. Renaming it will complicate these changes more than I wanted. I can do it in separate RFE.

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 3, 2024

Thank you, @stefank, for great review. I addressed all your comments locally and will run testing in mach5 before pushing it.

Except your suggestion about find_blob_not_null() - should be separate RFE.
The same for suggestion "GC interfaces to work directly against nmethod instead of CodeBlob".

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 3, 2024

I filed RFEs:
JDK-8329628: Additional changes after JDK-8329332
JDK-8329629: GC interfaces should work directly against nmethod instead of CodeBlob

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 4, 2024

GHA linux-x64-hs-minimal failure is not related to changes:

2024-04-04T00:07:46.9654262Z ##[warning]Failed to download action 'https://api.github.com/repos/actions/github-script/tarball/60a0d83039c74a4aee543508d2ffcb1c3799cdea'. Error: The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.
2024-04-04T00:07:46.9656929Z ##[warning]Back off 22.252 seconds before retry.
2024-04-04T00:08:52.1252710Z ##[error]The SSL connection could not be established, see inner exception.

Copy link
Member

@xmas92 xmas92 left a comment

Choose a reason for hiding this comment

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

There is a stale comment in test/jdk/com/sun/jdi/EATests.java:1288

-// (See CompiledMethod::is_at_poll_return())
+// (See nmethod::is_at_poll_return())

Copy link
Member

@stefank stefank left a comment

Choose a reason for hiding this comment

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

I took a second pass over the changes. I've given a few suggestions below. None of them should require respinning of tests (except for making sure that this still builds).

src/hotspot/share/gc/shared/gcBehaviours.hpp Outdated Show resolved Hide resolved
src/hotspot/share/gc/shenandoah/shenandoahUnload.cpp Outdated Show resolved Hide resolved
src/hotspot/share/gc/x/xUnload.cpp Outdated Show resolved Hide resolved
src/hotspot/share/gc/z/zUnload.cpp Outdated Show resolved Hide resolved
src/hotspot/share/runtime/javaThread.hpp Outdated Show resolved Hide resolved
src/hotspot/share/code/codeBlob.hpp Outdated Show resolved Hide resolved
@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 4, 2024

Thank you, @stefank , for second round of review. I addressed all your comments.
I also removed virtual from virtual method() override; as you suggested before since I touched these files again.
I will wait result of new GHA and tier1 in mach5 before integration.

Copy link
Member

@stefank stefank left a comment

Choose a reason for hiding this comment

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

Looks good.

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 4, 2024

Thank you, @stefank, @iwanowww, @dean-long and @xmas92 for reviews and @RealFYang and @offamitkumar for testing.

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 4, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Apr 4, 2024

Going to push as commit 83eba86.
Since your change was applied there have been 20 commits pushed to the master branch:

  • 28216aa: 8328366: Thread.setContextClassloader from thread in FJP commonPool task no longer works after JDK-8327501
  • 4276d5c: 8329637: Apparent typo in java.security file property jdk.tls.keyLimits
  • 6382a12: 8326666: Remove the Java Management Extension (JMX) Subject Delegation feature
  • d90e5b5: 8329546: Assume sized integral types are available
  • f3db279: 8327410: Add hostname option for UL file names
  • 21867c9: 8313332: Simplify lazy jmethodID cache in InstanceKlass
  • b9da140: 8329594: G1: Consistent Titles to Thread Work Items.
  • a169c06: 8329580: Parallel: Remove VerifyObjectStartArray
  • 8efd7aa: 8328786: [AIX] move some important warnings/errors from trcVerbose to UL
  • f26e430: 8327110: Refactor create_bool_from_template_assertion_predicate() to separate class and fix identical cloning cases used for Loop Unswitching and Split If
  • ... and 10 more: https://git.openjdk.org/jdk/compare/8dc43aa0fe8cdba2a2953258de02c6afa072987a...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 4, 2024
@openjdk openjdk bot closed this Apr 4, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 4, 2024
@openjdk
Copy link

openjdk bot commented Apr 4, 2024

@vnkozlov Pushed as commit 83eba86.

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

@vnkozlov vnkozlov deleted the 8329332 branch April 4, 2024 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
graal graal-dev@openjdk.org hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org
7 participants