Mercurial > hg > graal-compiler
annotate src/share/vm/services/gcNotifier.cpp @ 4756:abcceac2f7cd
7119730: Tiered: SIGSEGV in AdvancedThresholdPolicy::is_method_profiled(methodOop)
Summary: Added handles for references to methods in select_task()
Reviewed-by: twisti, kvn
author | iveresov |
---|---|
date | Mon, 12 Dec 2011 12:44:08 -0800 |
parents | 87e40b34bc2b |
children | bf864f701a4a |
rev | line source |
---|---|
3356
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
1 /* |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
4 * |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
8 * |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
13 * accompanied this code). |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
14 * |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
18 * |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
21 * questions. |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
22 * |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
23 */ |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
24 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
25 #include "precompiled.hpp" |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
26 #include "classfile/systemDictionary.hpp" |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
27 #include "classfile/vmSymbols.hpp" |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
28 #include "oops/oop.inline.hpp" |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
29 #include "runtime/interfaceSupport.hpp" |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
30 #include "runtime/java.hpp" |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
31 #include "runtime/javaCalls.hpp" |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
32 #include "runtime/mutex.hpp" |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
33 #include "runtime/mutexLocker.hpp" |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
34 #include "services/gcNotifier.hpp" |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
35 #include "services/management.hpp" |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
36 #include "services/memoryService.hpp" |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
37 #include "memoryManager.hpp" |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
38 #include "memory/oopFactory.hpp" |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
39 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
40 GCNotificationRequest *GCNotifier::first_request = NULL; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
41 GCNotificationRequest *GCNotifier::last_request = NULL; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
42 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
43 void GCNotifier::pushNotification(GCMemoryManager *mgr, const char *action, const char *cause) { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
44 // Make a copy of the last GC statistics |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
45 // GC may occur between now and the creation of the notification |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
46 int num_pools = MemoryService::num_memory_pools(); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
47 GCStatInfo* stat = new GCStatInfo(num_pools); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
48 mgr->get_last_gc_stat(stat); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
49 GCNotificationRequest *request = new GCNotificationRequest(os::javaTimeMillis(),mgr,action,cause,stat); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
50 addRequest(request); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
51 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
52 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
53 void GCNotifier::addRequest(GCNotificationRequest *request) { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
54 MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
55 if(first_request == NULL) { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
56 first_request = request; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
57 } else { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
58 last_request->next = request; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
59 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
60 last_request = request; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
61 Service_lock->notify_all(); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
62 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
63 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
64 GCNotificationRequest *GCNotifier::getRequest() { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
65 MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
66 GCNotificationRequest *request = first_request; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
67 if(first_request != NULL) { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
68 first_request = first_request->next; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
69 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
70 return request; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
71 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
72 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
73 bool GCNotifier::has_event() { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
74 return first_request != NULL; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
75 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
76 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
77 static Handle getGcInfoBuilder(GCMemoryManager *gcManager,TRAPS) { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
78 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
79 klassOop k = Management::sun_management_GarbageCollectorImpl_klass(CHECK_NH); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
80 instanceKlassHandle gcMBeanKlass (THREAD, k); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
81 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
82 instanceOop i = gcManager->get_memory_manager_instance(THREAD); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
83 instanceHandle ih(THREAD, i); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
84 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
85 JavaValue result(T_OBJECT); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
86 JavaCallArguments args(ih); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
87 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
88 JavaCalls::call_virtual(&result, |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
89 gcMBeanKlass, |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
90 vmSymbols::getGcInfoBuilder_name(), |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
91 vmSymbols::getGcInfoBuilder_signature(), |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
92 &args, |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
93 CHECK_NH); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
94 return Handle(THREAD,(oop)result.get_jobject()); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
95 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
96 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
97 static Handle createGcInfo(GCMemoryManager *gcManager, GCStatInfo *gcStatInfo,TRAPS) { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
98 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
99 // Fill the arrays of MemoryUsage objects with before and after GC |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
100 // per pool memory usage |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
101 |
3829
87e40b34bc2b
7074579: G1: JVM crash with JDK7 running ATG CRMDemo Fusion App
johnc
parents:
3356
diff
changeset
|
102 klassOop mu_klass = Management::java_lang_management_MemoryUsage_klass(CHECK_NH); |
87e40b34bc2b
7074579: G1: JVM crash with JDK7 running ATG CRMDemo Fusion App
johnc
parents:
3356
diff
changeset
|
103 instanceKlassHandle mu_kh(THREAD, mu_klass); |
87e40b34bc2b
7074579: G1: JVM crash with JDK7 running ATG CRMDemo Fusion App
johnc
parents:
3356
diff
changeset
|
104 |
87e40b34bc2b
7074579: G1: JVM crash with JDK7 running ATG CRMDemo Fusion App
johnc
parents:
3356
diff
changeset
|
105 // The array allocations below should use a handle containing mu_klass |
87e40b34bc2b
7074579: G1: JVM crash with JDK7 running ATG CRMDemo Fusion App
johnc
parents:
3356
diff
changeset
|
106 // as the first allocation could trigger a GC, causing the actual |
87e40b34bc2b
7074579: G1: JVM crash with JDK7 running ATG CRMDemo Fusion App
johnc
parents:
3356
diff
changeset
|
107 // klass oop to move, and leaving mu_klass pointing to the old |
87e40b34bc2b
7074579: G1: JVM crash with JDK7 running ATG CRMDemo Fusion App
johnc
parents:
3356
diff
changeset
|
108 // location. |
87e40b34bc2b
7074579: G1: JVM crash with JDK7 running ATG CRMDemo Fusion App
johnc
parents:
3356
diff
changeset
|
109 objArrayOop bu = oopFactory::new_objArray(mu_kh(), MemoryService::num_memory_pools(), CHECK_NH); |
3356
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
110 objArrayHandle usage_before_gc_ah(THREAD, bu); |
3829
87e40b34bc2b
7074579: G1: JVM crash with JDK7 running ATG CRMDemo Fusion App
johnc
parents:
3356
diff
changeset
|
111 objArrayOop au = oopFactory::new_objArray(mu_kh(), MemoryService::num_memory_pools(), CHECK_NH); |
3356
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
112 objArrayHandle usage_after_gc_ah(THREAD, au); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
113 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
114 for (int i = 0; i < MemoryService::num_memory_pools(); i++) { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
115 Handle before_usage = MemoryService::create_MemoryUsage_obj(gcStatInfo->before_gc_usage_for_pool(i), CHECK_NH); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
116 Handle after_usage; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
117 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
118 MemoryUsage u = gcStatInfo->after_gc_usage_for_pool(i); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
119 if (u.max_size() == 0 && u.used() > 0) { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
120 // If max size == 0, this pool is a survivor space. |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
121 // Set max size = -1 since the pools will be swapped after GC. |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
122 MemoryUsage usage(u.init_size(), u.used(), u.committed(), (size_t)-1); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
123 after_usage = MemoryService::create_MemoryUsage_obj(usage, CHECK_NH); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
124 } else { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
125 after_usage = MemoryService::create_MemoryUsage_obj(u, CHECK_NH); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
126 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
127 usage_before_gc_ah->obj_at_put(i, before_usage()); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
128 usage_after_gc_ah->obj_at_put(i, after_usage()); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
129 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
130 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
131 // Current implementation only has 1 attribute (number of GC threads) |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
132 // The type is 'I' |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
133 objArrayOop extra_args_array = oopFactory::new_objArray(SystemDictionary::Integer_klass(), 1, CHECK_NH); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
134 objArrayHandle extra_array (THREAD, extra_args_array); |
3829
87e40b34bc2b
7074579: G1: JVM crash with JDK7 running ATG CRMDemo Fusion App
johnc
parents:
3356
diff
changeset
|
135 klassOop itKlass = SystemDictionary::Integer_klass(); |
3356
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
136 instanceKlassHandle intK(THREAD, itKlass); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
137 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
138 instanceHandle extra_arg_val = intK->allocate_instance_handle(CHECK_NH); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
139 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
140 { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
141 JavaValue res(T_VOID); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
142 JavaCallArguments argsInt; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
143 argsInt.push_oop(extra_arg_val); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
144 argsInt.push_int(gcManager->num_gc_threads()); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
145 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
146 JavaCalls::call_special(&res, |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
147 intK, |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
148 vmSymbols::object_initializer_name(), |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
149 vmSymbols::int_void_signature(), |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
150 &argsInt, |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
151 CHECK_NH); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
152 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
153 extra_array->obj_at_put(0,extra_arg_val()); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
154 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
155 klassOop gcInfoklass = Management::com_sun_management_GcInfo_klass(CHECK_NH); |
3829
87e40b34bc2b
7074579: G1: JVM crash with JDK7 running ATG CRMDemo Fusion App
johnc
parents:
3356
diff
changeset
|
156 instanceKlassHandle ik(THREAD, gcInfoklass); |
3356
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
157 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
158 Handle gcInfo_instance = ik->allocate_instance_handle(CHECK_NH); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
159 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
160 JavaValue constructor_result(T_VOID); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
161 JavaCallArguments constructor_args(16); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
162 constructor_args.push_oop(gcInfo_instance); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
163 constructor_args.push_oop(getGcInfoBuilder(gcManager,THREAD)); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
164 constructor_args.push_long(gcStatInfo->gc_index()); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
165 constructor_args.push_long(gcStatInfo->start_time()); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
166 constructor_args.push_long(gcStatInfo->end_time()); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
167 constructor_args.push_oop(usage_before_gc_ah); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
168 constructor_args.push_oop(usage_after_gc_ah); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
169 constructor_args.push_oop(extra_array); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
170 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
171 JavaCalls::call_special(&constructor_result, |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
172 ik, |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
173 vmSymbols::object_initializer_name(), |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
174 vmSymbols::com_sun_management_GcInfo_constructor_signature(), |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
175 &constructor_args, |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
176 CHECK_NH); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
177 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
178 return Handle(gcInfo_instance()); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
179 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
180 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
181 void GCNotifier::sendNotification(TRAPS) { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
182 ResourceMark rm(THREAD); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
183 GCNotificationRequest *request = getRequest(); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
184 if(request != NULL) { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
185 Handle objGcInfo = createGcInfo(request->gcManager,request->gcStatInfo,THREAD); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
186 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
187 Handle objName = java_lang_String::create_from_platform_dependent_str(request->gcManager->name(), CHECK); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
188 Handle objAction = java_lang_String::create_from_platform_dependent_str(request->gcAction, CHECK); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
189 Handle objCause = java_lang_String::create_from_platform_dependent_str(request->gcCause, CHECK); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
190 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
191 klassOop k = Management::sun_management_GarbageCollectorImpl_klass(CHECK); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
192 instanceKlassHandle gc_mbean_klass (THREAD, k); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
193 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
194 instanceOop gc_mbean = request->gcManager->get_memory_manager_instance(THREAD); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
195 instanceHandle gc_mbean_h(THREAD, gc_mbean); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
196 if (!gc_mbean_h->is_a(k)) { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
197 THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
198 "This GCMemoryManager doesn't have a GarbageCollectorMXBean"); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
199 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
200 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
201 JavaValue result(T_VOID); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
202 JavaCallArguments args(gc_mbean_h); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
203 args.push_long(request->timestamp); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
204 args.push_oop(objName); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
205 args.push_oop(objAction); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
206 args.push_oop(objCause); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
207 args.push_oop(objGcInfo); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
208 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
209 JavaCalls::call_virtual(&result, |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
210 gc_mbean_klass, |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
211 vmSymbols::createGCNotification_name(), |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
212 vmSymbols::createGCNotification_signature(), |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
213 &args, |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
214 CHECK); |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
215 if (HAS_PENDING_EXCEPTION) { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
216 CLEAR_PENDING_EXCEPTION; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
217 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
218 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
219 delete request; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
220 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
221 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
diff
changeset
|
222 |