equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
33 #include "runtime/objectMonitor.inline.hpp" |
33 #include "runtime/objectMonitor.inline.hpp" |
34 #include "runtime/perfData.hpp" |
34 #include "runtime/perfData.hpp" |
35 #include "runtime/thread.hpp" |
35 #include "runtime/thread.hpp" |
36 #include "runtime/threadSMR.hpp" |
36 #include "runtime/threadSMR.hpp" |
37 #include "services/management.hpp" |
37 #include "services/management.hpp" |
38 #include "services/serviceUtil.hpp" |
|
39 |
38 |
40 class OopClosure; |
39 class OopClosure; |
41 class ThreadDumpResult; |
40 class ThreadDumpResult; |
42 class ThreadStackTrace; |
41 class ThreadStackTrace; |
43 class ThreadSnapshot; |
42 class ThreadSnapshot; |
546 // java_thread is waiting thread being blocked on monitor reenter. |
545 // java_thread is waiting thread being blocked on monitor reenter. |
547 // Current thread is the notifying thread which holds the monitor. |
546 // Current thread is the notifying thread which holds the monitor. |
548 static bool wait_reenter_begin(JavaThread *java_thread, ObjectMonitor *obj_m) { |
547 static bool wait_reenter_begin(JavaThread *java_thread, ObjectMonitor *obj_m) { |
549 assert((java_thread != NULL), "Java thread should not be null here"); |
548 assert((java_thread != NULL), "Java thread should not be null here"); |
550 bool active = false; |
549 bool active = false; |
551 if (is_alive(java_thread) && ServiceUtil::visible_oop((oop)obj_m->object())) { |
550 if (is_alive(java_thread)) { |
552 active = contended_enter_begin(java_thread); |
551 active = contended_enter_begin(java_thread); |
553 } |
552 } |
554 return active; |
553 return active; |
555 } |
554 } |
556 |
555 |
567 // Change thread status and collect contended enter stats for monitor contended |
566 // Change thread status and collect contended enter stats for monitor contended |
568 // enter done for external java world objects and it is contended. All other cases |
567 // enter done for external java world objects and it is contended. All other cases |
569 // like for vm internal objects and for external objects which are not contended |
568 // like for vm internal objects and for external objects which are not contended |
570 // thread status is not changed and contended enter stat is not collected. |
569 // thread status is not changed and contended enter stat is not collected. |
571 _active = false; |
570 _active = false; |
572 if (is_alive() && ServiceUtil::visible_oop((oop)obj_m->object()) && obj_m->contentions() > 0) { |
571 if (is_alive() && obj_m->contentions() > 0) { |
573 _stat = java_thread->get_thread_stat(); |
572 _stat = java_thread->get_thread_stat(); |
574 _active = contended_enter_begin(java_thread); |
573 _active = contended_enter_begin(java_thread); |
575 } |
574 } |
576 } |
575 } |
577 |
576 |