8222327: java_lang_Thread _thread_status_offset, remove pre 1.5 code paths

Reviewed-by: dholmes, redestad
This commit is contained in:
Robbin Ehn 2019-04-17 09:29:25 +02:00
parent 8552ad776a
commit b4fb17d63c

View File

@ -1714,21 +1714,14 @@ oop java_lang_Thread::inherited_access_control_context(oop java_thread) {
jlong java_lang_Thread::stackSize(oop java_thread) {
if (_stackSize_offset > 0) {
return java_thread->long_field(_stackSize_offset);
} else {
return 0;
}
}
// Write the thread status value to threadStatus field in java.lang.Thread java class.
void java_lang_Thread::set_thread_status(oop java_thread,
java_lang_Thread::ThreadStatus status) {
// The threadStatus is only present starting in 1.5
if (_thread_status_offset > 0) {
java_thread->int_field_put(_thread_status_offset, status);
}
}
// Read thread status value from threadStatus field in java.lang.Thread java class.
java_lang_Thread::ThreadStatus java_lang_Thread::get_thread_status(oop java_thread) {
@ -1737,62 +1730,31 @@ java_lang_Thread::ThreadStatus java_lang_Thread::get_thread_status(oop java_thre
assert(Threads_lock->owned_by_self() || Thread::current()->is_VM_thread() ||
JavaThread::current()->thread_state() == _thread_in_vm,
"Java Thread is not running in vm");
// The threadStatus is only present starting in 1.5
if (_thread_status_offset > 0) {
return (java_lang_Thread::ThreadStatus)java_thread->int_field(_thread_status_offset);
} else {
// All we can easily figure out is if it is alive, but that is
// enough info for a valid unknown status.
// These aren't restricted to valid set ThreadStatus values, so
// use JVMTI values and cast.
JavaThread* thr = java_lang_Thread::thread(java_thread);
if (thr == NULL) {
// the thread hasn't run yet or is in the process of exiting
return NEW;
}
return (java_lang_Thread::ThreadStatus)JVMTI_THREAD_STATE_ALIVE;
}
}
jlong java_lang_Thread::thread_id(oop java_thread) {
// The thread ID field is only present starting in 1.5
if (_tid_offset > 0) {
return java_thread->long_field(_tid_offset);
} else {
return 0;
}
}
oop java_lang_Thread::park_blocker(oop java_thread) {
assert(JDK_Version::current().supports_thread_park_blocker() &&
_park_blocker_offset != 0, "Must support parkBlocker field");
assert(JDK_Version::current().supports_thread_park_blocker(),
"Must support parkBlocker field");
if (_park_blocker_offset > 0) {
return java_thread->obj_field(_park_blocker_offset);
}
return NULL;
}
jlong java_lang_Thread::park_event(oop java_thread) {
if (_park_event_offset > 0) {
return java_thread->long_field(_park_event_offset);
}
return 0;
}
bool java_lang_Thread::set_park_event(oop java_thread, jlong ptr) {
if (_park_event_offset > 0) {
java_thread->long_field_put(_park_event_offset, ptr);
return true;
}
return false;
}
const char* java_lang_Thread::thread_status_name(oop java_thread) {
assert(_thread_status_offset != 0, "Must have thread status");
ThreadStatus status = (java_lang_Thread::ThreadStatus)java_thread->int_field(_thread_status_offset);
switch (status) {
case NEW : return "NEW";