src/share/vm/compiler/compileTask.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/compiler

src/share/vm/compiler/compileTask.cpp

Print this page
rev 9003 : 8137167: JEP165: Compiler Control: Implementation task
Summary:
Reviewed-by:


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "compiler/compileTask.hpp"
  27 #include "compiler/compileLog.hpp"
  28 #include "compiler/compileBroker.hpp"

  29 
  30 CompileTask*  CompileTask::_task_free_list = NULL;
  31 #ifdef ASSERT
  32 int CompileTask::_num_allocated_tasks = 0;
  33 #endif
  34 
  35 /**
  36  * Allocate a CompileTask, from the free list if possible.
  37  */
  38 CompileTask* CompileTask::allocate() {
  39   MutexLocker locker(CompileTaskAlloc_lock);
  40   CompileTask* task = NULL;
  41 
  42   if (_task_free_list != NULL) {
  43     task = _task_free_list;
  44     _task_free_list = task->next();
  45     task->set_next(NULL);
  46   } else {
  47     task = new CompileTask();
  48     DEBUG_ONLY(_num_allocated_tasks++;)


 329 
 330   // <task_done ... stamp='1.234'>  </task>
 331   nmethod* nm = code();
 332   log->begin_elem("task_done success='%d' nmsize='%d' count='%d'",
 333                   _is_success, nm == NULL ? 0 : nm->content_size(),
 334                   method->invocation_count());
 335   int bec = method->backedge_count();
 336   if (bec != 0)  log->print(" backedge_count='%d'", bec);
 337   // Note:  "_is_complete" is about to be set, but is not.
 338   if (_num_inlined_bytecodes != 0) {
 339     log->print(" inlined_bytes='%d'", _num_inlined_bytecodes);
 340   }
 341   log->stamp();
 342   log->end_elem();
 343   log->clear_identities();   // next task will have different CI
 344   log->tail("task");
 345   if (log->unflushed_count() > 2000) {
 346     log->flush();
 347   }
 348   log->mark_file_end();













 349 }
 350 
 351 // ------------------------------------------------------------------
 352 // CompileTask::print_inlining
 353 void CompileTask::print_inlining_inner(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg) {
 354   //         1234567
 355   st->print("        ");     // print timestamp
 356   //         1234
 357   st->print("     ");        // print compilation number
 358 
 359   // method attributes
 360   if (method->is_loaded()) {
 361     const char sync_char      = method->is_synchronized()        ? 's' : ' ';
 362     const char exception_char = method->has_exception_handlers() ? '!' : ' ';
 363     const char monitors_char  = method->has_monitor_bytecodes()  ? 'm' : ' ';
 364 
 365     // print method attributes
 366     st->print(" %c%c%c  ", sync_char, exception_char, monitors_char);
 367   } else {
 368     //         %s!bn




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "compiler/compileTask.hpp"
  27 #include "compiler/compileLog.hpp"
  28 #include "compiler/compileBroker.hpp"
  29 #include "compiler/compilerDirectives.hpp"
  30 
  31 CompileTask*  CompileTask::_task_free_list = NULL;
  32 #ifdef ASSERT
  33 int CompileTask::_num_allocated_tasks = 0;
  34 #endif
  35 
  36 /**
  37  * Allocate a CompileTask, from the free list if possible.
  38  */
  39 CompileTask* CompileTask::allocate() {
  40   MutexLocker locker(CompileTaskAlloc_lock);
  41   CompileTask* task = NULL;
  42 
  43   if (_task_free_list != NULL) {
  44     task = _task_free_list;
  45     _task_free_list = task->next();
  46     task->set_next(NULL);
  47   } else {
  48     task = new CompileTask();
  49     DEBUG_ONLY(_num_allocated_tasks++;)


 330 
 331   // <task_done ... stamp='1.234'>  </task>
 332   nmethod* nm = code();
 333   log->begin_elem("task_done success='%d' nmsize='%d' count='%d'",
 334                   _is_success, nm == NULL ? 0 : nm->content_size(),
 335                   method->invocation_count());
 336   int bec = method->backedge_count();
 337   if (bec != 0)  log->print(" backedge_count='%d'", bec);
 338   // Note:  "_is_complete" is about to be set, but is not.
 339   if (_num_inlined_bytecodes != 0) {
 340     log->print(" inlined_bytes='%d'", _num_inlined_bytecodes);
 341   }
 342   log->stamp();
 343   log->end_elem();
 344   log->clear_identities();   // next task will have different CI
 345   log->tail("task");
 346   if (log->unflushed_count() > 2000) {
 347     log->flush();
 348   }
 349   log->mark_file_end();
 350 }
 351 
 352 // ------------------------------------------------------------------
 353 // CompileTask::check_break_at_flags
 354 bool CompileTask::check_break_at_flags() {
 355   int compile_id = this->_compile_id;
 356   bool is_osr = (_osr_bci != CompileBroker::standard_entry_bci);
 357 
 358   if (CICountOSR && is_osr && (compile_id == CIBreakAtOSR)) {
 359     return true;
 360   } else {
 361     return (compile_id == CIBreakAt);
 362   }
 363 }
 364 
 365 // ------------------------------------------------------------------
 366 // CompileTask::print_inlining
 367 void CompileTask::print_inlining_inner(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg) {
 368   //         1234567
 369   st->print("        ");     // print timestamp
 370   //         1234
 371   st->print("     ");        // print compilation number
 372 
 373   // method attributes
 374   if (method->is_loaded()) {
 375     const char sync_char      = method->is_synchronized()        ? 's' : ' ';
 376     const char exception_char = method->has_exception_handlers() ? '!' : ' ';
 377     const char monitors_char  = method->has_monitor_bytecodes()  ? 'm' : ' ';
 378 
 379     // print method attributes
 380     st->print(" %c%c%c  ", sync_char, exception_char, monitors_char);
 381   } else {
 382     //         %s!bn


src/share/vm/compiler/compileTask.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File