Mercurial > hg > graal-compiler
comparison src/share/vm/interpreter/interpreterRuntime.cpp @ 18041:52b4284cb496
Merge with jdk8u20-b26
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 15 Oct 2014 16:02:50 +0200 |
parents | 4062efea018b 78bbf4d43a14 |
children | 42de29c9ffbc |
comparison
equal
deleted
inserted
replaced
17606:45d7b2c7029d | 18041:52b4284cb496 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2014, 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. |
73 #endif | 73 #endif |
74 #ifdef COMPILER2 | 74 #ifdef COMPILER2 |
75 #include "opto/runtime.hpp" | 75 #include "opto/runtime.hpp" |
76 #endif | 76 #endif |
77 | 77 |
78 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC | |
79 | |
78 class UnlockFlagSaver { | 80 class UnlockFlagSaver { |
79 private: | 81 private: |
80 JavaThread* _thread; | 82 JavaThread* _thread; |
81 bool _do_not_unlock; | 83 bool _do_not_unlock; |
82 public: | 84 public: |
239 | 241 |
240 | 242 |
241 //------------------------------------------------------------------------------------------------------------------------ | 243 //------------------------------------------------------------------------------------------------------------------------ |
242 // Exceptions | 244 // Exceptions |
243 | 245 |
246 void InterpreterRuntime::note_trap_inner(JavaThread* thread, int reason, | |
247 methodHandle trap_method, int trap_bci, TRAPS) { | |
248 if (trap_method.not_null()) { | |
249 MethodData* trap_mdo = trap_method->method_data(); | |
250 if (trap_mdo == NULL) { | |
251 Method::build_interpreter_method_data(trap_method, THREAD); | |
252 if (HAS_PENDING_EXCEPTION) { | |
253 assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), | |
254 "we expect only an OOM error here"); | |
255 CLEAR_PENDING_EXCEPTION; | |
256 } | |
257 trap_mdo = trap_method->method_data(); | |
258 // and fall through... | |
259 } | |
260 if (trap_mdo != NULL) { | |
261 // Update per-method count of trap events. The interpreter | |
262 // is updating the MDO to simulate the effect of compiler traps. | |
263 Deoptimization::update_method_data_from_interpreter(trap_mdo, trap_bci, reason); | |
264 } | |
265 } | |
266 } | |
267 | |
244 // Assume the compiler is (or will be) interested in this event. | 268 // Assume the compiler is (or will be) interested in this event. |
245 // If necessary, create an MDO to hold the information, and record it. | 269 // If necessary, create an MDO to hold the information, and record it. |
246 void InterpreterRuntime::note_trap(JavaThread* thread, int reason, TRAPS) { | 270 void InterpreterRuntime::note_trap(JavaThread* thread, int reason, TRAPS) { |
247 assert(ProfileTraps, "call me only if profiling"); | 271 assert(ProfileTraps, "call me only if profiling"); |
248 methodHandle trap_method(thread, method(thread)); | 272 methodHandle trap_method(thread, method(thread)); |
249 | 273 int trap_bci = trap_method->bci_from(bcp(thread)); |
250 if (trap_method.not_null()) { | 274 note_trap_inner(thread, reason, trap_method, trap_bci, THREAD); |
251 MethodData* trap_mdo = trap_method->method_data(); | 275 } |
252 if (trap_mdo == NULL) { | 276 |
253 Method::build_interpreter_method_data(trap_method, THREAD); | 277 #ifdef CC_INTERP |
254 if (HAS_PENDING_EXCEPTION) { | 278 // 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"); | 279 IRT_ENTRY(void, InterpreterRuntime::note_trap(JavaThread* thread, int reason, Method *method, int trap_bci)) |
256 CLEAR_PENDING_EXCEPTION; | 280 methodHandle trap_method(method); |
257 } | 281 note_trap_inner(thread, reason, trap_method, trap_bci, THREAD); |
258 trap_mdo = trap_method->method_data(); | 282 IRT_END |
259 // and fall through... | 283 |
260 } | 284 // Class Deoptimization is not visible in BytecodeInterpreter, so we need a wrapper |
261 if (trap_mdo != NULL) { | 285 // for each exception. |
262 // Update per-method count of trap events. The interpreter | 286 void InterpreterRuntime::note_nullCheck_trap(JavaThread* thread, Method *method, int trap_bci) |
263 // is updating the MDO to simulate the effect of compiler traps. | 287 { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_null_check, method, trap_bci); } |
264 int trap_bci = trap_method->bci_from(bcp(thread)); | 288 void InterpreterRuntime::note_div0Check_trap(JavaThread* thread, Method *method, int trap_bci) |
265 Deoptimization::update_method_data_from_interpreter(trap_mdo, trap_bci, reason); | 289 { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_div0_check, method, trap_bci); } |
266 } | 290 void InterpreterRuntime::note_rangeCheck_trap(JavaThread* thread, Method *method, int trap_bci) |
267 } | 291 { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_range_check, method, trap_bci); } |
268 } | 292 void InterpreterRuntime::note_classCheck_trap(JavaThread* thread, Method *method, int trap_bci) |
293 { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_class_check, method, trap_bci); } | |
294 void InterpreterRuntime::note_arrayCheck_trap(JavaThread* thread, Method *method, int trap_bci) | |
295 { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_array_check, method, trap_bci); } | |
296 #endif // CC_INTERP | |
297 | |
269 | 298 |
270 static Handle get_preinitialized_exception(Klass* k, TRAPS) { | 299 static Handle get_preinitialized_exception(Klass* k, TRAPS) { |
271 // get klass | 300 // get klass |
272 InstanceKlass* klass = InstanceKlass::cast(k); | 301 InstanceKlass* klass = InstanceKlass::cast(k); |
273 assert(klass->is_initialized(), | 302 assert(klass->is_initialized(), |
435 } while (should_repeat == true); | 464 } while (should_repeat == true); |
436 | 465 |
437 #ifdef GRAAL | 466 #ifdef GRAAL |
438 if (h_method->method_data() != NULL) { | 467 if (h_method->method_data() != NULL) { |
439 ResourceMark rm(thread); | 468 ResourceMark rm(thread); |
440 ProfileData* pdata = h_method->method_data()->allocate_bci_to_data(current_bci); | 469 ProfileData* pdata = h_method->method_data()->allocate_bci_to_data(current_bci, h_method()); |
441 if (pdata != NULL && pdata->is_BitData()) { | 470 if (pdata != NULL && pdata->is_BitData()) { |
442 BitData* bit_data = (BitData*) pdata; | 471 BitData* bit_data = (BitData*) pdata; |
443 bit_data->set_exception_seen(); | 472 bit_data->set_exception_seen(); |
444 } | 473 } |
445 } | 474 } |