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

src/share/vm/compiler/compileLog.cpp

Print this page




  39   : _context(_context_buffer, sizeof(_context_buffer))
  40 {
  41   initialize(new(ResourceObj::C_HEAP, mtCompiler) fileStream(fp, true));
  42   _file_end = 0;
  43   _thread_id = thread_id;
  44 
  45   _identities_limit = 0;
  46   _identities_capacity = 400;
  47   _identities = NEW_C_HEAP_ARRAY(char, _identities_capacity, mtCompiler);
  48   _file = NEW_C_HEAP_ARRAY(char, strlen(file_name)+1, mtCompiler);
  49    strcpy((char*)_file, file_name);
  50 
  51   // link into the global list
  52   { MutexLocker locker(CompileTaskAlloc_lock);
  53     _next = _first;
  54     _first = this;
  55   }
  56 }
  57 
  58 CompileLog::~CompileLog() {
  59   delete _out;
  60   _out = NULL;


  61   FREE_C_HEAP_ARRAY(char, _identities, mtCompiler);
  62   FREE_C_HEAP_ARRAY(char, _file, mtCompiler);
  63 }
  64 
  65 
  66 // see_tag, pop_tag:  Override the default do-nothing methods on xmlStream.
  67 // These methods provide a hook for managing the the extra context markup.
  68 void CompileLog::see_tag(const char* tag, bool push) {
  69   if (_context.size() > 0 && _out != NULL) {
  70     _out->write(_context.base(), _context.size());
  71     _context.reset();
  72   }
  73   xmlStream::see_tag(tag, push);
  74 }
  75 void CompileLog::pop_tag(const char* tag) {
  76   _context.reset();  // toss any context info.
  77   xmlStream::pop_tag(tag);
  78 }
  79 
  80 


 261             // However, this code has been tested by introducing
 262             // CDATA sequences into the compilation log.
 263             break;
 264           }
 265           // Now nw is the number of characters to write, usually == nr.
 266           file->write(bufp, nw);
 267           if (nw < nr) {
 268             // We are about to go around the loop again.
 269             // But first, disrupt the ]]> by closing and reopening the quote.
 270             file->print_raw("]]><![CDATA[");
 271             end_cdata = 0;  // reset state machine
 272           }
 273         }
 274       }
 275       if (saw_slop) {
 276         file->print_raw_cr("]]>");
 277         file->print_raw_cr("</fragment>");
 278       }
 279       file->print_raw_cr("</compilation_log>");
 280       close(partial_fd);
 281       unlink(partial_file);
 282     }
 283     CompileLog* next_log = log->_next;
 284     delete log;
 285     log = next_log;
 286   }
 287   _first = NULL;
 288 }
 289 
 290 // ------------------------------------------------------------------
 291 // CompileLog::finish_log
 292 //
 293 // Called during normal shutdown. For now, any clean-up needed in normal
 294 // shutdown is also needed in VM abort, so is covered by finish_log_on_error().
 295 // Just allocate a buffer and call finish_log_on_error().
 296 void CompileLog::finish_log(outputStream* file) {
 297   char buf[4 * K];
 298   finish_log_on_error(file, buf, sizeof(buf));
 299 }
 300 
 301 // ------------------------------------------------------------------
 302 // CompileLog::inline_success
 303 //
 304 // Print about successful method inlining.




  39   : _context(_context_buffer, sizeof(_context_buffer))
  40 {
  41   initialize(new(ResourceObj::C_HEAP, mtCompiler) fileStream(fp, true));
  42   _file_end = 0;
  43   _thread_id = thread_id;
  44 
  45   _identities_limit = 0;
  46   _identities_capacity = 400;
  47   _identities = NEW_C_HEAP_ARRAY(char, _identities_capacity, mtCompiler);
  48   _file = NEW_C_HEAP_ARRAY(char, strlen(file_name)+1, mtCompiler);
  49    strcpy((char*)_file, file_name);
  50 
  51   // link into the global list
  52   { MutexLocker locker(CompileTaskAlloc_lock);
  53     _next = _first;
  54     _first = this;
  55   }
  56 }
  57 
  58 CompileLog::~CompileLog() {
  59   delete _out; // Close fd in fileStream::~fileStream()
  60   _out = NULL;
  61   // Remove partial file after merging in CompileLog::finish_log_on_error
  62   unlink(_file);
  63   FREE_C_HEAP_ARRAY(char, _identities, mtCompiler);
  64   FREE_C_HEAP_ARRAY(char, _file, mtCompiler);
  65 }
  66 
  67 
  68 // see_tag, pop_tag:  Override the default do-nothing methods on xmlStream.
  69 // These methods provide a hook for managing the the extra context markup.
  70 void CompileLog::see_tag(const char* tag, bool push) {
  71   if (_context.size() > 0 && _out != NULL) {
  72     _out->write(_context.base(), _context.size());
  73     _context.reset();
  74   }
  75   xmlStream::see_tag(tag, push);
  76 }
  77 void CompileLog::pop_tag(const char* tag) {
  78   _context.reset();  // toss any context info.
  79   xmlStream::pop_tag(tag);
  80 }
  81 
  82 


 263             // However, this code has been tested by introducing
 264             // CDATA sequences into the compilation log.
 265             break;
 266           }
 267           // Now nw is the number of characters to write, usually == nr.
 268           file->write(bufp, nw);
 269           if (nw < nr) {
 270             // We are about to go around the loop again.
 271             // But first, disrupt the ]]> by closing and reopening the quote.
 272             file->print_raw("]]><![CDATA[");
 273             end_cdata = 0;  // reset state machine
 274           }
 275         }
 276       }
 277       if (saw_slop) {
 278         file->print_raw_cr("]]>");
 279         file->print_raw_cr("</fragment>");
 280       }
 281       file->print_raw_cr("</compilation_log>");
 282       close(partial_fd);

 283     }
 284     CompileLog* next_log = log->_next;
 285     delete log; // Removes partial file
 286     log = next_log;
 287   }
 288   _first = NULL;
 289 }
 290 
 291 // ------------------------------------------------------------------
 292 // CompileLog::finish_log
 293 //
 294 // Called during normal shutdown. For now, any clean-up needed in normal
 295 // shutdown is also needed in VM abort, so is covered by finish_log_on_error().
 296 // Just allocate a buffer and call finish_log_on_error().
 297 void CompileLog::finish_log(outputStream* file) {
 298   char buf[4 * K];
 299   finish_log_on_error(file, buf, sizeof(buf));
 300 }
 301 
 302 // ------------------------------------------------------------------
 303 // CompileLog::inline_success
 304 //
 305 // Print about successful method inlining.


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