8222327: java_lang_Thread _thread_status_offset, remove pre 1.5 code paths
Reviewed-by: dholmes, redestad
--- a/src/hotspot/share/classfile/javaClasses.cpp Wed Apr 17 09:25:27 2019 +0200
+++ b/src/hotspot/share/classfile/javaClasses.cpp Wed Apr 17 09:29:25 2019 +0200
@@ -1714,20 +1714,13 @@
jlong java_lang_Thread::stackSize(oop java_thread) {
- if (_stackSize_offset > 0) {
- return java_thread->long_field(_stackSize_offset);
- } else {
- return 0;
- }
+ return java_thread->long_field(_stackSize_offset);
}
// 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);
- }
+ java_thread->int_field_put(_thread_status_offset, status);
}
// Read thread status value from threadStatus field in java.lang.Thread java class.
@@ -1737,62 +1730,31 @@
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;
- }
+ return (java_lang_Thread::ThreadStatus)java_thread->int_field(_thread_status_offset);
}
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;
- }
+ return java_thread->long_field(_tid_offset);
}
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");
-
- if (_park_blocker_offset > 0) {
- return java_thread->obj_field(_park_blocker_offset);
- }
-
- return NULL;
+ assert(JDK_Version::current().supports_thread_park_blocker(),
+ "Must support parkBlocker field");
+
+ return java_thread->obj_field(_park_blocker_offset);
}
jlong java_lang_Thread::park_event(oop java_thread) {
- if (_park_event_offset > 0) {
- return java_thread->long_field(_park_event_offset);
- }
- return 0;
+ return java_thread->long_field(_park_event_offset);
}
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;
-}
-
+ java_thread->long_field_put(_park_event_offset, ptr);
+ return true;
+}
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";