hotspot/src/share/vm/runtime/biasedLocking.cpp
changeset 24424 2658d7834c6e
parent 22926 1a4328d3fd0e
child 25351 7c198a690050
equal deleted inserted replaced
24358:8528b67f6562 24424:2658d7834c6e
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   159   markOop unbiased_prototype = markOopDesc::prototype()->set_age(age);
   159   markOop unbiased_prototype = markOopDesc::prototype()->set_age(age);
   160 
   160 
   161   if (TraceBiasedLocking && (Verbose || !is_bulk)) {
   161   if (TraceBiasedLocking && (Verbose || !is_bulk)) {
   162     ResourceMark rm;
   162     ResourceMark rm;
   163     tty->print_cr("Revoking bias of object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s , prototype header " INTPTR_FORMAT " , allow rebias %d , requesting thread " INTPTR_FORMAT,
   163     tty->print_cr("Revoking bias of object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s , prototype header " INTPTR_FORMAT " , allow rebias %d , requesting thread " INTPTR_FORMAT,
   164                   (void *)obj, (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread);
   164                   p2i((void *)obj), (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread);
   165   }
   165   }
   166 
   166 
   167   JavaThread* biased_thread = mark->biased_locker();
   167   JavaThread* biased_thread = mark->biased_locker();
   168   if (biased_thread == NULL) {
   168   if (biased_thread == NULL) {
   169     // Object is anonymously biased. We can get here if, for
   169     // Object is anonymously biased. We can get here if, for
   212   for (int i = 0; i < cached_monitor_info->length(); i++) {
   212   for (int i = 0; i < cached_monitor_info->length(); i++) {
   213     MonitorInfo* mon_info = cached_monitor_info->at(i);
   213     MonitorInfo* mon_info = cached_monitor_info->at(i);
   214     if (mon_info->owner() == obj) {
   214     if (mon_info->owner() == obj) {
   215       if (TraceBiasedLocking && Verbose) {
   215       if (TraceBiasedLocking && Verbose) {
   216         tty->print_cr("   mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")",
   216         tty->print_cr("   mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")",
   217                       (void *) mon_info->owner(),
   217                       p2i((void *) mon_info->owner()),
   218                       (void *) obj);
   218                       p2i((void *) obj));
   219       }
   219       }
   220       // Assume recursive case and fix up highest lock later
   220       // Assume recursive case and fix up highest lock later
   221       markOop mark = markOopDesc::encode((BasicLock*) NULL);
   221       markOop mark = markOopDesc::encode((BasicLock*) NULL);
   222       highest_lock = mon_info->lock();
   222       highest_lock = mon_info->lock();
   223       highest_lock->set_displaced_header(mark);
   223       highest_lock->set_displaced_header(mark);
   224     } else {
   224     } else {
   225       if (TraceBiasedLocking && Verbose) {
   225       if (TraceBiasedLocking && Verbose) {
   226         tty->print_cr("   mon_info->owner (" PTR_FORMAT ") != obj (" PTR_FORMAT ")",
   226         tty->print_cr("   mon_info->owner (" PTR_FORMAT ") != obj (" PTR_FORMAT ")",
   227                       (void *) mon_info->owner(),
   227                       p2i((void *) mon_info->owner()),
   228                       (void *) obj);
   228                       p2i((void *) obj));
   229       }
   229       }
   230     }
   230     }
   231   }
   231   }
   232   if (highest_lock != NULL) {
   232   if (highest_lock != NULL) {
   233     // Fix up highest lock to contain displaced header and point
   233     // Fix up highest lock to contain displaced header and point
   326 
   326 
   327   if (TraceBiasedLocking) {
   327   if (TraceBiasedLocking) {
   328     tty->print_cr("* Beginning bulk revocation (kind == %s) because of object "
   328     tty->print_cr("* Beginning bulk revocation (kind == %s) because of object "
   329                   INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
   329                   INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
   330                   (bulk_rebias ? "rebias" : "revoke"),
   330                   (bulk_rebias ? "rebias" : "revoke"),
   331                   (void *) o, (intptr_t) o->mark(), o->klass()->external_name());
   331                   p2i((void *) o), (intptr_t) o->mark(), o->klass()->external_name());
   332   }
   332   }
   333 
   333 
   334   jlong cur_time = os::javaTimeMillis();
   334   jlong cur_time = os::javaTimeMillis();
   335   o->klass()->set_last_biased_lock_bulk_revocation_time(cur_time);
   335   o->klass()->set_last_biased_lock_bulk_revocation_time(cur_time);
   336 
   336