Skip to content

8356595: Convert -Xlog:cds to -Xlog:aot (step1) #25136

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

Closed
wants to merge 31 commits into from

Conversation

iklam
Copy link
Member

@iklam iklam commented May 9, 2025

This is an alternative (and opposite) approach to #24895. We basically convert most [cds] logs to [aot] logs. However, for the few logs that might be needed by existing user scripts, we use macros like aot_log_info, aot_log_debug so that they can be selected/printed using the [cds] tag.

We have a few hundred logs that start with [cds]. To aid reviewing, this PR will convert only part of them. The rest of the logs are converted in #25238. Both PRs will be integrated at the same time after review.

Please see aotLogging.hpp for how the macros work.


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-8356595: Convert -Xlog:cds to -Xlog:aot (step1) (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25136

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 9, 2025

👋 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 May 9, 2025

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

8356595: Convert -Xlog:cds to -Xlog:aot (step1)

Reviewed-by: ccheung, dholmes, jsjolen, matsaave

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

  • 890456f: 8355078: java.awt.Color.createContext() uses unnecessary synchronization
  • 637e9d1: 8354556: Expand value-based class warnings to java.lang.ref API

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
Copy link

openjdk bot commented May 9, 2025

⚠️ @iklam This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@openjdk openjdk bot added the rfr Pull request is ready for review label May 9, 2025
@openjdk
Copy link

openjdk bot commented May 9, 2025

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

@mlbridge
Copy link

mlbridge bot commented May 9, 2025

@iklam iklam changed the title 8356595 convert cds log to aot log 8356595: Convert -Xlog:cds to -Xlog:aot May 9, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label May 14, 2025
@iklam
Copy link
Member Author

iklam commented May 14, 2025

But given you state that CDS is a subset of AOT - the AOT for metaspace - does it really make sense to simply rebadge "cds" logging as "aot"? It seems to me that "aot" logging will generate massive amounts of data if everything AOT related logs when "aot" is used. Would you not want finer-grained logging such that "cds" becomes "aot+metaspace" as described?

Many "cds" logs already have sub-levels. E.g., [cds][heap], [cds][module]. The top-level [cds] log are used for general trouble shooting (e.g, the CDS archive cannot be mapped). Today, if you run with -Xlog:cds, there's a fair amount of logs but not massive:

$ java -Xlog:cds --version 
[0.003s][info][cds] trying to map /jdk3/bld/tin/images/jdk/lib/server/classes.jsa
[0.003s][info][cds] Opened shared archive file /jdk3/bld/tin/images/jdk/lib/server/classes.jsa.
[0.003s][info][cds] The shared archive file was created with UseCompressedOops = 1, UseCompressedClassPointers = 1, UseCompactObjectHeaders = 0
[0.003s][info][cds] Core region alignment: 4096
[0.003s][info][cds] ArchiveRelocationMode: 1
[0.003s][info][cds] ArchiveRelocationMode == 1: always map archive(s) at an alternative address
[0.003s][info][cds] Try to map archive(s) at an alternative address
[0.003s][info][cds] Reserved archive_space_rs [0x000073d7fa000000 - 0x000073d7fb000000] (16777216) bytes (includes protection zone)
[0.003s][info][cds] Reserved class_space_rs   [0x000073d7fb000000 - 0x000073d83b000000] (1073741824) bytes
[0.003s][info][cds] Mapped static  region #0 at base 0x000073d7fa001000 top 0x000073d7fa48b000 (ReadWrite)
[0.003s][info][cds] Mapped static  region #1 at base 0x000073d7fa48b000 top 0x000073d7fad37000 (ReadOnly)
[0.003s][info][cds] Mapped static  region #2 at base 0x000073d88b5ce000 top 0x000073d88b600000 (Bitmap)
[0.005s][info][cds] archived module property jdk.module.main: (null)
[0.005s][info][cds] archived module property jdk.module.addexports: (null)
[0.005s][info][cds] archived module property jdk.module.addmods: (null)
[0.005s][info][cds] archived module property jdk.module.enable.native.access: (null)
[0.005s][info][cds] archived module property jdk.module.addopens: (null)
[0.005s][info][cds] optimized module handling: enabled
[0.005s][info][cds] full module graph: enabled
[0.005s][info][cds] CDS archive was created with max heap size = 128M, and the following configuration:
[0.005s][info][cds]     narrow_klass_base at mapping start address, narrow_klass_pointer_bits = 32, narrow_klass_shift = 0
[0.005s][info][cds]     narrow_oop_mode = 0, narrow_oop_base = 0x0000000000000000, narrow_oop_shift = 0
[0.005s][info][cds] The current max heap size = 15488M, G1HeapRegion::GrainBytes = 8388608
[0.005s][info][cds]     narrow_klass_base = 0x000073d7fa000000, arrow_klass_pointer_bits = 32, narrow_klass_shift = 0
[0.005s][info][cds]     narrow_oop_mode = 1, narrow_oop_base = 0x0000000000000000, narrow_oop_shift = 3
[0.005s][info][cds]     heap range = [0x0000000438000000 - 0x0000000800000000]
[0.005s][info][cds] Preferred address to map heap data (to avoid relocation) is 0x00000000ffe00000
[0.005s][info][cds] Heap data mapped at 0x00000007ff800000, size =  1157176 bytes
[0.005s][info][cds] CDS heap data relocation delta = 30058479616 bytes
[0.005s][info][cds] use_full_module_graph = true; java.base = 0x000073d7fa4860a8
[0.005s][info][cds] patching heap embedded pointers: narrowOop 0xffe00000 -> 0xfff00000
[0.005s][info][cds] CDS heap data quick relocation not possible
[0.005s][info][cds] Unmapping region #2 at base 0x000073d88b5ce000 (Bitmap)

Going forward, we may change some of the logs to add an extra level if it makes sense. At this point, I don't see any logs that need immediate attention:

$ java -Xlog:logging=debug
[....]
[0.009s][debug][logging] Available tag sets: , aot, aot+class, aot+codecache, aot+codecache+exit, aot+codecache+init, aot+codecache+reloc, aot+codecache+stringtable, aot+codecache+stubs, aot+hashtables, aot+heap, aot+heap+mirror, aot+init, aot+jvmti, aot+lambda, aot+link, aot+load, aot+mirror, aot+ref, aot+reloc, aot+unshareable, arguments, attach, cds, cds+class, cds+dynamic, cds+hashtables, cds+init, cds+lambda, cds+map, cds+map+oops, cds+module, cds+reloc, cds+resolve, cds+verification, cds+vtables,

I'm undecided whether this aspect of the work requires a CSR request ... but it never hurts to have one. Obviously in 26 there will be one for the actual deprecation/obsoletion/expiration process.

Since most of the logs are for diagnostic purposes and are often changed along with the VM code, I think it's not necessary for a CSR.

@openjdk openjdk bot changed the title 8356595: Convert -Xlog:cds to -Xlog:aot 8356595: Convert -Xlog:cds to -Xlog:aot (step1) May 14, 2025
@openjdk
Copy link

openjdk bot commented May 14, 2025

@iklam this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout 8356595-convert-cds-log-to-aot-log
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label May 14, 2025
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label May 15, 2025
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.

Okay, nothing further from me. Thanks

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 15, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label May 16, 2025
Copy link
Contributor

@matias9927 matias9927 left a comment

Choose a reason for hiding this comment

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

Changes make sense, looks good!

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 16, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label May 19, 2025
@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 20, 2025
@iklam
Copy link
Member Author

iklam commented May 20, 2025

Thanks @jdksjolen @dholmes-ora @matias9927 @calvinccheung for the review
/integrate

@openjdk
Copy link

openjdk bot commented May 20, 2025

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

  • 39d8d10: 8348906: InstanceOfTree#getType doesn't specify when it returns null
  • 890456f: 8355078: java.awt.Color.createContext() uses unnecessary synchronization
  • 637e9d1: 8354556: Expand value-based class warnings to java.lang.ref API

Your commit was automatically rebased without conflicts.

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

openjdk bot commented May 20, 2025

@iklam Pushed as commit 7077535.

💡 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
Development

Successfully merging this pull request may close these issues.

5 participants