Sun, 02 Nov 2014 18:42:30 +0300
8036913: make DeoptimizeALot dependent on number of threads
Reviewed-by: kvn, shade
src/share/vm/runtime/interfaceSupport.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/runtime/interfaceSupport.cpp Tue Mar 10 21:20:10 2015 -0400 1.2 +++ b/src/share/vm/runtime/interfaceSupport.cpp Sun Nov 02 18:42:30 2014 +0300 1.3 @@ -185,19 +185,22 @@ 1.4 1.5 # endif 1.6 1.7 - 1.8 +// invocation counter for InterfaceSupport::deoptimizeAll/zombieAll functions 1.9 int deoptimizeAllCounter = 0; 1.10 int zombieAllCounter = 0; 1.11 1.12 - 1.13 void InterfaceSupport::zombieAll() { 1.14 - if (is_init_completed() && zombieAllCounter > ZombieALotInterval) { 1.15 + // This method is called by all threads when a thread make 1.16 + // transition to VM state (for example, runtime calls). 1.17 + // Divide number of calls by number of threads to avoid 1.18 + // dependence of ZombieAll events frequency on number of threads. 1.19 + int value = zombieAllCounter / Threads::number_of_threads(); 1.20 + if (is_init_completed() && value > ZombieALotInterval) { 1.21 zombieAllCounter = 0; 1.22 VM_ZombieAll op; 1.23 VMThread::execute(&op); 1.24 - } else { 1.25 - zombieAllCounter++; 1.26 } 1.27 + zombieAllCounter++; 1.28 } 1.29 1.30 void InterfaceSupport::unlinkSymbols() { 1.31 @@ -206,12 +209,17 @@ 1.32 } 1.33 1.34 void InterfaceSupport::deoptimizeAll() { 1.35 - if (is_init_completed() ) { 1.36 - if (DeoptimizeALot && deoptimizeAllCounter > DeoptimizeALotInterval) { 1.37 + // This method is called by all threads when a thread make 1.38 + // transition to VM state (for example, runtime calls). 1.39 + // Divide number of calls by number of threads to avoid 1.40 + // dependence of DeoptimizeAll events frequency on number of threads. 1.41 + int value = deoptimizeAllCounter / Threads::number_of_threads(); 1.42 + if (is_init_completed()) { 1.43 + if (DeoptimizeALot && value > DeoptimizeALotInterval) { 1.44 deoptimizeAllCounter = 0; 1.45 VM_DeoptimizeAll op; 1.46 VMThread::execute(&op); 1.47 - } else if (DeoptimizeRandom && (deoptimizeAllCounter & 0x1f) == (os::random() & 0x1f)) { 1.48 + } else if (DeoptimizeRandom && (value & 0x1F) == (os::random() & 0x1F)) { 1.49 VM_DeoptimizeAll op; 1.50 VMThread::execute(&op); 1.51 }