hotspot/src/share/vm/runtime/vm_operations.cpp
void VM_DeoptimizeAll::doit() {
DeoptimizationMarker dm;
// deoptimize all java threads in the system
if (DeoptimizeALot) {
for (JavaThread* thread = Threads::first(); thread != NULL; thread = thread->next()) {
if (thread->has_last_Java_frame()) {
thread->deoptimize();
}
}
} else if (DeoptimizeRandom) {
// Deoptimize some selected threads and frames
int tnum = os::random() & 0x3;
int fnum = os::random() & 0x3;
int tcount = 0;
for (JavaThread* thread = Threads::first(); thread != NULL; thread = thread->next()) {
if (thread->has_last_Java_frame()) {
if (tcount++ == tnum) {
tcount = 0;
int fcount = 0;
// Deoptimize some selected frames.
// Biased llocking wants a updated register map
for(StackFrameStream fst(thread, UseBiasedLocking); !fst.is_done(); fst.next()) {
if (fst.current()->can_be_deoptimized()) {
if (fcount++ == fnum) {
fcount = 0;
Deoptimization::deoptimize(thread, *fst.current(), fst.register_map());
}
}
}
}
}
}
}
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.