< prev index next >
src/hotspot/share/runtime/biasedLocking.cpp
Print this page
rev 47287 : Port 09.17.Thread_SMR_logging_update from JDK9 to JDK10
rev 47289 : eosterlund, stefank CR - refactor code into threadSMR.cpp and threadSMR.hpp
rev 47292 : stefank, coleenp CR - refactor most JavaThreadIterator usage to use JavaThreadIteratorWithHandle.
*** 210,222 ****
// Handle case where the thread toward which the object was biased has exited
bool thread_is_alive = false;
if (requesting_thread == biased_thread) {
thread_is_alive = true;
} else {
! ThreadsListHandle tlh;
! JavaThreadIterator jti(tlh.list());
! for (JavaThread* cur_thread = jti.first(); cur_thread != NULL; cur_thread = jti.next()) {
if (cur_thread == biased_thread) {
thread_is_alive = true;
break;
}
}
--- 210,220 ----
// Handle case where the thread toward which the object was biased has exited
bool thread_is_alive = false;
if (requesting_thread == biased_thread) {
thread_is_alive = true;
} else {
! for (JavaThreadIteratorWithHandle jtiwh; JavaThread *cur_thread = jtiwh.next(); ) {
if (cur_thread == biased_thread) {
thread_is_alive = true;
break;
}
}
*** 384,395 ****
Klass* k_o = o->klass();
Klass* klass = k_o;
{
! ThreadsListHandle tlh;
! JavaThreadIterator jti(tlh.list());
if (bulk_rebias) {
// Use the epoch in the klass of the object to implicitly revoke
// all biases of objects of this data type and force them to be
// reacquired. However, we also need to walk the stacks of all
--- 382,392 ----
Klass* k_o = o->klass();
Klass* klass = k_o;
{
! JavaThreadIteratorWithHandle jtiwh;
if (bulk_rebias) {
// Use the epoch in the klass of the object to implicitly revoke
// all biases of objects of this data type and force them to be
// reacquired. However, we also need to walk the stacks of all
*** 405,415 ****
klass->set_prototype_header(klass->prototype_header()->incr_bias_epoch());
int cur_epoch = klass->prototype_header()->bias_epoch();
// Now walk all threads' stacks and adjust epochs of any biased
// and locked objects of this data type we encounter
! for (JavaThread* thr = jti.first(); thr != NULL; thr = jti.next()) {
GrowableArray<MonitorInfo*>* cached_monitor_info = get_or_compute_monitor_info(thr);
for (int i = 0; i < cached_monitor_info->length(); i++) {
MonitorInfo* mon_info = cached_monitor_info->at(i);
oop owner = mon_info->owner();
markOop mark = owner->mark();
--- 402,412 ----
klass->set_prototype_header(klass->prototype_header()->incr_bias_epoch());
int cur_epoch = klass->prototype_header()->bias_epoch();
// Now walk all threads' stacks and adjust epochs of any biased
// and locked objects of this data type we encounter
! for (; JavaThread *thr = jtiwh.next(); ) {
GrowableArray<MonitorInfo*>* cached_monitor_info = get_or_compute_monitor_info(thr);
for (int i = 0; i < cached_monitor_info->length(); i++) {
MonitorInfo* mon_info = cached_monitor_info->at(i);
oop owner = mon_info->owner();
markOop mark = owner->mark();
*** 437,447 ****
// to be revoked.
klass->set_prototype_header(markOopDesc::prototype());
// Now walk all threads' stacks and forcibly revoke the biases of
// any locked and biased objects of this data type we encounter.
! for (JavaThread* thr = jti.first(); thr != NULL; thr = jti.next()) {
GrowableArray<MonitorInfo*>* cached_monitor_info = get_or_compute_monitor_info(thr);
for (int i = 0; i < cached_monitor_info->length(); i++) {
MonitorInfo* mon_info = cached_monitor_info->at(i);
oop owner = mon_info->owner();
markOop mark = owner->mark();
--- 434,444 ----
// to be revoked.
klass->set_prototype_header(markOopDesc::prototype());
// Now walk all threads' stacks and forcibly revoke the biases of
// any locked and biased objects of this data type we encounter.
! for (; JavaThread *thr = jtiwh.next(); ) {
GrowableArray<MonitorInfo*>* cached_monitor_info = get_or_compute_monitor_info(thr);
for (int i = 0; i < cached_monitor_info->length(); i++) {
MonitorInfo* mon_info = cached_monitor_info->at(i);
oop owner = mon_info->owner();
markOop mark = owner->mark();
*** 479,491 ****
}
static void clean_up_cached_monitor_info() {
// Walk the thread list clearing out the cached monitors
! ThreadsListHandle tlh;
! JavaThreadIterator jti(tlh.list());
! for (JavaThread* thr = jti.first(); thr != NULL; thr = jti.next()) {
thr->set_cached_monitor_info(NULL);
}
}
--- 476,486 ----
}
static void clean_up_cached_monitor_info() {
// Walk the thread list clearing out the cached monitors
! for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thr = jtiwh.next(); ) {
thr->set_cached_monitor_info(NULL);
}
}
*** 736,748 ****
_preserved_mark_stack = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<markOop>(10, true);
_preserved_oop_stack = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Handle>(10, true);
ResourceMark rm;
Thread* cur = Thread::current();
! ThreadsListHandle tlh;
! JavaThreadIterator jti(tlh.list());
! for (JavaThread* thread = jti.first(); thread != NULL; thread = jti.next()) {
if (thread->has_last_Java_frame()) {
RegisterMap rm(thread);
for (javaVFrame* vf = thread->last_java_vframe(&rm); vf != NULL; vf = vf->java_sender()) {
GrowableArray<MonitorInfo*> *monitors = vf->monitors();
if (monitors != NULL) {
--- 731,741 ----
_preserved_mark_stack = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<markOop>(10, true);
_preserved_oop_stack = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Handle>(10, true);
ResourceMark rm;
Thread* cur = Thread::current();
! for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {
if (thread->has_last_Java_frame()) {
RegisterMap rm(thread);
for (javaVFrame* vf = thread->last_java_vframe(&rm); vf != NULL; vf = vf->java_sender()) {
GrowableArray<MonitorInfo*> *monitors = vf->monitors();
if (monitors != NULL) {
< prev index next >