Mercurial > hg > graal-compiler
comparison src/share/vm/interpreter/interpreterRuntime.cpp @ 14489:f460c6926af7
Merge
author | ehelin |
---|---|
date | Tue, 25 Feb 2014 11:02:11 +0100 |
parents | 2b8e28fdf503 |
children | d8041d695d19 78bbf4d43a14 |
comparison
equal
deleted
inserted
replaced
14488:60fd6d24f49f | 14489:f460c6926af7 |
---|---|
239 | 239 |
240 | 240 |
241 //------------------------------------------------------------------------------------------------------------------------ | 241 //------------------------------------------------------------------------------------------------------------------------ |
242 // Exceptions | 242 // Exceptions |
243 | 243 |
244 void InterpreterRuntime::note_trap_inner(JavaThread* thread, int reason, | |
245 methodHandle trap_method, int trap_bci, TRAPS) { | |
246 if (trap_method.not_null()) { | |
247 MethodData* trap_mdo = trap_method->method_data(); | |
248 if (trap_mdo == NULL) { | |
249 Method::build_interpreter_method_data(trap_method, THREAD); | |
250 if (HAS_PENDING_EXCEPTION) { | |
251 assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), | |
252 "we expect only an OOM error here"); | |
253 CLEAR_PENDING_EXCEPTION; | |
254 } | |
255 trap_mdo = trap_method->method_data(); | |
256 // and fall through... | |
257 } | |
258 if (trap_mdo != NULL) { | |
259 // Update per-method count of trap events. The interpreter | |
260 // is updating the MDO to simulate the effect of compiler traps. | |
261 Deoptimization::update_method_data_from_interpreter(trap_mdo, trap_bci, reason); | |
262 } | |
263 } | |
264 } | |
265 | |
244 // Assume the compiler is (or will be) interested in this event. | 266 // Assume the compiler is (or will be) interested in this event. |
245 // If necessary, create an MDO to hold the information, and record it. | 267 // If necessary, create an MDO to hold the information, and record it. |
246 void InterpreterRuntime::note_trap(JavaThread* thread, int reason, TRAPS) { | 268 void InterpreterRuntime::note_trap(JavaThread* thread, int reason, TRAPS) { |
247 assert(ProfileTraps, "call me only if profiling"); | 269 assert(ProfileTraps, "call me only if profiling"); |
248 methodHandle trap_method(thread, method(thread)); | 270 methodHandle trap_method(thread, method(thread)); |
249 | 271 int trap_bci = trap_method->bci_from(bcp(thread)); |
250 if (trap_method.not_null()) { | 272 note_trap_inner(thread, reason, trap_method, trap_bci, THREAD); |
251 MethodData* trap_mdo = trap_method->method_data(); | 273 } |
252 if (trap_mdo == NULL) { | 274 |
253 Method::build_interpreter_method_data(trap_method, THREAD); | 275 #ifdef CC_INTERP |
254 if (HAS_PENDING_EXCEPTION) { | 276 // As legacy note_trap, but we have more arguments. |
255 assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here"); | 277 IRT_ENTRY(void, InterpreterRuntime::note_trap(JavaThread* thread, int reason, Method *method, int trap_bci)) |
256 CLEAR_PENDING_EXCEPTION; | 278 methodHandle trap_method(method); |
257 } | 279 note_trap_inner(thread, reason, trap_method, trap_bci, THREAD); |
258 trap_mdo = trap_method->method_data(); | 280 IRT_END |
259 // and fall through... | 281 |
260 } | 282 // Class Deoptimization is not visible in BytecodeInterpreter, so we need a wrapper |
261 if (trap_mdo != NULL) { | 283 // for each exception. |
262 // Update per-method count of trap events. The interpreter | 284 void InterpreterRuntime::note_nullCheck_trap(JavaThread* thread, Method *method, int trap_bci) |
263 // is updating the MDO to simulate the effect of compiler traps. | 285 { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_null_check, method, trap_bci); } |
264 int trap_bci = trap_method->bci_from(bcp(thread)); | 286 void InterpreterRuntime::note_div0Check_trap(JavaThread* thread, Method *method, int trap_bci) |
265 Deoptimization::update_method_data_from_interpreter(trap_mdo, trap_bci, reason); | 287 { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_div0_check, method, trap_bci); } |
266 } | 288 void InterpreterRuntime::note_rangeCheck_trap(JavaThread* thread, Method *method, int trap_bci) |
267 } | 289 { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_range_check, method, trap_bci); } |
268 } | 290 void InterpreterRuntime::note_classCheck_trap(JavaThread* thread, Method *method, int trap_bci) |
291 { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_class_check, method, trap_bci); } | |
292 void InterpreterRuntime::note_arrayCheck_trap(JavaThread* thread, Method *method, int trap_bci) | |
293 { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_array_check, method, trap_bci); } | |
294 #endif // CC_INTERP | |
295 | |
269 | 296 |
270 static Handle get_preinitialized_exception(Klass* k, TRAPS) { | 297 static Handle get_preinitialized_exception(Klass* k, TRAPS) { |
271 // get klass | 298 // get klass |
272 InstanceKlass* klass = InstanceKlass::cast(k); | 299 InstanceKlass* klass = InstanceKlass::cast(k); |
273 assert(klass->is_initialized(), | 300 assert(klass->is_initialized(), |