hotspot/src/share/vm/runtime/biasedLocking.cpp
changeset 20282 7f9cbdf89af2
parent 14488 ab48109f7d1b
child 22859 7b88983393b7
equal deleted inserted replaced
20281:e4d33bd980c4 20282:7f9cbdf89af2
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2013, 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                   (intptr_t) obj, (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread);
   164                   (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                       (intptr_t) mon_info->owner(),
   217                       (void *) mon_info->owner(),
   218                       (intptr_t) obj);
   218                       (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                       (intptr_t) mon_info->owner(),
   227                       (void *) mon_info->owner(),
   228                       (intptr_t) obj);
   228                       (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
   324 
   324 
   325   if (TraceBiasedLocking) {
   325   if (TraceBiasedLocking) {
   326     tty->print_cr("* Beginning bulk revocation (kind == %s) because of object "
   326     tty->print_cr("* Beginning bulk revocation (kind == %s) because of object "
   327                   INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
   327                   INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
   328                   (bulk_rebias ? "rebias" : "revoke"),
   328                   (bulk_rebias ? "rebias" : "revoke"),
   329                   (intptr_t) o, (intptr_t) o->mark(), o->klass()->external_name());
   329                   (void *) o, (intptr_t) o->mark(), o->klass()->external_name());
   330   }
   330   }
   331 
   331 
   332   jlong cur_time = os::javaTimeMillis();
   332   jlong cur_time = os::javaTimeMillis();
   333   o->klass()->set_last_biased_lock_bulk_revocation_time(cur_time);
   333   o->klass()->set_last_biased_lock_bulk_revocation_time(cur_time);
   334 
   334