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

8254104: MethodCounters must exist before nmethod is installed #543

Closed
wants to merge 3 commits into from

Conversation

veresov
Copy link
Contributor

@veresov veresov commented Oct 7, 2020

Ensure that MethodCounters for a particular method exist during the nmethod install (for methods that were never run before). Tiered compilation policy depends on the state stored in the counters to function properly.


Progress

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

Testing

Linux x64 Windows x64 macOS x64
Build ✔️ (3/3 passed) ✔️ (2/2 passed) ✔️ (2/2 passed)
Test (tier1) ✔️ (9/9 passed) (1/9 failed) ✔️ (9/9 passed)

Failed test task

Issue

  • JDK-8254104: MethodCounters must exist before nmethod is installed

Reviewers

Download

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Oct 7, 2020

👋 Welcome back iveresov! 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 openjdk bot added the rfr label Oct 7, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Oct 7, 2020

@veresov The following label will be automatically applied to this pull request:

  • hotspot-compiler

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

@openjdk openjdk bot added the hotspot-compiler label Oct 7, 2020
dougxc
dougxc approved these changes Oct 7, 2020
@mlbridge
Copy link

@mlbridge mlbridge bot commented Oct 7, 2020

Webrevs

@vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Oct 7, 2020

Would be great if you explain in what cases you don't have MethodCounters AFTER compilation?
Should you do that at the beginning of compilation?
We do check for presence of MDO during start of compilation (C2 example):
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/compile.cpp#L599

@veresov
Copy link
Contributor Author

@veresov veresov commented Oct 7, 2020

The need for MethodCounters to be present is driven by the tiered compilation policy. It's not needed by a compiler per se. Moreover, you don't need it if you don't install the code. For example when compilation happens for native image it's not needed. Anyways, seemed like an appropriate place to do it.

@veresov
Copy link
Contributor Author

@veresov veresov commented Oct 7, 2020

Oh, and to answer your question about when it happens. In most Graal unit tests it compiles and installs methods that have been never executed in the interpreter, which normally lazily allocates the counters. And it doesn't pass through the broker, which would've made sure the counters are there.

@vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Oct 7, 2020

Okay. MethodCounters are created in Interpreter in all cases regardless TieredCompilation setting:
https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp#L386

So check for TieredCompilation is strange.

I understand that MethodCounters are not created in AOT case. And now I get that it includes Graal unit testing as you pointed (which similar to AOT) which request compilation through Java and not usual Compilation Broker. In which case you fix is reasonable.

Copy link
Contributor

@vnkozlov vnkozlov left a comment

OK

@openjdk
Copy link

@openjdk openjdk bot commented Oct 7, 2020

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

8254104: MethodCounters must exist before nmethod is installed

Reviewed-by: dnsimon, kvn

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

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 ready label Oct 7, 2020
@veresov
Copy link
Contributor Author

@veresov veresov commented Oct 8, 2020

/integrate

@openjdk openjdk bot closed this Oct 8, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Oct 8, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Oct 8, 2020

@veresov Since your change was applied there have been 17 commits pushed to the master branch:

  • fd0cb98: 8253901: ARM32: SIGSEGV during monitorexit due to incorrect register use (after JDK-8253540)
  • abe2593: 8232092: (fs) Files::isWritable returns false on a writeable root directory (win)
  • 5a9bd41: 8254102: use ProcessHandle::pid instead of ManagementFactory::getRuntimeMXBean to get pid in tests
  • 38159d5: 8253876: jdk/test/lib/hexdump/ASN1FormatterTest.java fails with "AssertionError: Lines expected [126] but found [202]"
  • db3053d: 8067127: Tags cleanup
  • 739347f: 8254168: Remove TemplateTable::count_calls
  • 4fe07cc: 8252324: Signal related code should be shared among POSIX platforms
  • 1e8e543: 8216497: javadoc should auto-link to platform classes
  • 04ca660: 8253874: [JVMCI] added test omitted in 8252881
  • 49128a1: 8253475: Javadoc clean up in HttpExchange and HttpServer
  • ... and 7 more: https://git.openjdk.java.net/jdk/compare/2a0389a8926b541b3b247a4a18c022ed90cb655b...master

Your commit was automatically rebased without conflicts.

Pushed as commit 4e5ef30.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler integrated
3 participants