comparison src/share/vm/runtime/advancedThresholdPolicy.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 43f9d800f276
children 20334ed5ed3c
comparison
equal deleted inserted replaced
4131:e9b91fd07263 4756:abcceac2f7cd
154 } 154 }
155 155
156 // Called with the queue locked and with at least one element 156 // Called with the queue locked and with at least one element
157 CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) { 157 CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) {
158 CompileTask *max_task = NULL; 158 CompileTask *max_task = NULL;
159 methodOop max_method; 159 methodHandle max_method;
160 jlong t = os::javaTimeMillis(); 160 jlong t = os::javaTimeMillis();
161 // Iterate through the queue and find a method with a maximum rate. 161 // Iterate through the queue and find a method with a maximum rate.
162 for (CompileTask* task = compile_queue->first(); task != NULL;) { 162 for (CompileTask* task = compile_queue->first(); task != NULL;) {
163 CompileTask* next_task = task->next(); 163 CompileTask* next_task = task->next();
164 methodOop method = (methodOop)JNIHandles::resolve(task->method_handle()); 164 methodHandle method = (methodOop)JNIHandles::resolve(task->method_handle());
165 methodDataOop mdo = method->method_data(); 165 update_rate(t, method());
166 update_rate(t, method);
167 if (max_task == NULL) { 166 if (max_task == NULL) {
168 max_task = task; 167 max_task = task;
169 max_method = method; 168 max_method = method;
170 } else { 169 } else {
171 // If a method has been stale for some time, remove it from the queue. 170 // If a method has been stale for some time, remove it from the queue.
172 if (is_stale(t, TieredCompileTaskTimeout, method) && !is_old(method)) { 171 if (is_stale(t, TieredCompileTaskTimeout, method()) && !is_old(method())) {
173 if (PrintTieredEvents) { 172 if (PrintTieredEvents) {
174 print_event(REMOVE_FROM_QUEUE, method, method, task->osr_bci(), (CompLevel)task->comp_level()); 173 print_event(REMOVE_FROM_QUEUE, method, method, task->osr_bci(), (CompLevel)task->comp_level());
175 } 174 }
176 CompileTaskWrapper ctw(task); // Frees the task 175 CompileTaskWrapper ctw(task); // Frees the task
177 compile_queue->remove(task); 176 compile_queue->remove(task);
179 task = next_task; 178 task = next_task;
180 continue; 179 continue;
181 } 180 }
182 181
183 // Select a method with a higher rate 182 // Select a method with a higher rate
184 if (compare_methods(method, max_method)) { 183 if (compare_methods(method(), max_method())) {
185 max_task = task; 184 max_task = task;
186 max_method = method; 185 max_method = method;
187 } 186 }
188 } 187 }
189 task = next_task; 188 task = next_task;
190 } 189 }
191 190
192 if (max_task->comp_level() == CompLevel_full_profile && TieredStopAtLevel > CompLevel_full_profile 191 if (max_task->comp_level() == CompLevel_full_profile && TieredStopAtLevel > CompLevel_full_profile
193 && is_method_profiled(max_method)) { 192 && is_method_profiled(max_method())) {
194 max_task->set_comp_level(CompLevel_limited_profile); 193 max_task->set_comp_level(CompLevel_limited_profile);
195 if (PrintTieredEvents) { 194 if (PrintTieredEvents) {
196 print_event(UPDATE_IN_QUEUE, max_method, max_method, max_task->osr_bci(), (CompLevel)max_task->comp_level()); 195 print_event(UPDATE_IN_QUEUE, max_method, max_method, max_task->osr_bci(), (CompLevel)max_task->comp_level());
197 } 196 }
198 } 197 }