< prev index next >

src/share/vm/runtime/sweeper.cpp

Print this page
rev 13180 : imported patch 8181917-refactor-ul-logstream


  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 "code/codeCache.hpp"
  27 #include "code/compiledIC.hpp"
  28 #include "code/icBuffer.hpp"
  29 #include "code/nmethod.hpp"
  30 #include "compiler/compileBroker.hpp"


  31 #include "memory/resourceArea.hpp"
  32 #include "oops/method.hpp"
  33 #include "runtime/atomic.hpp"
  34 #include "runtime/compilationPolicy.hpp"
  35 #include "runtime/mutexLocker.hpp"
  36 #include "runtime/orderAccess.inline.hpp"
  37 #include "runtime/os.hpp"
  38 #include "runtime/sweeper.hpp"
  39 #include "runtime/thread.inline.hpp"
  40 #include "runtime/vm_operations.hpp"
  41 #include "trace/tracing.hpp"
  42 #include "utilities/events.hpp"
  43 #include "utilities/ticks.inline.hpp"
  44 #include "utilities/xmlstream.hpp"
  45 
  46 #ifdef ASSERT
  47 
  48 #define SWEEP(nm) record_sweep(nm, __LINE__)
  49 // Sweeper logging code
  50 class SweeperRecord {


 487   }
 488   EventSweepCodeCache event(UNTIMED);
 489   if (event.should_commit()) {
 490     event.set_starttime(sweep_start_counter);
 491     event.set_endtime(sweep_end_counter);
 492     event.set_sweepId(_traversals);
 493     event.set_sweptCount(swept_count);
 494     event.set_flushedCount(flushed_count);
 495     event.set_zombifiedCount(zombified_count);
 496     event.commit();
 497   }
 498 
 499 #ifdef ASSERT
 500   if(PrintMethodFlushing) {
 501     tty->print_cr("### sweeper:      sweep time(" JLONG_FORMAT "): ", sweep_time.value());
 502   }
 503 #endif
 504 
 505   Log(codecache, sweep) log;
 506   if (log.is_debug()) {
 507     CodeCache::print_summary(log.debug_stream(), false);

 508   }
 509   log_sweep("finished");
 510 
 511   // Sweeper is the only case where memory is released, check here if it
 512   // is time to restart the compiler. Only checking if there is a certain
 513   // amount of free memory in the code cache might lead to re-enabling
 514   // compilation although no memory has been released. For example, there are
 515   // cases when compilation was disabled although there is 4MB (or more) free
 516   // memory in the code cache. The reason is code cache fragmentation. Therefore,
 517   // it only makes sense to re-enable compilation if we have actually freed memory.
 518   // Note that typically several kB are released for sweeping 16MB of the code
 519   // cache. As a result, 'freed_memory' > 0 to restart the compiler.
 520   if (!CompileBroker::should_compile_new_jobs() && (freed_memory > 0)) {
 521     CompileBroker::set_should_compile_new_jobs(CompileBroker::run_compilation);
 522     log.debug("restart compiler");
 523     log_sweep("restart_compiler");
 524   }
 525 }
 526 
 527 /**




  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 "code/codeCache.hpp"
  27 #include "code/compiledIC.hpp"
  28 #include "code/icBuffer.hpp"
  29 #include "code/nmethod.hpp"
  30 #include "compiler/compileBroker.hpp"
  31 #include "logging/log.hpp"
  32 #include "logging/logStream.hpp"
  33 #include "memory/resourceArea.hpp"
  34 #include "oops/method.hpp"
  35 #include "runtime/atomic.hpp"
  36 #include "runtime/compilationPolicy.hpp"
  37 #include "runtime/mutexLocker.hpp"
  38 #include "runtime/orderAccess.inline.hpp"
  39 #include "runtime/os.hpp"
  40 #include "runtime/sweeper.hpp"
  41 #include "runtime/thread.inline.hpp"
  42 #include "runtime/vm_operations.hpp"
  43 #include "trace/tracing.hpp"
  44 #include "utilities/events.hpp"
  45 #include "utilities/ticks.inline.hpp"
  46 #include "utilities/xmlstream.hpp"
  47 
  48 #ifdef ASSERT
  49 
  50 #define SWEEP(nm) record_sweep(nm, __LINE__)
  51 // Sweeper logging code
  52 class SweeperRecord {


 489   }
 490   EventSweepCodeCache event(UNTIMED);
 491   if (event.should_commit()) {
 492     event.set_starttime(sweep_start_counter);
 493     event.set_endtime(sweep_end_counter);
 494     event.set_sweepId(_traversals);
 495     event.set_sweptCount(swept_count);
 496     event.set_flushedCount(flushed_count);
 497     event.set_zombifiedCount(zombified_count);
 498     event.commit();
 499   }
 500 
 501 #ifdef ASSERT
 502   if(PrintMethodFlushing) {
 503     tty->print_cr("### sweeper:      sweep time(" JLONG_FORMAT "): ", sweep_time.value());
 504   }
 505 #endif
 506 
 507   Log(codecache, sweep) log;
 508   if (log.is_debug()) {
 509     LogStream ls(log.debug());
 510     CodeCache::print_summary(&ls, false);
 511   }
 512   log_sweep("finished");
 513 
 514   // Sweeper is the only case where memory is released, check here if it
 515   // is time to restart the compiler. Only checking if there is a certain
 516   // amount of free memory in the code cache might lead to re-enabling
 517   // compilation although no memory has been released. For example, there are
 518   // cases when compilation was disabled although there is 4MB (or more) free
 519   // memory in the code cache. The reason is code cache fragmentation. Therefore,
 520   // it only makes sense to re-enable compilation if we have actually freed memory.
 521   // Note that typically several kB are released for sweeping 16MB of the code
 522   // cache. As a result, 'freed_memory' > 0 to restart the compiler.
 523   if (!CompileBroker::should_compile_new_jobs() && (freed_memory > 0)) {
 524     CompileBroker::set_should_compile_new_jobs(CompileBroker::run_compilation);
 525     log.debug("restart compiler");
 526     log_sweep("restart_compiler");
 527   }
 528 }
 529 
 530 /**


< prev index next >