Skip to content

8351640: Print reason for making method not entrant #23980

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed

Conversation

shipilev
Copy link
Member

@shipilev shipilev commented Mar 11, 2025

A simple quality of life improvement. We are studying compiler dynamics in Leyden, and it would be convenient to know why the particular methods are marked as not entrant. We just need to pass the extra string argument to nmethod::make_not_entrant and print it out.

Sample log excerpt for mainline:

$ grep com.sun.tools.javac.util.IntHashTable::lookup print-compilation.log 
987   780       3       com.sun.tools.javac.util.IntHashTable::lookup (100 bytes)
1019  877       4       com.sun.tools.javac.util.IntHashTable::lookup (100 bytes)
1024  780       3       com.sun.tools.javac.util.IntHashTable::lookup (100 bytes)   made not entrant: not used
4995  877       4       com.sun.tools.javac.util.IntHashTable::lookup (100 bytes)   made not entrant: uncommon trap
5287 3734       3       com.sun.tools.javac.util.IntHashTable::lookup (100 bytes)
6615 5472       4       com.sun.tools.javac.util.IntHashTable::lookup (100 bytes)
6626 3734       3       com.sun.tools.javac.util.IntHashTable::lookup (100 bytes)   made not entrant: not used

You can now clearly see the method lifecycle. 1 second in app lifetime, the method was initially compiled at level 3. Shortly after, it got compiled at level 4, turning level 3 method unused. 4 seconds later, level 4 method encountered uncommon trap, so we are back to level 3. After 1.3 seconds more, the final compilation at level 4 completed, and second level 3 compilation was removed as unused.

Additional testing:

  • Linux x86_64 server fastdebug, hotspot:tier1
  • Linux x86_64 server fastdebug, all

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-8351640: Print reason for making method not entrant (Enhancement - P4)

Reviewers

Contributors

  • Vladimir Ivanov <vlivanov@openjdk.org>

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23980

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 11, 2025

👋 Welcome back shade! 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 11, 2025

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

8351640: Print reason for making method not entrant

Co-authored-by: Vladimir Ivanov <vlivanov@openjdk.org>
Reviewed-by: vlivanov, 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 9 new commits pushed to the master branch:

  • 02c850f: 8350982: -server|-client causes fatal exception on static JDK
  • 2371696: 8303770: Remove Baltimore root certificate expiring in May 2025
  • f16a742: 8351626: Update remaining icons to SVG format
  • a21fa46: 8351309: test/hotspot/jtreg/runtime/posixSig/TestPosixSig.java fails on static-jdk
  • 3b189e0: 8351345: [IR Framework] Improve reported disabled IR verification messages
  • 95b66d5: 8351700: Remove code conditional on BarrierSetNMethod being null
  • 84f87dd: 8351665: Remove unused UseNUMA in os_aix.cpp
  • 4be502e: 8350642: Interpreter: Upgrade CountBytecodes to 64 bit on 64 bit platforms
  • 1fe4526: 8350194: Last 2 parameters of ReturnNode::ReturnNode are swapped in the declaration

Please see this link for an up-to-date comparison between the source branch of this pull request and 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 rfr Pull request is ready for review label Mar 11, 2025
@openjdk
Copy link

openjdk bot commented Mar 11, 2025

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

  • graal
  • hotspot

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 hotspot hotspot-dev@openjdk.org labels Mar 11, 2025
@mlbridge
Copy link

mlbridge bot commented Mar 11, 2025

Webrevs

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 11, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Mar 12, 2025
Copy link
Contributor

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

Looks good.

Do you mind incorporating log compilation tool support? [1]

diff --git a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java
index e1e305abe10..61cbc054200 100644
--- a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java
+++ b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java
@@ -1099,6 +1099,10 @@ public void startElement(String uri, String localName, String qname, Attributes
             e.setCompileKind(compileKind);
             String level = atts.getValue("level");
             e.setLevel(level);
+            String reason = atts.getValue("reason");
+            if (reason != null) {
+              e.setReason(reason);
+            }
             events.add(e);
         } else if (qname.equals("uncommon_trap")) {
             String id = atts.getValue("compile_id");
diff --git a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/MakeNotEntrantEvent.java b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/MakeNotEntrantEvent.java
index b4015537c74..d230f1b4336 100644
--- a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/MakeNotEntrantEvent.java
+++ b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/MakeNotEntrantEvent.java
@@ -47,6 +47,11 @@ class MakeNotEntrantEvent extends BasicLogEvent {
      */
     private String level;
 
+    /**
+     * The reason of invalidation.
+     */
+    private String reason;
+
     /**
      * The compile kind.
      */
@@ -64,10 +69,14 @@ public NMethod getNMethod() {
 
     public void print(PrintStream stream, boolean printID) {
         if (isZombie()) {
-            stream.printf("%s make_zombie\n", getId());
+            stream.printf("%s make_zombie", getId());
         } else {
-            stream.printf("%s make_not_entrant\n", getId());
+            stream.printf("%s make_not_entrant", getId());
+        }
+        if (getReason() != null) {
+            stream.printf(": %s", getReason());
         }
+        stream.println();
     }
 
     public boolean isZombie() {
@@ -88,7 +97,21 @@ public void setLevel(String level) {
       this.level = level;
   }
 
-    /**
+  /**
+   * @return the reason
+   */
+  public String getReason() {
+      return reason;
+  }
+
+  /**
+   * @param reason the reason to set
+   */
+  public void setReason(String reason) {
+      this.reason = reason;
+  }
+
+  /**
    * @return the compileKind
    */
   public String getCompileKind() {

@shipilev
Copy link
Member Author

Do you mind incorporating log compilation tool support? [1]

I don't mind, added. Looks like this still works:

$ cd src/tools/LogCompilation
$ make

@shipilev
Copy link
Member Author

/contributor add @iwanowww

@openjdk
Copy link

openjdk bot commented Mar 12, 2025

@shipilev
Contributor Vladimir Ivanov <vlivanov@openjdk.org> successfully added.

Copy link
Contributor

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

Thanks. Looks good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 12, 2025
@shipilev
Copy link
Member Author

Thanks! I'll integrate once GHA clears.

@shipilev
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Mar 12, 2025

Going to push as commit 930455b.
Since your change was applied there have been 11 commits pushed to the master branch:

  • 895f64a: 8351142: Add JFR monitor deflation and statistics events
  • db531bf: 8351881: Tidy complains about missing "alt" attribute
  • 02c850f: 8350982: -server|-client causes fatal exception on static JDK
  • 2371696: 8303770: Remove Baltimore root certificate expiring in May 2025
  • f16a742: 8351626: Update remaining icons to SVG format
  • a21fa46: 8351309: test/hotspot/jtreg/runtime/posixSig/TestPosixSig.java fails on static-jdk
  • 3b189e0: 8351345: [IR Framework] Improve reported disabled IR verification messages
  • 95b66d5: 8351700: Remove code conditional on BarrierSetNMethod being null
  • 84f87dd: 8351665: Remove unused UseNUMA in os_aix.cpp
  • 4be502e: 8350642: Interpreter: Upgrade CountBytecodes to 64 bit on 64 bit platforms
  • ... and 1 more: https://git.openjdk.org/jdk/compare/1d147ccb4cfcb1da23664ac941e56ac542a7ac61...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 12, 2025

@shipilev Pushed as commit 930455b.

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

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

Successfully merging this pull request may close these issues.

3 participants