1287 collect_monitors(cvf, objects_to_revoke);
1288 cvf = compiledVFrame::cast(cvf->sender());
1289 }
1290 collect_monitors(cvf, objects_to_revoke);
1291
1292 if (SafepointSynchronize::is_at_safepoint()) {
1293 BiasedLocking::revoke_at_safepoint(objects_to_revoke);
1294 } else {
1295 BiasedLocking::revoke(objects_to_revoke);
1296 }
1297 }
1298
1299
1300 void Deoptimization::revoke_biases_of_monitors(CodeBlob* cb) {
1301 if (!UseBiasedLocking) {
1302 return;
1303 }
1304
1305 assert(SafepointSynchronize::is_at_safepoint(), "must only be called from safepoint");
1306 GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
1307 {
1308 ThreadsListHandle tlh;
1309 JavaThreadIterator jti(tlh.list());
1310 for (JavaThread* jt = jti.first(); jt != NULL; jt = jti.next()) {
1311 if (jt->has_last_Java_frame()) {
1312 StackFrameStream sfs(jt, true);
1313 while (!sfs.is_done()) {
1314 frame* cur = sfs.current();
1315 if (cb->contains(cur->pc())) {
1316 vframe* vf = vframe::new_vframe(cur, sfs.register_map(), jt);
1317 compiledVFrame* cvf = compiledVFrame::cast(vf);
1318 // Revoke monitors' biases in all scopes
1319 while (!cvf->is_top()) {
1320 collect_monitors(cvf, objects_to_revoke);
1321 cvf = compiledVFrame::cast(cvf->sender());
1322 }
1323 collect_monitors(cvf, objects_to_revoke);
1324 }
1325 sfs.next();
1326 }
1327 }
1328 }
1329 }
1330 BiasedLocking::revoke_at_safepoint(objects_to_revoke);
1331 }
1332
1333
1334 void Deoptimization::deoptimize_single_frame(JavaThread* thread, frame fr, Deoptimization::DeoptReason reason) {
1335 assert(fr.can_be_deoptimized(), "checking frame type");
1336
1337 gather_statistics(reason, Action_none, Bytecodes::_illegal);
1338
1339 if (LogCompilation && xtty != NULL) {
1340 CompiledMethod* cm = fr.cb()->as_compiled_method_or_null();
1341 assert(cm != NULL, "only compiled methods can deopt");
1342
1343 ttyLocker ttyl;
1344 xtty->begin_head("deoptimized thread='" UINTX_FORMAT "' reason='%s' pc='" INTPTR_FORMAT "'",(uintx)thread->osthread()->thread_id(), trap_reason_name(reason), p2i(fr.pc()));
1345 cm->log_identity(xtty);
1346 xtty->end_head();
1347 for (ScopeDesc* sd = cm->scope_desc_at(fr.pc()); ; sd = sd->sender()) {
1348 xtty->begin_elem("jvms bci='%d'", sd->bci());
|
1287 collect_monitors(cvf, objects_to_revoke);
1288 cvf = compiledVFrame::cast(cvf->sender());
1289 }
1290 collect_monitors(cvf, objects_to_revoke);
1291
1292 if (SafepointSynchronize::is_at_safepoint()) {
1293 BiasedLocking::revoke_at_safepoint(objects_to_revoke);
1294 } else {
1295 BiasedLocking::revoke(objects_to_revoke);
1296 }
1297 }
1298
1299
1300 void Deoptimization::revoke_biases_of_monitors(CodeBlob* cb) {
1301 if (!UseBiasedLocking) {
1302 return;
1303 }
1304
1305 assert(SafepointSynchronize::is_at_safepoint(), "must only be called from safepoint");
1306 GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
1307 for (JavaThreadIteratorWithHandle jtiwh; JavaThread *jt = jtiwh.next(); ) {
1308 if (jt->has_last_Java_frame()) {
1309 StackFrameStream sfs(jt, true);
1310 while (!sfs.is_done()) {
1311 frame* cur = sfs.current();
1312 if (cb->contains(cur->pc())) {
1313 vframe* vf = vframe::new_vframe(cur, sfs.register_map(), jt);
1314 compiledVFrame* cvf = compiledVFrame::cast(vf);
1315 // Revoke monitors' biases in all scopes
1316 while (!cvf->is_top()) {
1317 collect_monitors(cvf, objects_to_revoke);
1318 cvf = compiledVFrame::cast(cvf->sender());
1319 }
1320 collect_monitors(cvf, objects_to_revoke);
1321 }
1322 sfs.next();
1323 }
1324 }
1325 }
1326 BiasedLocking::revoke_at_safepoint(objects_to_revoke);
1327 }
1328
1329
1330 void Deoptimization::deoptimize_single_frame(JavaThread* thread, frame fr, Deoptimization::DeoptReason reason) {
1331 assert(fr.can_be_deoptimized(), "checking frame type");
1332
1333 gather_statistics(reason, Action_none, Bytecodes::_illegal);
1334
1335 if (LogCompilation && xtty != NULL) {
1336 CompiledMethod* cm = fr.cb()->as_compiled_method_or_null();
1337 assert(cm != NULL, "only compiled methods can deopt");
1338
1339 ttyLocker ttyl;
1340 xtty->begin_head("deoptimized thread='" UINTX_FORMAT "' reason='%s' pc='" INTPTR_FORMAT "'",(uintx)thread->osthread()->thread_id(), trap_reason_name(reason), p2i(fr.pc()));
1341 cm->log_identity(xtty);
1342 xtty->end_head();
1343 for (ScopeDesc* sd = cm->scope_desc_at(fr.pc()); ; sd = sd->sender()) {
1344 xtty->begin_elem("jvms bci='%d'", sd->bci());
|