hotspot/src/share/vm/runtime/synchronizer.cpp
changeset 22743 e043208c9d93
parent 22551 9bf46d16dcc6
child 22876 57aa8995d43b
child 22796 bb0ea482a99e
equal deleted inserted replaced
22741:13fdeb7d7aad 22743:e043208c9d93
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 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.
   371 
   371 
   372 
   372 
   373 // -----------------------------------------------------------------------------
   373 // -----------------------------------------------------------------------------
   374 //  Wait/Notify/NotifyAll
   374 //  Wait/Notify/NotifyAll
   375 // NOTE: must use heavy weight monitor to handle wait()
   375 // NOTE: must use heavy weight monitor to handle wait()
   376 void ObjectSynchronizer::wait(Handle obj, jlong millis, TRAPS) {
   376 int ObjectSynchronizer::wait(Handle obj, jlong millis, TRAPS) {
   377   if (UseBiasedLocking) {
   377   if (UseBiasedLocking) {
   378     BiasedLocking::revoke_and_rebias(obj, false, THREAD);
   378     BiasedLocking::revoke_and_rebias(obj, false, THREAD);
   379     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
   379     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
   380   }
   380   }
   381   if (millis < 0) {
   381   if (millis < 0) {
   382     TEVENT (wait - throw IAX) ;
   382     TEVENT (wait - throw IAX) ;
   383     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative");
   383     THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative");
   384   }
   384   }
   385   ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, obj());
   385   ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, obj());
   386   DTRACE_MONITOR_WAIT_PROBE(monitor, obj(), THREAD, millis);
   386   DTRACE_MONITOR_WAIT_PROBE(monitor, obj(), THREAD, millis);
   387   monitor->wait(millis, true, THREAD);
   387   monitor->wait(millis, true, THREAD);
   388 
   388 
   389   /* This dummy call is in place to get around dtrace bug 6254741.  Once
   389   // This dummy call is in place to get around dtrace bug 6254741.  Once
   390      that's fixed we can uncomment the following line and remove the call */
   390   // that's fixed we can uncomment the following line, remove the call
       
   391   // and change this function back into a "void" func.
   391   // DTRACE_MONITOR_PROBE(waited, monitor, obj(), THREAD);
   392   // DTRACE_MONITOR_PROBE(waited, monitor, obj(), THREAD);
   392   dtrace_waited_probe(monitor, obj, THREAD);
   393   return dtrace_waited_probe(monitor, obj, THREAD);
   393 }
   394 }
   394 
   395 
   395 void ObjectSynchronizer::waitUninterruptibly (Handle obj, jlong millis, TRAPS) {
   396 void ObjectSynchronizer::waitUninterruptibly (Handle obj, jlong millis, TRAPS) {
   396   if (UseBiasedLocking) {
   397   if (UseBiasedLocking) {
   397     BiasedLocking::revoke_and_rebias(obj, false, THREAD);
   398     BiasedLocking::revoke_and_rebias(obj, false, THREAD);