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
8263191: Consolidate ThreadInVMfromJavaNoAsyncException and ThreadBlockInVMWithDeadlockCheck with existing wrappers #2880
Conversation
|
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.
Looks good!
@pchilano This change now passes all automated pre-integration checks. 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 56 new commits pushed to the
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.
|
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 Patricio!
Thanks,
David
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 there are non-trivial differences between the old ThreadBlockInVM
and the new ThreadBlockInVM. Maybe I'm wrong, but they do not look
equivalent to me.
public: | ||
ThreadInVMfromJava(JavaThread* thread) : ThreadStateTransition(thread) { | ||
ThreadInVMfromJava(JavaThread* thread, bool check_async = true) : ThreadStateTransition(thread), _check_asyncs(check_async) { |
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.
Field is _check_asyncs
and parameter is check_async
.
Either add an s
to the parameter or delete the s
from the field.
public: | ||
ThreadBlockInVMWithDeadlockCheck(JavaThread* thread, Mutex** in_flight_mutex_addr) | ||
ThreadBlockInVM(JavaThread* thread, Mutex** in_flight_mutex_addr = NULL) |
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.
The new ThreadBlockInVM is not equivalent to the old one.
The old one used trans(_thread_in_vm, _thread_blocked)
which
asserted that the "from" state is equal to _thread_in_vm
. This
new code does not do that. The trans() call also resulted in a
SafepointMechanism::process_if_requested(thread);
call after
we transitioned the thread to _thread_in_vm
+1 and before we
set the new thread state to _thread_blocked
.
// All unsafe states are treated the same by the VMThread | ||
// so we can skip the _thread_in_vm_trans state here. Since | ||
// we don't read poll, it's enough to order the stores. | ||
OrderAccess::storestore(); | ||
|
||
thread->set_thread_state(_thread_blocked); |
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.
If you're going to set the thread_state directly here, I think you need
to keep the OrderAccess::storestore()
call. However, this new ThreadBlockInVM
is also missing a SafepointMechanism::process_if_requested(thread)
call that
happened before setting the _thread_blocked
state.
Mailing list message from patricio.chilano.mateo at oracle.com on hotspot-runtime-dev: Hi Dan, Thanks for looking at this. On 3/9/21 12:53 PM, Daniel D.Daugherty wrote:
Fixed.
Fixed. I added an assert() that the thread state is _thread_in_vm in
Calling explicitly SafepointMechanism::process_if_requested() in TBIVM() Thanks, |
I think you're missing my point about the equivalence of the old ThreadBlockInVM()
which means that when we were in ( It could be that this change in behavior doesn't make any real difference, |
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.
Thanks for making the fixes you've done so far, but I still
have one nagging question...
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.
Patricio and I have bounced this change in behavior back and forth
in Slack. I'm now convinced that it is a benign change in behavior.
Mailing list message from patricio.chilano.mateo at oracle.com on hotspot-runtime-dev: On 3/11/21 6:10 PM, Daniel D.Daugherty wrote:
Great, thanks Dan!
When the JT changes its state to blocked it will also be handshake safe, Patricio |
Thanks @coleenp, @dholmes-ora and @dcubed-ojdk for the reviews! |
/integrate |
@pchilano Since your change was applied there have been 95 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit d6b5e18. |
Hi,
Please review the following small patch. ThreadInVMfromJavaNoAsyncException is exactly the same as ThreadInVMfromJava except that in the destructor we avoid checking for asynchronous exceptions. Similarly ThreadBlockInVMWithDeadlockCheck is equal to ThreadBlockInVM except that in the destructor we might need to release a Mutex in case we need to stop for a safepoint or handshake.
We can consolidate these two wrappers with the existing ones to avoid code duplication and minimize the number of transition wrappers.
Tested in mach5 tiers 1-3.
Thanks,
Patricio
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2880/head:pull/2880
$ git checkout pull/2880