< prev index next >

src/hotspot/share/services/threadService.hpp

Print this page
rev 47862 : imported patch 10.07.open.rebase_20171110.dcubed

*** 1,7 **** /* ! * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 30,39 **** --- 30,40 ---- #include "runtime/init.hpp" #include "runtime/jniHandles.hpp" #include "runtime/objectMonitor.hpp" #include "runtime/objectMonitor.inline.hpp" #include "runtime/perfData.hpp" + #include "runtime/thread.hpp" #include "services/management.hpp" #include "services/serviceUtil.hpp" class OopClosure; class ThreadDumpResult;
*** 107,117 **** static void reset_peak_thread_count(); static void reset_contention_count_stat(JavaThread* thread); static void reset_contention_time_stat(JavaThread* thread); ! static DeadlockCycle* find_deadlocks_at_safepoint(bool object_monitors_only); // GC support static void oops_do(OopClosure* f); static void metadata_do(void f(Metadata*)); }; --- 108,118 ---- static void reset_peak_thread_count(); static void reset_contention_count_stat(JavaThread* thread); static void reset_contention_time_stat(JavaThread* thread); ! static DeadlockCycle* find_deadlocks_at_safepoint(ThreadsList * t_list, bool object_monitors_only); // GC support static void oops_do(OopClosure* f); static void metadata_do(void f(Metadata*)); };
*** 187,196 **** --- 188,199 ---- }; // Thread snapshot to represent the thread state and statistics class ThreadSnapshot : public CHeapObj<mtInternal> { private: + // This JavaThread* is protected by being stored in objects that are + // protected by a ThreadsListSetter (ThreadDumpResult). JavaThread* _thread; oop _threadObj; java_lang_Thread::ThreadStatus _thread_status; bool _is_ext_suspended;
*** 211,221 **** public: // Dummy snapshot ThreadSnapshot() : _thread(NULL), _threadObj(NULL), _stack_trace(NULL), _concurrent_locks(NULL), _next(NULL), _blocker_object(NULL), _blocker_object_owner(NULL) {}; ! ThreadSnapshot(JavaThread* thread); ~ThreadSnapshot(); java_lang_Thread::ThreadStatus thread_status() { return _thread_status; } oop threadObj() const { return _threadObj; } --- 214,224 ---- public: // Dummy snapshot ThreadSnapshot() : _thread(NULL), _threadObj(NULL), _stack_trace(NULL), _concurrent_locks(NULL), _next(NULL), _blocker_object(NULL), _blocker_object_owner(NULL) {}; ! ThreadSnapshot(ThreadsList * t_list, JavaThread* thread); ~ThreadSnapshot(); java_lang_Thread::ThreadStatus thread_status() { return _thread_status; } oop threadObj() const { return _threadObj; }
*** 308,317 **** --- 311,326 ---- class ThreadConcurrentLocks : public CHeapObj<mtInternal> { private: GrowableArray<instanceOop>* _owned_locks; ThreadConcurrentLocks* _next; + // This JavaThread* is protected in one of two different ways + // depending on the usage of the ThreadConcurrentLocks object: + // 1) by being stored in objects that are only allocated and used at a + // safepoint (ConcurrentLocksDump), or 2) by being stored in objects + // that are protected by a ThreadsListSetter (ThreadSnapshot inside + // ThreadDumpResult). JavaThread* _thread; public: ThreadConcurrentLocks(JavaThread* thread); ~ThreadConcurrentLocks();
*** 331,342 **** void build_map(GrowableArray<oop>* aos_objects); void add_lock(JavaThread* thread, instanceOop o); public: ! ConcurrentLocksDump(bool retain_map_on_free) : _map(NULL), _last(NULL), _retain_map_on_free(retain_map_on_free) {}; ! ConcurrentLocksDump() : _map(NULL), _last(NULL), _retain_map_on_free(false) {}; ~ConcurrentLocksDump(); void dump_at_safepoint(); ThreadConcurrentLocks* thread_concurrent_locks(JavaThread* thread); void print_locks_on(JavaThread* t, outputStream* st); --- 340,355 ---- void build_map(GrowableArray<oop>* aos_objects); void add_lock(JavaThread* thread, instanceOop o); public: ! ConcurrentLocksDump(bool retain_map_on_free) : _map(NULL), _last(NULL), _retain_map_on_free(retain_map_on_free) { ! assert(SafepointSynchronize::is_at_safepoint(), "Must be constructed at a safepoint."); ! }; ! ConcurrentLocksDump() : _map(NULL), _last(NULL), _retain_map_on_free(false) { ! assert(SafepointSynchronize::is_at_safepoint(), "Must be constructed at a safepoint."); ! }; ~ConcurrentLocksDump(); void dump_at_safepoint(); ThreadConcurrentLocks* thread_concurrent_locks(JavaThread* thread); void print_locks_on(JavaThread* t, outputStream* st);
*** 347,356 **** --- 360,372 ---- int _num_threads; int _num_snapshots; ThreadSnapshot* _snapshots; ThreadSnapshot* _last; ThreadDumpResult* _next; + ThreadsListSetter _setter; // Helper to set hazard ptr in the originating thread + // which protects the JavaThreads in _snapshots. + public: ThreadDumpResult(); ThreadDumpResult(int num_threads); ~ThreadDumpResult();
*** 358,367 **** --- 374,386 ---- void set_next(ThreadDumpResult* next) { _next = next; } ThreadDumpResult* next() { return _next; } int num_threads() { return _num_threads; } int num_snapshots() { return _num_snapshots; } ThreadSnapshot* snapshots() { return _snapshots; } + void set_t_list() { _setter.set(); } + ThreadsList* t_list(); + bool t_list_has_been_set() { return _setter.target_needs_release(); } void oops_do(OopClosure* f); void metadata_do(void f(Metadata*)); }; class DeadlockCycle : public CHeapObj<mtInternal> {
*** 379,389 **** void reset() { _is_deadlock = false; _threads->clear(); } void set_deadlock(bool value) { _is_deadlock = value; } bool is_deadlock() { return _is_deadlock; } int num_threads() { return _threads->length(); } GrowableArray<JavaThread*>* threads() { return _threads; } ! void print_on(outputStream* st) const; }; // Utility class to get list of java threads. class ThreadsListEnumerator : public StackObj { private: --- 398,408 ---- void reset() { _is_deadlock = false; _threads->clear(); } void set_deadlock(bool value) { _is_deadlock = value; } bool is_deadlock() { return _is_deadlock; } int num_threads() { return _threads->length(); } GrowableArray<JavaThread*>* threads() { return _threads; } ! void print_on_with(ThreadsList * t_list, outputStream* st) const; }; // Utility class to get list of java threads. class ThreadsListEnumerator : public StackObj { private:
< prev index next >