Mercurial > hg > graal-jvmci-8
comparison src/share/vm/compiler/compileBroker.cpp @ 6800:9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
Reviewed-by: kvn
author | twisti |
---|---|
date | Mon, 24 Sep 2012 17:59:24 -0700 |
parents | aed758eda82a |
children | c3e799c37717 |
comparison
equal
deleted
inserted
replaced
6799:c92f43386117 | 6800:9191895df19d |
---|---|
195 CompilationLog() : StringEventLog("Compilation events") { | 195 CompilationLog() : StringEventLog("Compilation events") { |
196 } | 196 } |
197 | 197 |
198 void log_compile(JavaThread* thread, CompileTask* task) { | 198 void log_compile(JavaThread* thread, CompileTask* task) { |
199 StringLogMessage lm; | 199 StringLogMessage lm; |
200 stringStream msg = lm.stream(); | 200 stringStream sstr = lm.stream(); |
201 // msg.time_stamp().update_to(tty->time_stamp().ticks()); | 201 // msg.time_stamp().update_to(tty->time_stamp().ticks()); |
202 task->print_compilation(&msg, true); | 202 task->print_compilation(&sstr, NULL, true); |
203 log(thread, "%s", (const char*)lm); | 203 log(thread, "%s", (const char*)lm); |
204 } | 204 } |
205 | 205 |
206 void log_nmethod(JavaThread* thread, nmethod* nm) { | 206 void log_nmethod(JavaThread* thread, nmethod* nm) { |
207 log(thread, "nmethod %d%s " INTPTR_FORMAT " code ["INTPTR_FORMAT ", " INTPTR_FORMAT "]", | 207 log(thread, "nmethod %d%s " INTPTR_FORMAT " code ["INTPTR_FORMAT ", " INTPTR_FORMAT "]", |
489 for (int i = 0; i < inline_level; i++) st->print(" "); | 489 for (int i = 0; i < inline_level; i++) st->print(" "); |
490 } | 490 } |
491 | 491 |
492 // ------------------------------------------------------------------ | 492 // ------------------------------------------------------------------ |
493 // CompileTask::print_compilation | 493 // CompileTask::print_compilation |
494 void CompileTask::print_compilation(outputStream* st, bool short_form) { | 494 void CompileTask::print_compilation(outputStream* st, const char* msg, bool short_form) { |
495 bool is_osr_method = osr_bci() != InvocationEntryBci; | 495 bool is_osr_method = osr_bci() != InvocationEntryBci; |
496 print_compilation_impl(st, method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), NULL, short_form); | 496 print_compilation_impl(st, method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), msg, short_form); |
497 } | 497 } |
498 | 498 |
499 // ------------------------------------------------------------------ | 499 // ------------------------------------------------------------------ |
500 // CompileTask::log_task | 500 // CompileTask::log_task |
501 void CompileTask::log_task(xmlStream* log) { | 501 void CompileTask::log_task(xmlStream* log) { |
1247 "all OSR compiles are assumed to be at a single compilation lavel"); | 1247 "all OSR compiles are assumed to be at a single compilation lavel"); |
1248 #endif // TIERED | 1248 #endif // TIERED |
1249 // We accept a higher level osr method | 1249 // We accept a higher level osr method |
1250 nmethod* nm = method->lookup_osr_nmethod_for(osr_bci, comp_level, false); | 1250 nmethod* nm = method->lookup_osr_nmethod_for(osr_bci, comp_level, false); |
1251 if (nm != NULL) return nm; | 1251 if (nm != NULL) return nm; |
1252 if (method->is_not_osr_compilable()) return NULL; | 1252 if (method->is_not_osr_compilable(comp_level)) return NULL; |
1253 } | 1253 } |
1254 | 1254 |
1255 assert(!HAS_PENDING_EXCEPTION, "No exception should be present"); | 1255 assert(!HAS_PENDING_EXCEPTION, "No exception should be present"); |
1256 // some prerequisites that are compiler specific | 1256 // some prerequisites that are compiler specific |
1257 if (compiler(comp_level)->is_c2() || compiler(comp_level)->is_shark()) { | 1257 if (compiler(comp_level)->is_c2() || compiler(comp_level)->is_shark()) { |
1328 bool CompileBroker::compilation_is_complete(methodHandle method, | 1328 bool CompileBroker::compilation_is_complete(methodHandle method, |
1329 int osr_bci, | 1329 int osr_bci, |
1330 int comp_level) { | 1330 int comp_level) { |
1331 bool is_osr = (osr_bci != standard_entry_bci); | 1331 bool is_osr = (osr_bci != standard_entry_bci); |
1332 if (is_osr) { | 1332 if (is_osr) { |
1333 if (method->is_not_osr_compilable()) { | 1333 if (method->is_not_osr_compilable(comp_level)) { |
1334 return true; | 1334 return true; |
1335 } else { | 1335 } else { |
1336 nmethod* result = method->lookup_osr_nmethod_for(osr_bci, comp_level, true); | 1336 nmethod* result = method->lookup_osr_nmethod_for(osr_bci, comp_level, true); |
1337 return (result != NULL); | 1337 return (result != NULL); |
1338 } | 1338 } |
1379 | 1379 |
1380 bool is_osr = (osr_bci != standard_entry_bci); | 1380 bool is_osr = (osr_bci != standard_entry_bci); |
1381 // Some compilers may not support on stack replacement. | 1381 // Some compilers may not support on stack replacement. |
1382 if (is_osr && | 1382 if (is_osr && |
1383 (!CICompileOSR || !compiler(comp_level)->supports_osr())) { | 1383 (!CICompileOSR || !compiler(comp_level)->supports_osr())) { |
1384 method->set_not_osr_compilable(); | 1384 method->set_not_osr_compilable(comp_level); |
1385 return true; | 1385 return true; |
1386 } | 1386 } |
1387 | 1387 |
1388 // The method may be explicitly excluded by the user. | 1388 // The method may be explicitly excluded by the user. |
1389 bool quietly; | 1389 bool quietly; |
1805 const char* retry_message = ci_env.retry_message(); | 1805 const char* retry_message = ci_env.retry_message(); |
1806 if (_compilation_log != NULL) { | 1806 if (_compilation_log != NULL) { |
1807 _compilation_log->log_failure(thread, task, ci_env.failure_reason(), retry_message); | 1807 _compilation_log->log_failure(thread, task, ci_env.failure_reason(), retry_message); |
1808 } | 1808 } |
1809 if (PrintCompilation) { | 1809 if (PrintCompilation) { |
1810 tty->print("%4d COMPILE SKIPPED: %s", compile_id, ci_env.failure_reason()); | 1810 FormatBufferResource msg = retry_message != NULL ? |
1811 if (retry_message != NULL) { | 1811 err_msg_res("COMPILE SKIPPED: %s (%s)", ci_env.failure_reason(), retry_message) : |
1812 tty->print(" (%s)", retry_message); | 1812 err_msg_res("COMPILE SKIPPED: %s", ci_env.failure_reason()); |
1813 } | 1813 task->print_compilation(tty, msg); |
1814 tty->cr(); | |
1815 } | 1814 } |
1816 } else { | 1815 } else { |
1817 task->mark_success(); | 1816 task->mark_success(); |
1818 task->set_num_inlined_bytecodes(ci_env.num_inlined_bytecodes()); | 1817 task->set_num_inlined_bytecodes(ci_env.num_inlined_bytecodes()); |
1819 if (_compilation_log != NULL) { | 1818 if (_compilation_log != NULL) { |
1838 tty->print("%s ", (is_osr ? "%" : " ")); | 1837 tty->print("%s ", (is_osr ? "%" : " ")); |
1839 int code_size = (task->code() == NULL) ? 0 : task->code()->total_size(); | 1838 int code_size = (task->code() == NULL) ? 0 : task->code()->total_size(); |
1840 tty->print_cr("size: %d time: %d inlined: %d bytes", code_size, (int)time.milliseconds(), task->num_inlined_bytecodes()); | 1839 tty->print_cr("size: %d time: %d inlined: %d bytes", code_size, (int)time.milliseconds(), task->num_inlined_bytecodes()); |
1841 } | 1840 } |
1842 | 1841 |
1843 if (compilable == ciEnv::MethodCompilable_never) { | 1842 // Disable compilation, if required. |
1844 if (is_osr) { | 1843 switch (compilable) { |
1845 method->set_not_osr_compilable(); | 1844 case ciEnv::MethodCompilable_never: |
1846 } else { | 1845 if (is_osr) |
1846 method->set_not_osr_compilable_quietly(); | |
1847 else | |
1847 method->set_not_compilable_quietly(); | 1848 method->set_not_compilable_quietly(); |
1848 } | 1849 break; |
1849 } else if (compilable == ciEnv::MethodCompilable_not_at_tier) { | 1850 case ciEnv::MethodCompilable_not_at_tier: |
1850 method->set_not_compilable_quietly(task->comp_level()); | 1851 if (is_osr) |
1852 method->set_not_osr_compilable_quietly(task->comp_level()); | |
1853 else | |
1854 method->set_not_compilable_quietly(task->comp_level()); | |
1855 break; | |
1851 } | 1856 } |
1852 | 1857 |
1853 // Note that the queued_for_compilation bits are cleared without | 1858 // Note that the queued_for_compilation bits are cleared without |
1854 // protection of a mutex. [They were set by the requester thread, | 1859 // protection of a mutex. [They were set by the requester thread, |
1855 // when adding the task to the complie queue -- at which time the | 1860 // when adding the task to the complie queue -- at which time the |