Skip to content
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

8263896: Make not_suspended parameter from ObjectMonitor::exit() have default value #3101

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -388,6 +388,7 @@ bool ObjectMonitor::enter(JavaThread* current) {
{ // Change java thread status to indicate blocked on monitor enter.
JavaThreadBlockedOnMonitorEnterState jtbmes(current, this);

assert(current->current_pending_monitor() == NULL, "invariant");

This comment has been minimized.

@dholmes-ora

dholmes-ora Mar 29, 2021
Member

Really this belongs inside set_current_pending_monitor() where the only allowed transitions are null to non-null, and non-null to null. But that would be a separate RFE.

current->set_current_pending_monitor(this);

DTRACE_MONITOR_PROBE(contended__enter, this, object(), current);
@@ -421,7 +422,7 @@ bool ObjectMonitor::enter(JavaThread* current) {
//
_recursions = 0;
_succ = NULL;
exit(false, current);
exit(current, false /* not_suspended */);

current->java_suspend_self();
}
@@ -1139,7 +1140,7 @@ void ObjectMonitor::UnlinkAfterAcquire(JavaThread* current, ObjectWaiter* curren
// structured the code so the windows are short and the frequency
// of such futile wakups is low.

void ObjectMonitor::exit(bool not_suspended, JavaThread* current) {
void ObjectMonitor::exit(JavaThread* current, bool not_suspended) {
void* cur = owner_raw();
if (current != cur) {
if (current->is_lock_owned((address)cur)) {
@@ -1372,7 +1373,7 @@ intx ObjectMonitor::complete_exit(JavaThread* current) {
guarantee(current == owner_raw(), "complete_exit not owner");
intx save = _recursions; // record the old recursion count
_recursions = 0; // set the recursion level to be 0
exit(true, current); // exit the monitor
exit(current); // exit the monitor
guarantee(owner_raw() != current, "invariant");
return save;
}
@@ -1506,7 +1507,7 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
intx save = _recursions; // record the old recursion count
_waiters++; // increment the number of waiters
_recursions = 0; // set the recursion level to be 1
exit(true, current); // exit the monitor
exit(current); // exit the monitor
guarantee(owner_raw() != current, "invariant");

// The thread is on the WaitSet list - now park() it.
@@ -303,7 +303,7 @@ class ObjectMonitor : public CHeapObj<mtInternal> {
bool check_owner(TRAPS);

bool enter(JavaThread* current);
void exit(bool not_suspended, JavaThread* current);
void exit(JavaThread* current, bool not_suspended = true);
void wait(jlong millis, bool interruptible, TRAPS);
void notify(TRAPS);
void notifyAll(TRAPS);
@@ -518,7 +518,7 @@ void ObjectSynchronizer::exit(oop object, BasicLock* lock, JavaThread* current)
// The ObjectMonitor* can't be async deflated until ownership is
// dropped inside exit() and the ObjectMonitor* must be !is_busy().
ObjectMonitor* monitor = inflate(current, object, inflate_cause_vm_internal);
monitor->exit(true, current);
monitor->exit(current);
}

// -----------------------------------------------------------------------------
@@ -608,7 +608,7 @@ void ObjectSynchronizer::jni_exit(oop obj, TRAPS) {
// intentionally do not use CHECK on check_owner because we must exit the
// monitor even if an exception was already pending.
if (monitor->check_owner(THREAD)) {
monitor->exit(true, current);
monitor->exit(current);
}
}

ProTip! Use n and p to navigate between commits in a pull request.