comparison src/share/vm/opto/runtime.cpp @ 17780:606acabe7b5c

8031320: Use Intel RTM instructions for locks Summary: Use RTM for inflated locks and stack locks. Reviewed-by: iveresov, twisti, roland, dcubed
author kvn
date Thu, 20 Mar 2014 17:49:27 -0700
parents 04d32e7fad07
children 62c54fcc0a35
comparison
equal deleted inserted replaced
17778:a48e16541e6b 17780:606acabe7b5c
1297 BiasedLockingCounters* blc = ((BiasedLockingNamedCounter*)c)->counters(); 1297 BiasedLockingCounters* blc = ((BiasedLockingNamedCounter*)c)->counters();
1298 if (blc->nonzero()) { 1298 if (blc->nonzero()) {
1299 tty->print_cr("%s", c->name()); 1299 tty->print_cr("%s", c->name());
1300 blc->print_on(tty); 1300 blc->print_on(tty);
1301 } 1301 }
1302 #if INCLUDE_RTM_OPT
1303 } else if (c->tag() == NamedCounter::RTMLockingCounter) {
1304 RTMLockingCounters* rlc = ((RTMLockingNamedCounter*)c)->counters();
1305 if (rlc->nonzero()) {
1306 tty->print_cr("%s", c->name());
1307 rlc->print_on(tty);
1308 }
1309 #endif
1302 } 1310 }
1303 c = c->next(); 1311 c = c->next();
1304 } 1312 }
1305 if (total_lock_count > 0) { 1313 if (total_lock_count > 0) {
1306 tty->print_cr("dynamic locks: %d", total_lock_count); 1314 tty->print_cr("dynamic locks: %d", total_lock_count);
1336 // To print linenumbers instead of bci use: m->line_number_from_bci(bci) 1344 // To print linenumbers instead of bci use: m->line_number_from_bci(bci)
1337 } 1345 }
1338 NamedCounter* c; 1346 NamedCounter* c;
1339 if (tag == NamedCounter::BiasedLockingCounter) { 1347 if (tag == NamedCounter::BiasedLockingCounter) {
1340 c = new BiasedLockingNamedCounter(strdup(st.as_string())); 1348 c = new BiasedLockingNamedCounter(strdup(st.as_string()));
1349 } else if (tag == NamedCounter::RTMLockingCounter) {
1350 c = new RTMLockingNamedCounter(strdup(st.as_string()));
1341 } else { 1351 } else {
1342 c = new NamedCounter(strdup(st.as_string()), tag); 1352 c = new NamedCounter(strdup(st.as_string()), tag);
1343 } 1353 }
1344 1354
1345 // atomically add the new counter to the head of the list. We only 1355 // atomically add the new counter to the head of the list. We only
1346 // add counters so this is safe. 1356 // add counters so this is safe.
1347 NamedCounter* head; 1357 NamedCounter* head;
1348 do { 1358 do {
1359 c->set_next(NULL);
1349 head = _named_counters; 1360 head = _named_counters;
1350 c->set_next(head); 1361 c->set_next(head);
1351 } while (Atomic::cmpxchg_ptr(c, &_named_counters, head) != head); 1362 } while (Atomic::cmpxchg_ptr(c, &_named_counters, head) != head);
1352 return c; 1363 return c;
1353 } 1364 }