54 #include "prims/jvmtiExport.hpp" |
54 #include "prims/jvmtiExport.hpp" |
55 #include "prims/resolvedMethodTable.hpp" |
55 #include "prims/resolvedMethodTable.hpp" |
56 #include "runtime/fieldDescriptor.inline.hpp" |
56 #include "runtime/fieldDescriptor.inline.hpp" |
57 #include "runtime/frame.inline.hpp" |
57 #include "runtime/frame.inline.hpp" |
58 #include "runtime/handles.inline.hpp" |
58 #include "runtime/handles.inline.hpp" |
|
59 #include "runtime/init.hpp" |
59 #include "runtime/interfaceSupport.inline.hpp" |
60 #include "runtime/interfaceSupport.inline.hpp" |
60 #include "runtime/java.hpp" |
61 #include "runtime/java.hpp" |
61 #include "runtime/javaCalls.hpp" |
62 #include "runtime/javaCalls.hpp" |
62 #include "runtime/jniHandles.inline.hpp" |
63 #include "runtime/jniHandles.inline.hpp" |
63 #include "runtime/safepoint.hpp" |
64 #include "runtime/safepoint.hpp" |
1632 int java_lang_Thread::_group_offset = 0; |
1633 int java_lang_Thread::_group_offset = 0; |
1633 int java_lang_Thread::_contextClassLoader_offset = 0; |
1634 int java_lang_Thread::_contextClassLoader_offset = 0; |
1634 int java_lang_Thread::_inheritedAccessControlContext_offset = 0; |
1635 int java_lang_Thread::_inheritedAccessControlContext_offset = 0; |
1635 int java_lang_Thread::_priority_offset = 0; |
1636 int java_lang_Thread::_priority_offset = 0; |
1636 int java_lang_Thread::_eetop_offset = 0; |
1637 int java_lang_Thread::_eetop_offset = 0; |
|
1638 int java_lang_Thread::_interrupted_offset = 0; |
1637 int java_lang_Thread::_daemon_offset = 0; |
1639 int java_lang_Thread::_daemon_offset = 0; |
1638 int java_lang_Thread::_stillborn_offset = 0; |
1640 int java_lang_Thread::_stillborn_offset = 0; |
1639 int java_lang_Thread::_stackSize_offset = 0; |
1641 int java_lang_Thread::_stackSize_offset = 0; |
1640 int java_lang_Thread::_tid_offset = 0; |
1642 int java_lang_Thread::_tid_offset = 0; |
1641 int java_lang_Thread::_thread_status_offset = 0; |
1643 int java_lang_Thread::_thread_status_offset = 0; |
1647 macro(_contextClassLoader_offset, k, vmSymbols::contextClassLoader_name(), classloader_signature, false); \ |
1649 macro(_contextClassLoader_offset, k, vmSymbols::contextClassLoader_name(), classloader_signature, false); \ |
1648 macro(_inheritedAccessControlContext_offset, k, vmSymbols::inheritedAccessControlContext_name(), accesscontrolcontext_signature, false); \ |
1650 macro(_inheritedAccessControlContext_offset, k, vmSymbols::inheritedAccessControlContext_name(), accesscontrolcontext_signature, false); \ |
1649 macro(_priority_offset, k, vmSymbols::priority_name(), int_signature, false); \ |
1651 macro(_priority_offset, k, vmSymbols::priority_name(), int_signature, false); \ |
1650 macro(_daemon_offset, k, vmSymbols::daemon_name(), bool_signature, false); \ |
1652 macro(_daemon_offset, k, vmSymbols::daemon_name(), bool_signature, false); \ |
1651 macro(_eetop_offset, k, "eetop", long_signature, false); \ |
1653 macro(_eetop_offset, k, "eetop", long_signature, false); \ |
|
1654 macro(_interrupted_offset, k, "interrupted", bool_signature, false); \ |
1652 macro(_stillborn_offset, k, "stillborn", bool_signature, false); \ |
1655 macro(_stillborn_offset, k, "stillborn", bool_signature, false); \ |
1653 macro(_stackSize_offset, k, "stackSize", long_signature, false); \ |
1656 macro(_stackSize_offset, k, "stackSize", long_signature, false); \ |
1654 macro(_tid_offset, k, "tid", long_signature, false); \ |
1657 macro(_tid_offset, k, "tid", long_signature, false); \ |
1655 macro(_thread_status_offset, k, "threadStatus", int_signature, false); \ |
1658 macro(_thread_status_offset, k, "threadStatus", int_signature, false); \ |
1656 macro(_park_blocker_offset, k, "parkBlocker", object_signature, false) |
1659 macro(_park_blocker_offset, k, "parkBlocker", object_signature, false) |
1673 } |
1676 } |
1674 |
1677 |
1675 |
1678 |
1676 void java_lang_Thread::set_thread(oop java_thread, JavaThread* thread) { |
1679 void java_lang_Thread::set_thread(oop java_thread, JavaThread* thread) { |
1677 java_thread->address_field_put(_eetop_offset, (address)thread); |
1680 java_thread->address_field_put(_eetop_offset, (address)thread); |
|
1681 } |
|
1682 |
|
1683 bool java_lang_Thread::interrupted(oop java_thread) { |
|
1684 #if INCLUDE_JFR |
|
1685 if (java_thread == NULL) { |
|
1686 // can happen from Jfr::on_vm_init leading to call of JavaThread::sleep |
|
1687 assert(!is_init_completed(), "should only happen during init"); |
|
1688 return false; |
|
1689 } |
|
1690 #endif |
|
1691 return java_thread->bool_field_volatile(_interrupted_offset); |
|
1692 } |
|
1693 |
|
1694 void java_lang_Thread::set_interrupted(oop java_thread, bool val) { |
|
1695 java_thread->bool_field_put_volatile(_interrupted_offset, val); |
1678 } |
1696 } |
1679 |
1697 |
1680 |
1698 |
1681 oop java_lang_Thread::name(oop java_thread) { |
1699 oop java_lang_Thread::name(oop java_thread) { |
1682 return java_thread->obj_field(_name_offset); |
1700 return java_thread->obj_field(_name_offset); |