Mercurial > hg > graal-compiler
comparison src/share/vm/compiler/compileBroker.cpp @ 3464:be4ca325525a
Merge.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 27 Jul 2011 17:32:44 -0700 |
parents | 8b0236cbed14 f56542cb325a |
children | 65981c23c1d6 |
comparison
equal
deleted
inserted
replaced
3239:7c4b4daac19b | 3464:be4ca325525a |
---|---|
299 // CompileTask::print_compilation_impl | 299 // CompileTask::print_compilation_impl |
300 void CompileTask::print_compilation_impl(outputStream* st, methodOop method, int compile_id, int comp_level, bool is_osr_method, int osr_bci, bool is_blocking, const char* msg) { | 300 void CompileTask::print_compilation_impl(outputStream* st, methodOop method, int compile_id, int comp_level, bool is_osr_method, int osr_bci, bool is_blocking, const char* msg) { |
301 st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp | 301 st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp |
302 st->print("%4d ", compile_id); // print compilation number | 302 st->print("%4d ", compile_id); // print compilation number |
303 | 303 |
304 // For unloaded methods the transition to zombie occurs after the | |
305 // method is cleared so it's impossible to report accurate | |
306 // information for that case. | |
307 bool is_synchronized = false; | |
308 bool has_exception_handler = false; | |
309 bool is_native = false; | |
310 if (method != NULL) { | |
311 is_synchronized = method->is_synchronized(); | |
312 has_exception_handler = method->has_exception_handler(); | |
313 is_native = method->is_native(); | |
314 } | |
304 // method attributes | 315 // method attributes |
305 const char compile_type = is_osr_method ? '%' : ' '; | 316 const char compile_type = is_osr_method ? '%' : ' '; |
306 const char sync_char = method->is_synchronized() ? 's' : ' '; | 317 const char sync_char = is_synchronized ? 's' : ' '; |
307 const char exception_char = method->has_exception_handler() ? '!' : ' '; | 318 const char exception_char = has_exception_handler ? '!' : ' '; |
308 const char blocking_char = is_blocking ? 'b' : ' '; | 319 const char blocking_char = is_blocking ? 'b' : ' '; |
309 const char native_char = method->is_native() ? 'n' : ' '; | 320 const char native_char = is_native ? 'n' : ' '; |
310 | 321 |
311 // print method attributes | 322 // print method attributes |
312 st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char); | 323 st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char); |
313 | 324 |
314 if (TieredCompilation) { | 325 if (TieredCompilation) { |
315 if (comp_level != -1) st->print("%d ", comp_level); | 326 if (comp_level != -1) st->print("%d ", comp_level); |
316 else st->print("- "); | 327 else st->print("- "); |
317 } | 328 } |
318 st->print(" "); // more indent | 329 st->print(" "); // more indent |
319 | 330 |
320 method->print_short_name(st); | 331 if (method == NULL) { |
321 if (is_osr_method) { | 332 st->print("(method)"); |
322 st->print(" @ %d", osr_bci); | 333 } else { |
323 } | 334 method->print_short_name(st); |
324 st->print(" (%d bytes)", method->code_size()); | 335 if (is_osr_method) { |
336 st->print(" @ %d", osr_bci); | |
337 } | |
338 st->print(" (%d bytes)", method->code_size()); | |
339 } | |
325 | 340 |
326 if (msg != NULL) { | 341 if (msg != NULL) { |
327 st->print(" %s", msg); | 342 st->print(" %s", msg); |
328 } | 343 } |
329 st->cr(); | 344 st->cr(); |
1048 // in the case that this is a blocking compile request, is to have | 1063 // in the case that this is a blocking compile request, is to have |
1049 // all subsequent blocking requesters wait for completion of | 1064 // all subsequent blocking requesters wait for completion of |
1050 // ongoing compiles. Note that in this case we'll need a protocol | 1065 // ongoing compiles. Note that in this case we'll need a protocol |
1051 // for freeing the associated compile tasks. [Or we could have | 1066 // for freeing the associated compile tasks. [Or we could have |
1052 // a single static monitor on which all these waiters sleep.] | 1067 // a single static monitor on which all these waiters sleep.] |
1068 return; | |
1069 } | |
1070 | |
1071 // If the requesting thread is holding the pending list lock | |
1072 // then we just return. We can't risk blocking while holding | |
1073 // the pending list lock or a 3-way deadlock may occur | |
1074 // between the reference handler thread, a GC (instigated | |
1075 // by a compiler thread), and compiled method registration. | |
1076 if (instanceRefKlass::owns_pending_list_lock(JavaThread::current())) { | |
1053 return; | 1077 return; |
1054 } | 1078 } |
1055 | 1079 |
1056 // Outputs from the following MutexLocker block: | 1080 // Outputs from the following MutexLocker block: |
1057 CompileTask* task = NULL; | 1081 CompileTask* task = NULL; |
1386 // CompileBroker::is_compile_blocking | 1410 // CompileBroker::is_compile_blocking |
1387 // | 1411 // |
1388 // Should the current thread be blocked until this compilation request | 1412 // Should the current thread be blocked until this compilation request |
1389 // has been fulfilled? | 1413 // has been fulfilled? |
1390 bool CompileBroker::is_compile_blocking(methodHandle method, int osr_bci) { | 1414 bool CompileBroker::is_compile_blocking(methodHandle method, int osr_bci) { |
1391 if (!BackgroundCompilation) { | 1415 assert(!instanceRefKlass::owns_pending_list_lock(JavaThread::current()), "possible deadlock"); |
1392 Symbol* class_name = method->method_holder()->klass_part()->name(); | 1416 return !BackgroundCompilation; |
1393 if (class_name->starts_with("java/lang/ref/Reference", 23)) { | |
1394 // The reference handler thread can dead lock with the GC if compilation is blocking, | |
1395 // so we avoid blocking compiles for anything in the java.lang.ref.Reference class, | |
1396 // including inner classes such as ReferenceHandler. | |
1397 return false; | |
1398 } | |
1399 return true; | |
1400 } | |
1401 return false; | |
1402 } | 1417 } |
1403 | 1418 |
1404 | 1419 |
1405 // ------------------------------------------------------------------ | 1420 // ------------------------------------------------------------------ |
1406 // CompileBroker::preload_classes | 1421 // CompileBroker::preload_classes |