-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8314480: Memory ordering spec updates in java.lang.ref #16644
Conversation
Mailing list message from Hans Boehm on core-libs-dev: I'm not convinced this helps. The isAlive() spec says: "A thread is alive if it has been started and has not yet terminated." Clearly an object is reachable if it can be accessed by a thread that will I think the JLS wording is a bit sloppy about what "live thread" means Even if the object is later accessed from an existing "live" thread, it Hans On Thu, May 9, 2024 at 11:44?AM Brent Christian <bchristi at openjdk.org> -------------- next part -------------- |
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.
You've addressed my comments, I don't have anything else.
Mailing list message from Brent Christian on core-libs-dev: On 5/10/24 10:54 AM, Hans Boehm wrote:
I would think; one "computation" a live thread can perform is to start another thread, which in
Once an object becomes finalizer-reachable, it can only be reached via a running finalizer. (JLS So maybe finalizer threads should not be considered "live" threads.
Agreed - if an object can (*and only can*) be accessed again after a finalizer resurrects it, that If an object gets resurrected by a finalizer, it does become reachable again and can again be
I think it would only matter for accesses from a finalizer thread. -Brent |
Mailing list message from Hans Boehm on core-libs-dev: On Mon, May 13, 2024 at 12:16?PM Brent Christian <brent.christian at oracle.com>
I'm arguing that even that doesn't matter. Let's say B is reachable from I now wonder whether "A <em>reachable</em> object is any object that can be Hans
-------------- next part -------------- |
@bchristi-git Just checking in—we're waiting for CSR-approval here before integrating? 🤔 |
Indeed - can't move forward without a CSR. Also wouldn't mind more reviewer ✔️s. 😉 |
I can do that. One other thing to do is to rebase the changes, it looks like this branch is 6 months behind main line. |
@AlanBateman @stuart-marks Any final words before @bchristi-git gets to do the honors of integrating? :) |
/integrate |
Going to push as commit 2cae9a0.
Your commit was automatically rebased without conflicts. |
@bchristi-git Pushed as commit 2cae9a0. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
* correctness. | ||
* triggering garbage collection. This method is applicable only | ||
* when reclamation may have visible effects, | ||
* such as for objects that use finalizers or {@link Cleaner}, or code that |
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 @link
tag does not produce a link in the Javadoc because this file imports jdk.internal.ref.Cleaner
.
Classes in the
java.lang.ref
package would benefit from an update to bring the spec in line with how the VM already behaves. The changes would focus on happens-before edges at some key points during reference processing.A couple key things we want to be able to say are:
Reference.reachabilityFence(x)
happens-before reference processing occurs for 'x'.Cleaner.register()
happens-before the Cleaner thread runs the registered cleaning action.This will bring Cleaner in line (or close) with the memory visibility guarantees made for finalizers in JLS 17.4.5:
"There is a happens-before edge from the end of a constructor of an object to the start of a finalizer (§12.6) for that object."
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16644/head:pull/16644
$ git checkout pull/16644
Update a local copy of the PR:
$ git checkout pull/16644
$ git pull https://git.openjdk.org/jdk.git pull/16644/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 16644
View PR using the GUI difftool:
$ git pr show -t 16644
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16644.diff
Webrev
Link to Webrev Comment