183 ++zap_traversals; |
183 ++zap_traversals; |
184 } |
184 } |
185 |
185 |
186 # endif |
186 # endif |
187 |
187 |
188 |
188 // invocation counter for InterfaceSupport::deoptimizeAll/zombieAll functions |
189 int deoptimizeAllCounter = 0; |
189 int deoptimizeAllCounter = 0; |
190 int zombieAllCounter = 0; |
190 int zombieAllCounter = 0; |
191 |
191 |
192 |
|
193 void InterfaceSupport::zombieAll() { |
192 void InterfaceSupport::zombieAll() { |
194 if (is_init_completed() && zombieAllCounter > ZombieALotInterval) { |
193 // This method is called by all threads when a thread make |
|
194 // transition to VM state (for example, runtime calls). |
|
195 // Divide number of calls by number of threads to avoid |
|
196 // dependence of ZombieAll events frequency on number of threads. |
|
197 int value = zombieAllCounter / Threads::number_of_threads(); |
|
198 if (is_init_completed() && value > ZombieALotInterval) { |
195 zombieAllCounter = 0; |
199 zombieAllCounter = 0; |
196 VM_ZombieAll op; |
200 VM_ZombieAll op; |
197 VMThread::execute(&op); |
201 VMThread::execute(&op); |
198 } else { |
202 } |
199 zombieAllCounter++; |
203 zombieAllCounter++; |
200 } |
|
201 } |
204 } |
202 |
205 |
203 void InterfaceSupport::unlinkSymbols() { |
206 void InterfaceSupport::unlinkSymbols() { |
204 VM_UnlinkSymbols op; |
207 VM_UnlinkSymbols op; |
205 VMThread::execute(&op); |
208 VMThread::execute(&op); |
206 } |
209 } |
207 |
210 |
208 void InterfaceSupport::deoptimizeAll() { |
211 void InterfaceSupport::deoptimizeAll() { |
209 if (is_init_completed() ) { |
212 // This method is called by all threads when a thread make |
210 if (DeoptimizeALot && deoptimizeAllCounter > DeoptimizeALotInterval) { |
213 // transition to VM state (for example, runtime calls). |
|
214 // Divide number of calls by number of threads to avoid |
|
215 // dependence of DeoptimizeAll events frequency on number of threads. |
|
216 int value = deoptimizeAllCounter / Threads::number_of_threads(); |
|
217 if (is_init_completed()) { |
|
218 if (DeoptimizeALot && value > DeoptimizeALotInterval) { |
211 deoptimizeAllCounter = 0; |
219 deoptimizeAllCounter = 0; |
212 VM_DeoptimizeAll op; |
220 VM_DeoptimizeAll op; |
213 VMThread::execute(&op); |
221 VMThread::execute(&op); |
214 } else if (DeoptimizeRandom && (deoptimizeAllCounter & 0x1f) == (os::random() & 0x1f)) { |
222 } else if (DeoptimizeRandom && (value & 0x1F) == (os::random() & 0x1F)) { |
215 VM_DeoptimizeAll op; |
223 VM_DeoptimizeAll op; |
216 VMThread::execute(&op); |
224 VMThread::execute(&op); |
217 } |
225 } |
218 } |
226 } |
219 deoptimizeAllCounter++; |
227 deoptimizeAllCounter++; |