< prev index next >

src/hotspot/share/runtime/biasedLocking.cpp

Print this page
rev 49250 : [mq]: JDK-8199781.patch


 236   }
 237 
 238   // Log at "info" level if not bulk, else "trace" level
 239   if (!is_bulk) {
 240     log_info(biasedlocking)("  Revoked bias of object biased toward live thread ("
 241                             PTR_FORMAT ")", p2i(biased_thread));
 242   } else {
 243     log_trace(biasedlocking)("  Revoked bias of object biased toward live thread ("
 244                                PTR_FORMAT ")", p2i(biased_thread));
 245   }
 246 
 247   // Thread owning bias is alive.
 248   // Check to see whether it currently owns the lock and, if so,
 249   // write down the needed displaced headers to the thread's stack.
 250   // Otherwise, restore the object's header either to the unlocked
 251   // or unbiased state.
 252   GrowableArray<MonitorInfo*>* cached_monitor_info = get_or_compute_monitor_info(biased_thread);
 253   BasicLock* highest_lock = NULL;
 254   for (int i = 0; i < cached_monitor_info->length(); i++) {
 255     MonitorInfo* mon_info = cached_monitor_info->at(i);
 256     if (mon_info->owner() == obj) {
 257       log_trace(biasedlocking)("   mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")",
 258                                p2i((void *) mon_info->owner()),
 259                                p2i((void *) obj));
 260       // Assume recursive case and fix up highest lock later
 261       markOop mark = markOopDesc::encode((BasicLock*) NULL);
 262       highest_lock = mon_info->lock();
 263       highest_lock->set_displaced_header(mark);
 264     } else {
 265       log_trace(biasedlocking)("   mon_info->owner (" PTR_FORMAT ") != obj (" PTR_FORMAT ")",
 266                                p2i((void *) mon_info->owner()),
 267                                p2i((void *) obj));
 268     }
 269   }
 270   if (highest_lock != NULL) {
 271     // Fix up highest lock to contain displaced header and point
 272     // object at it
 273     highest_lock->set_displaced_header(unbiased_prototype);
 274     // Reset object header to point to displaced mark.
 275     // Must release storing the lock address for platforms without TSO
 276     // ordering (e.g. ppc).




 236   }
 237 
 238   // Log at "info" level if not bulk, else "trace" level
 239   if (!is_bulk) {
 240     log_info(biasedlocking)("  Revoked bias of object biased toward live thread ("
 241                             PTR_FORMAT ")", p2i(biased_thread));
 242   } else {
 243     log_trace(biasedlocking)("  Revoked bias of object biased toward live thread ("
 244                                PTR_FORMAT ")", p2i(biased_thread));
 245   }
 246 
 247   // Thread owning bias is alive.
 248   // Check to see whether it currently owns the lock and, if so,
 249   // write down the needed displaced headers to the thread's stack.
 250   // Otherwise, restore the object's header either to the unlocked
 251   // or unbiased state.
 252   GrowableArray<MonitorInfo*>* cached_monitor_info = get_or_compute_monitor_info(biased_thread);
 253   BasicLock* highest_lock = NULL;
 254   for (int i = 0; i < cached_monitor_info->length(); i++) {
 255     MonitorInfo* mon_info = cached_monitor_info->at(i);
 256     if (oopDesc::equals(mon_info->owner(), obj)) {
 257       log_trace(biasedlocking)("   mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")",
 258                                p2i((void *) mon_info->owner()),
 259                                p2i((void *) obj));
 260       // Assume recursive case and fix up highest lock later
 261       markOop mark = markOopDesc::encode((BasicLock*) NULL);
 262       highest_lock = mon_info->lock();
 263       highest_lock->set_displaced_header(mark);
 264     } else {
 265       log_trace(biasedlocking)("   mon_info->owner (" PTR_FORMAT ") != obj (" PTR_FORMAT ")",
 266                                p2i((void *) mon_info->owner()),
 267                                p2i((void *) obj));
 268     }
 269   }
 270   if (highest_lock != NULL) {
 271     // Fix up highest lock to contain displaced header and point
 272     // object at it
 273     highest_lock->set_displaced_header(unbiased_prototype);
 274     // Reset object header to point to displaced mark.
 275     // Must release storing the lock address for platforms without TSO
 276     // ordering (e.g. ppc).


< prev index next >