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

8344727: [JVMCI] Export the CompileBroker compilation activity mode for Truffle compiler control #22295

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

simonis
Copy link
Member

@simonis simonis commented Nov 21, 2024

Truffle compilations run in "hosted" mode, i.e. the Truffle runtimes triggers compilations independently of HotSpot's CompileBroker. But the results of Truffle compilations are still stored as ordinary nmethods in HotSpot's code cache (with the help of the JVMCI method jdk.vm.ci.hotspot.HotSpotCodeCacheProvider::installCode()). The regular JIT compilers are controlled by the CompileBroker which is aware of the code cache occupancy. If the code cache runs full, the CompileBroker temporary pauses any subsequent JIT compilations until the code cache gets swept (if running with -XX:+UseCodeCacheFlushing -XX:+MethodFlushing which is the default) or completely shuts down the JIT compilers if running with -XX:+UseCodeCacheFlushing.

Truffle compiled methods can contribute significantly to the overall code cache occupancy and they can trigger JIT compilation stalls if they fill the code cache up. But the Truffle framework itself is neither aware of the current code cache occupancy, nor of the compilation activity of the CompileBroker. If Truffle tries to install a compiled method through JVMCI and the code cache is full, it will silently fail. Currently Truffle interprets such failures as transient errors and basically ignores it. Whenever the corresponding method gets hot again (usually immediately at the next invocation), Truffle will recompile it again just to fail again in the nmethod installation step, if the code cache is still full.

When the code cache is tight, this can lead to situations, where Truffle is unnecessarily and repeatedly compiling methods which can't be installed in the code cache but produce a significant CPU load. Instead, Truffle should poll HotSpot's CompileBroker compilation activity and pause compilations for the time the CompileBroker is pausing JIT compilations (or completely shutdown Truffle compilations if the CompileBroker shut down the JIT compilers). In order to make this possible, JVMCI should export the CompileBroker compilation activity mode (i.e. stop_compilation, run_compilation or shutdown_compilation).

The corresponding Truffle change is tracked under #10133: Implement Truffle compiler control based on HotSpot's CompileBroker compilation activity.


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-8344727: [JVMCI] Export the CompileBroker compilation activity mode for Truffle compiler control (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22295

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 21, 2024

👋 Welcome back simonis! 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 Nov 21, 2024

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

8344727: [JVMCI] Export the CompileBroker compilation activity mode for Truffle compiler control

Reviewed-by: dnsimon

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

  • 6f622da: 8344923: Problem list on java/awt/Robot/ScreenCaptureRobotTest.java on macOS
  • 8f08020: 8344903: Improve error handling TestJhsdbJstackPrintVMLocks.java
  • a83cfe2: 8344917: Fix recent NULL usage backsliding
  • 6711e13: 8344914: OOME in several tests since JDK-6672644 - JComboBox still scrolling
  • a6220fa: 8344303: Remove usage of URLUtil.getConnectPermission from sun.awt.SunToolkit and sun.awt.image.URLImageSource
  • 7be94d0: 8344891: Remove uses of sun.misc.ReflectUtil in java.desktop
  • 822a155: 8341427: JFR: Adjust object sampler span handling
  • d00f311: 8343150: Change URLClassLoader.getPermissions to return empty PermissionCollection
  • effee12: 8344533: CTW: Add option to remove clinits before loading
  • 70c4e2c: 8344587: Reduce number of "jdk.jpackage.internal" classes used from other packages
  • ... and 43 more: https://git.openjdk.org/jdk/compare/882d6358074135b2c4fe21b32bd73f40022980bc...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 openjdk bot added the rfr Pull request is ready for review label Nov 21, 2024
@openjdk
Copy link

openjdk bot commented Nov 21, 2024

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

  • graal
  • hotspot-compiler

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.

@mlbridge
Copy link

mlbridge bot commented Nov 21, 2024

Webrevs

Copy link
Member

@dougxc dougxc 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
graal [email protected] hotspot-compiler [email protected] ready Pull request is ready to be integrated rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants