-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8361292: Rename ModuleEntry::module() to module_oop() #26102
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
8361292: Rename ModuleEntry::module() to module_oop() #26102
Conversation
|
👋 Welcome back iklam! A progress list of the required criteria for merging this PR into |
|
@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 3 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
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.
I like this change other than precond(). ModuleEntry vs java.lang.Module oops is clearer with a different method name. I've been confused by this too.
| assert(jlm != nullptr, "Null jlm in module_to ModuleEntry"); | ||
| intptr_t identity_hash = jlm->identity_hash(); | ||
| oop module_oop = module_to->module_oop(); | ||
| precond(module_oop != nullptr); |
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.
I don't like precond() when you could have a useful assert message instead.
| assert(jlm != nullptr, "Null jlm in module_from ModuleEntry"); | ||
| intptr_t identity_hash = jlm->identity_hash(); | ||
| oop module_oop = module_from->module_oop(); | ||
| precond(module_oop != nullptr); |
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.
same here. "Module oop should be non-null in ModuleEntry"
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 just read the oop from the module entry and assert that it's not null, so the original message didn't add any extra information. That's why I removed it.
I have added back a message, "should have been initialized".
The real story is more complex, but I think this message willl give enough hints -- the module oop is usually initialized inside the ModuleEntry constructor, except for a few cases for the java.base module where the module oop is retroactively updated. In any case, by the time we reach this assert, the module oop must have been initialized in one of those possible paths.
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.
| ModuleEntry* ModuleEntryTable::_javabase_module = nullptr; | ||
|
|
||
| oop ModuleEntry::module() const { return _module.resolve(); } | ||
| oop ModuleEntry::module_oop() const { return _module_handle.resolve(); } |
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.
(Pre-existing) Just wondering why this one-liner function doesn't reside in the moduleEntry.hpp?
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.
I think it's because OopHandle::resolve() is an inline function, but we are not allowed to include xxx.inline.hpp in non-inlined .hpp files.
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 @coleenp @calvinccheung @sspitsyn for the review |
|
Going to push as commit 66836d4.
Your commit was automatically rebased without conflicts. |
A module has both a Java and a C++ representation
ModuleEntryjava.lang.ModuleIn C++, we have the following two methods
ModuleEntry* InstanceKlass::module()oop ModuleEntry::module()This can lead to confusing code like this:
Proposal:
InstanceKlass::module()as is -- there's another function with the same style:PackageEntry* InstanceKlass::package()ModuleEntry::module()toModuleEntry::module_oop(), so the above example can be more readable:Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26102/head:pull/26102$ git checkout pull/26102Update a local copy of the PR:
$ git checkout pull/26102$ git pull https://git.openjdk.org/jdk.git pull/26102/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26102View PR using the GUI difftool:
$ git pr show -t 26102Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26102.diff
Using Webrev
Link to Webrev Comment