Mercurial > hg > truffle
comparison src/share/vm/services/gcNotifier.cpp @ 3829:87e40b34bc2b
7074579: G1: JVM crash with JDK7 running ATG CRMDemo Fusion App
Summary: Handlize MemoryUsage klass oop in createGCInfo routine
Reviewed-by: tonyp, fparain, ysr, jcoomes
author | johnc |
---|---|
date | Thu, 11 Aug 2011 11:36:29 -0700 |
parents | 78542e2b5e35 |
children | bf864f701a4a |
comparison
equal
deleted
inserted
replaced
3828:e9db47a083cc | 3829:87e40b34bc2b |
---|---|
90 vmSymbols::getGcInfoBuilder_name(), | 90 vmSymbols::getGcInfoBuilder_name(), |
91 vmSymbols::getGcInfoBuilder_signature(), | 91 vmSymbols::getGcInfoBuilder_signature(), |
92 &args, | 92 &args, |
93 CHECK_NH); | 93 CHECK_NH); |
94 return Handle(THREAD,(oop)result.get_jobject()); | 94 return Handle(THREAD,(oop)result.get_jobject()); |
95 | |
96 } | 95 } |
97 | 96 |
98 static Handle createGcInfo(GCMemoryManager *gcManager, GCStatInfo *gcStatInfo,TRAPS) { | 97 static Handle createGcInfo(GCMemoryManager *gcManager, GCStatInfo *gcStatInfo,TRAPS) { |
99 | 98 |
100 // Fill the arrays of MemoryUsage objects with before and after GC | 99 // Fill the arrays of MemoryUsage objects with before and after GC |
101 // per pool memory usage | 100 // per pool memory usage |
102 | 101 |
103 klassOop muKlass = Management::java_lang_management_MemoryUsage_klass(CHECK_NH); objArrayOop bu = oopFactory::new_objArray( muKlass,MemoryService::num_memory_pools(), CHECK_NH); | 102 klassOop mu_klass = Management::java_lang_management_MemoryUsage_klass(CHECK_NH); |
103 instanceKlassHandle mu_kh(THREAD, mu_klass); | |
104 | |
105 // The array allocations below should use a handle containing mu_klass | |
106 // as the first allocation could trigger a GC, causing the actual | |
107 // klass oop to move, and leaving mu_klass pointing to the old | |
108 // location. | |
109 objArrayOop bu = oopFactory::new_objArray(mu_kh(), MemoryService::num_memory_pools(), CHECK_NH); | |
104 objArrayHandle usage_before_gc_ah(THREAD, bu); | 110 objArrayHandle usage_before_gc_ah(THREAD, bu); |
105 objArrayOop au = oopFactory::new_objArray(muKlass,MemoryService::num_memory_pools(), CHECK_NH); | 111 objArrayOop au = oopFactory::new_objArray(mu_kh(), MemoryService::num_memory_pools(), CHECK_NH); |
106 objArrayHandle usage_after_gc_ah(THREAD, au); | 112 objArrayHandle usage_after_gc_ah(THREAD, au); |
107 | 113 |
108 for (int i = 0; i < MemoryService::num_memory_pools(); i++) { | 114 for (int i = 0; i < MemoryService::num_memory_pools(); i++) { |
109 Handle before_usage = MemoryService::create_MemoryUsage_obj(gcStatInfo->before_gc_usage_for_pool(i), CHECK_NH); | 115 Handle before_usage = MemoryService::create_MemoryUsage_obj(gcStatInfo->before_gc_usage_for_pool(i), CHECK_NH); |
110 Handle after_usage; | 116 Handle after_usage; |
124 | 130 |
125 // Current implementation only has 1 attribute (number of GC threads) | 131 // Current implementation only has 1 attribute (number of GC threads) |
126 // The type is 'I' | 132 // The type is 'I' |
127 objArrayOop extra_args_array = oopFactory::new_objArray(SystemDictionary::Integer_klass(), 1, CHECK_NH); | 133 objArrayOop extra_args_array = oopFactory::new_objArray(SystemDictionary::Integer_klass(), 1, CHECK_NH); |
128 objArrayHandle extra_array (THREAD, extra_args_array); | 134 objArrayHandle extra_array (THREAD, extra_args_array); |
129 klassOop itKlass= SystemDictionary::Integer_klass(); | 135 klassOop itKlass = SystemDictionary::Integer_klass(); |
130 instanceKlassHandle intK(THREAD, itKlass); | 136 instanceKlassHandle intK(THREAD, itKlass); |
131 | 137 |
132 instanceHandle extra_arg_val = intK->allocate_instance_handle(CHECK_NH); | 138 instanceHandle extra_arg_val = intK->allocate_instance_handle(CHECK_NH); |
133 | 139 |
134 { | 140 { |
145 CHECK_NH); | 151 CHECK_NH); |
146 } | 152 } |
147 extra_array->obj_at_put(0,extra_arg_val()); | 153 extra_array->obj_at_put(0,extra_arg_val()); |
148 | 154 |
149 klassOop gcInfoklass = Management::com_sun_management_GcInfo_klass(CHECK_NH); | 155 klassOop gcInfoklass = Management::com_sun_management_GcInfo_klass(CHECK_NH); |
150 instanceKlassHandle ik (THREAD,gcInfoklass); | 156 instanceKlassHandle ik(THREAD, gcInfoklass); |
151 | 157 |
152 Handle gcInfo_instance = ik->allocate_instance_handle(CHECK_NH); | 158 Handle gcInfo_instance = ik->allocate_instance_handle(CHECK_NH); |
153 | 159 |
154 JavaValue constructor_result(T_VOID); | 160 JavaValue constructor_result(T_VOID); |
155 JavaCallArguments constructor_args(16); | 161 JavaCallArguments constructor_args(16); |