8291555: Implement alternative fast-locking scheme

Co-authored-by: Fei Yang <fyang@openjdk.org>
Co-authored-by: Thomas Stuefe <stuefe@openjdk.org>
Reviewed-by: dcubed, stuefe, shade, dholmes, dlong
This commit is contained in:
Roman Kennke 2023-05-08 17:51:39 +00:00
parent 4116b109f0
commit 7f6358a8b5
70 changed files with 2444 additions and 767 deletions

View file

@ -70,6 +70,7 @@
#include "runtime/javaCalls.hpp"
#include "runtime/javaThread.inline.hpp"
#include "runtime/jniHandles.inline.hpp"
#include "runtime/lockStack.inline.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/orderAccess.hpp"
#include "runtime/osThread.hpp"
@ -490,8 +491,9 @@ JavaThread::JavaThread() :
_class_to_be_initialized(nullptr),
_SleepEvent(ParkEvent::Allocate(this))
{
_SleepEvent(ParkEvent::Allocate(this)),
_lock_stack(this) {
set_jni_functions(jni_functions());
#if INCLUDE_JVMCI
@ -994,6 +996,7 @@ JavaThread* JavaThread::active() {
}
bool JavaThread::is_lock_owned(address adr) const {
assert(LockingMode != LM_LIGHTWEIGHT, "should not be called with new lightweight locking");
if (Thread::is_lock_owned(adr)) return true;
for (MonitorChunk* chunk = monitor_chunks(); chunk != nullptr; chunk = chunk->next()) {
@ -1387,6 +1390,10 @@ void JavaThread::oops_do_no_frames(OopClosure* f, CodeBlobClosure* cf) {
f->do_oop((oop*)entry->chunk_addr());
entry = entry->parent();
}
if (LockingMode == LM_LIGHTWEIGHT) {
lock_stack().oops_do(f);
}
}
void JavaThread::oops_do_frames(OopClosure* f, CodeBlobClosure* cf) {