-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8265602: -XX:DumpLoadedClassList should support custom loaders #4952
8265602: -XX:DumpLoadedClassList should support custom loaders #4952
Conversation
👋 Welcome back iklam! A progress list of the required criteria for merging this PR into |
/label remove hotspot |
@iklam |
@iklam |
Webrevs
|
@@ -330,23 +330,24 @@ void ReadClosure::do_region(u_char* start, size_t size) { | |||
} | |||
} | |||
|
|||
fileStream* ClassListWriter::_classlist_file = NULL; | |||
|
|||
void ArchiveUtils::log_to_classlist(BootstrapInfo* bootstrap_specifier, TRAPS) { | |||
if (ClassListWriter::is_enabled()) { | |||
if (SystemDictionaryShared::is_supported_invokedynamic(bootstrap_specifier)) { | |||
ResourceMark rm(THREAD); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 336 could be moved after line 338.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
void ClassListWriter::write(const InstanceKlass* k, const ClassFileStream* cfs) { | ||
assert(is_enabled(), "must be"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should assert_locked()
be added here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function doesn't need the lock, since it doesn't directly use ClassListWriter::_classlist_file
or ClassListWriter::_id_table
, which are protected by ClassListFile_lock
. The lock will be taken a few lines down, in the ClassListWriter
constructor.
Your comment reminded me to look for places that need the lock. As a result, I added assert_locked()
to ClassListWriter::write_to_stream()
.
#else | ||
public: | ||
static bool is_enabled() { | ||
return false; | ||
} | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add // INCLUDE_CDS
after endif
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
public class CustomLoadee4WithLambda { | ||
public static void test() { | ||
doit(() -> { | ||
System.out.println("Hello inside a Lambda expression"); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a similar class in dynamicArchive/test-classes/LambHello.java.
To avoid changes in existing tests, maybe you can just add a test()
method there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LambHello
is in a separate directory and is used by several existing tests that require the function doTest()
. If I add another test()
function there it kind of looks odd. Also, I don't want to introduce inter-dependencies between too many tests. Since this class is small, I prefer to keep it separate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just a few minor comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
One concern is that this patch works for custom class in a plain jar file, but won't work with if the class loader has its own way to load class from more complicated location like "fat" jar, is it correct?
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. | |||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a new file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is a new file. In my first commit I included 2016 in the copyright by mistake, so I removed it in the second commit.
That's correct, I have filed JDK-8271598 (CDS classlist file should support uber JARs) to handle this issue. |
@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:
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 no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Thanks @calvinccheung and @yminqi for the review. |
Some applications load a lot of classes using custom loaders. This PR improves the start-up performance of these apps when using a "static" CDS archive:
Here are performance numbers for the Eclipse IDE:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4952/head:pull/4952
$ git checkout pull/4952
Update a local copy of the PR:
$ git checkout pull/4952
$ git pull https://git.openjdk.java.net/jdk pull/4952/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 4952
View PR using the GUI difftool:
$ git pr show -t 4952
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4952.diff