6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/classLoader.hpp"
27 #include "classfile/javaClasses.hpp"
28 #include "classfile/moduleEntry.hpp"
29 #include "classfile/systemDictionary.hpp"
30 #include "classfile/vmSymbols.hpp"
31 #include "code/codeCache.hpp"
32 #include "code/scopeDesc.hpp"
33 #include "compiler/compileBroker.hpp"
34 #include "compiler/compileTask.hpp"
35 #include "gc/shared/gcId.hpp"
36 #include "gc/shared/gcLocker.inline.hpp"
37 #include "gc/shared/workgroup.hpp"
38 #include "interpreter/interpreter.hpp"
39 #include "interpreter/linkResolver.hpp"
40 #include "interpreter/oopMapCache.hpp"
41 #include "jvmtifiles/jvmtiEnv.hpp"
42 #include "logging/log.hpp"
43 #include "logging/logConfiguration.hpp"
44 #include "logging/logStream.hpp"
45 #include "memory/metaspaceShared.hpp"
46 #include "memory/oopFactory.hpp"
47 #include "memory/resourceArea.hpp"
48 #include "memory/universe.inline.hpp"
49 #include "oops/instanceKlass.hpp"
50 #include "oops/objArrayOop.hpp"
51 #include "oops/oop.inline.hpp"
52 #include "oops/symbol.hpp"
53 #include "oops/verifyOopClosure.hpp"
54 #include "prims/jvm.h"
55 #include "prims/jvm_misc.hpp"
56 #include "prims/jvmtiExport.hpp"
57 #include "prims/jvmtiThreadState.hpp"
58 #include "prims/privilegedStack.hpp"
59 #include "runtime/arguments.hpp"
60 #include "runtime/atomic.hpp"
61 #include "runtime/biasedLocking.hpp"
62 #include "runtime/commandLineFlagConstraintList.hpp"
63 #include "runtime/commandLineFlagWriteableList.hpp"
64 #include "runtime/commandLineFlagRangeList.hpp"
65 #include "runtime/deoptimization.hpp"
66 #include "runtime/frame.inline.hpp"
67 #include "runtime/globals.hpp"
68 #include "runtime/init.hpp"
69 #include "runtime/interfaceSupport.hpp"
70 #include "runtime/java.hpp"
71 #include "runtime/javaCalls.hpp"
72 #include "runtime/jniPeriodicChecker.hpp"
73 #include "runtime/timerTrace.hpp"
74 #include "runtime/memprofiler.hpp"
745 _jmp_ring[index]._file = file;
746 _jmp_ring[index]._line = line;
747 }
748 #endif // PRODUCT
749
750 void Thread::interrupt(Thread* thread) {
751 debug_only(check_for_dangling_thread_pointer(thread);)
752 os::interrupt(thread);
753 }
754
755 bool Thread::is_interrupted(Thread* thread, bool clear_interrupted) {
756 debug_only(check_for_dangling_thread_pointer(thread);)
757 // Note: If clear_interrupted==false, this simply fetches and
758 // returns the value of the field osthread()->interrupted().
759 return os::is_interrupted(thread, clear_interrupted);
760 }
761
762
763 // GC Support
764 bool Thread::claim_oops_do_par_case(int strong_roots_parity) {
765 jint thread_parity = _oops_do_parity;
766 if (thread_parity != strong_roots_parity) {
767 jint res = Atomic::cmpxchg(strong_roots_parity, &_oops_do_parity, thread_parity);
768 if (res == thread_parity) {
769 return true;
770 } else {
771 guarantee(res == strong_roots_parity, "Or else what?");
772 return false;
773 }
774 }
775 return false;
776 }
777
778 void Thread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
779 active_handles()->oops_do(f);
780 // Do oop for ThreadShadow
781 f->do_oop((oop*)&_pending_exception);
782 handle_area()->oops_do(f);
783
784 if (MonitorInUseLists) {
785 // When using thread local monitor lists, we scan them here,
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "jvm.h"
27 #include "classfile/classLoader.hpp"
28 #include "classfile/javaClasses.hpp"
29 #include "classfile/moduleEntry.hpp"
30 #include "classfile/systemDictionary.hpp"
31 #include "classfile/vmSymbols.hpp"
32 #include "code/codeCache.hpp"
33 #include "code/scopeDesc.hpp"
34 #include "compiler/compileBroker.hpp"
35 #include "compiler/compileTask.hpp"
36 #include "gc/shared/gcId.hpp"
37 #include "gc/shared/gcLocker.inline.hpp"
38 #include "gc/shared/workgroup.hpp"
39 #include "interpreter/interpreter.hpp"
40 #include "interpreter/linkResolver.hpp"
41 #include "interpreter/oopMapCache.hpp"
42 #include "jvmtifiles/jvmtiEnv.hpp"
43 #include "logging/log.hpp"
44 #include "logging/logConfiguration.hpp"
45 #include "logging/logStream.hpp"
46 #include "memory/metaspaceShared.hpp"
47 #include "memory/oopFactory.hpp"
48 #include "memory/resourceArea.hpp"
49 #include "memory/universe.inline.hpp"
50 #include "oops/instanceKlass.hpp"
51 #include "oops/objArrayOop.hpp"
52 #include "oops/oop.inline.hpp"
53 #include "oops/symbol.hpp"
54 #include "oops/verifyOopClosure.hpp"
55 #include "prims/jvm_misc.hpp"
56 #include "prims/jvmtiExport.hpp"
57 #include "prims/jvmtiThreadState.hpp"
58 #include "prims/privilegedStack.hpp"
59 #include "runtime/arguments.hpp"
60 #include "runtime/atomic.hpp"
61 #include "runtime/biasedLocking.hpp"
62 #include "runtime/commandLineFlagConstraintList.hpp"
63 #include "runtime/commandLineFlagWriteableList.hpp"
64 #include "runtime/commandLineFlagRangeList.hpp"
65 #include "runtime/deoptimization.hpp"
66 #include "runtime/frame.inline.hpp"
67 #include "runtime/globals.hpp"
68 #include "runtime/init.hpp"
69 #include "runtime/interfaceSupport.hpp"
70 #include "runtime/java.hpp"
71 #include "runtime/javaCalls.hpp"
72 #include "runtime/jniPeriodicChecker.hpp"
73 #include "runtime/timerTrace.hpp"
74 #include "runtime/memprofiler.hpp"
745 _jmp_ring[index]._file = file;
746 _jmp_ring[index]._line = line;
747 }
748 #endif // PRODUCT
749
750 void Thread::interrupt(Thread* thread) {
751 debug_only(check_for_dangling_thread_pointer(thread);)
752 os::interrupt(thread);
753 }
754
755 bool Thread::is_interrupted(Thread* thread, bool clear_interrupted) {
756 debug_only(check_for_dangling_thread_pointer(thread);)
757 // Note: If clear_interrupted==false, this simply fetches and
758 // returns the value of the field osthread()->interrupted().
759 return os::is_interrupted(thread, clear_interrupted);
760 }
761
762
763 // GC Support
764 bool Thread::claim_oops_do_par_case(int strong_roots_parity) {
765 int thread_parity = _oops_do_parity;
766 if (thread_parity != strong_roots_parity) {
767 jint res = Atomic::cmpxchg(strong_roots_parity, &_oops_do_parity, thread_parity);
768 if (res == thread_parity) {
769 return true;
770 } else {
771 guarantee(res == strong_roots_parity, "Or else what?");
772 return false;
773 }
774 }
775 return false;
776 }
777
778 void Thread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
779 active_handles()->oops_do(f);
780 // Do oop for ThreadShadow
781 f->do_oop((oop*)&_pending_exception);
782 handle_area()->oops_do(f);
783
784 if (MonitorInUseLists) {
785 // When using thread local monitor lists, we scan them here,
|