Mercurial > hg > truffle
comparison src/share/vm/runtime/safepoint.cpp @ 1783:d5d065957597
6953144: Tiered compilation
Summary: Infrastructure for tiered compilation support (interpreter + c1 + c2) for 32 and 64 bit. Simple tiered policy implementation.
Reviewed-by: kvn, never, phh, twisti
author | iveresov |
---|---|
date | Fri, 03 Sep 2010 17:51:07 -0700 |
parents | da877bdc9000 |
children | ce6848d0666d |
comparison
equal
deleted
inserted
replaced
1782:f353275af40e | 1783:d5d065957597 |
---|---|
428 // Need a safepoint if some inline cache buffers is non-empty | 428 // Need a safepoint if some inline cache buffers is non-empty |
429 if (!InlineCacheBuffer::is_empty()) return true; | 429 if (!InlineCacheBuffer::is_empty()) return true; |
430 return false; | 430 return false; |
431 } | 431 } |
432 | 432 |
433 jlong CounterDecay::_last_timestamp = 0; | 433 |
434 | |
435 static void do_method(methodOop m) { | |
436 m->invocation_counter()->decay(); | |
437 } | |
438 | |
439 void CounterDecay::decay() { | |
440 _last_timestamp = os::javaTimeMillis(); | |
441 | |
442 // This operation is going to be performed only at the end of a safepoint | |
443 // and hence GC's will not be going on, all Java mutators are suspended | |
444 // at this point and hence SystemDictionary_lock is also not needed. | |
445 assert(SafepointSynchronize::is_at_safepoint(), "can only be executed at a safepoint"); | |
446 int nclasses = SystemDictionary::number_of_classes(); | |
447 double classes_per_tick = nclasses * (CounterDecayMinIntervalLength * 1e-3 / | |
448 CounterHalfLifeTime); | |
449 for (int i = 0; i < classes_per_tick; i++) { | |
450 klassOop k = SystemDictionary::try_get_next_class(); | |
451 if (k != NULL && k->klass_part()->oop_is_instance()) { | |
452 instanceKlass::cast(k)->methods_do(do_method); | |
453 } | |
454 } | |
455 } | |
456 | 434 |
457 // Various cleaning tasks that should be done periodically at safepoints | 435 // Various cleaning tasks that should be done periodically at safepoints |
458 void SafepointSynchronize::do_cleanup_tasks() { | 436 void SafepointSynchronize::do_cleanup_tasks() { |
459 { | 437 { |
460 TraceTime t1("deflating idle monitors", TraceSafepointCleanupTime); | 438 TraceTime t1("deflating idle monitors", TraceSafepointCleanupTime); |
463 | 441 |
464 { | 442 { |
465 TraceTime t2("updating inline caches", TraceSafepointCleanupTime); | 443 TraceTime t2("updating inline caches", TraceSafepointCleanupTime); |
466 InlineCacheBuffer::update_inline_caches(); | 444 InlineCacheBuffer::update_inline_caches(); |
467 } | 445 } |
468 | 446 { |
469 if(UseCounterDecay && CounterDecay::is_decay_needed()) { | 447 TraceTime t3("compilation policy safepoint handler", TraceSafepointCleanupTime); |
470 TraceTime t3("decaying counter", TraceSafepointCleanupTime); | 448 CompilationPolicy::policy()->do_safepoint_work(); |
471 CounterDecay::decay(); | |
472 } | 449 } |
473 | 450 |
474 TraceTime t4("sweeping nmethods", TraceSafepointCleanupTime); | 451 TraceTime t4("sweeping nmethods", TraceSafepointCleanupTime); |
475 NMethodSweeper::scan_stacks(); | 452 NMethodSweeper::scan_stacks(); |
476 } | 453 } |