src/share/vm/prims/jvmtiRawMonitor.cpp

Print this page
rev 6521 : 8044775: Improve usage of umbrella header atomic.inline.hpp.
Reviewed-by: stefank, kvn


   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "prims/jvmtiRawMonitor.hpp"

  27 #include "runtime/interfaceSupport.hpp"
  28 #include "runtime/orderAccess.inline.hpp"
  29 #include "runtime/thread.inline.hpp"
  30 
  31 GrowableArray<JvmtiRawMonitor*> *JvmtiPendingMonitors::_monitors = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<JvmtiRawMonitor*>(1,true);
  32 
  33 void JvmtiPendingMonitors::transition_raw_monitors() {
  34   assert((Threads::number_of_threads()==1),
  35          "Java thread has not created yet or more than one java thread \
  36 is running. Raw monitor transition will not work");
  37   JavaThread *current_java_thread = JavaThread::current();
  38   assert(current_java_thread->thread_state() == _thread_in_vm, "Must be in vm");
  39   {
  40     ThreadBlockInVM __tbivm(current_java_thread);
  41     for(int i=0; i< count(); i++) {
  42       JvmtiRawMonitor *rmonitor = monitors()->at(i);
  43       int r = rmonitor->raw_enter(current_java_thread);
  44       assert(r == ObjectMonitor::OM_OK, "raw_enter should have worked");
  45     }
  46   }




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "prims/jvmtiRawMonitor.hpp"
  27 #include "runtime/atomic.inline.hpp"
  28 #include "runtime/interfaceSupport.hpp"
  29 #include "runtime/orderAccess.inline.hpp"
  30 #include "runtime/thread.inline.hpp"
  31 
  32 GrowableArray<JvmtiRawMonitor*> *JvmtiPendingMonitors::_monitors = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<JvmtiRawMonitor*>(1,true);
  33 
  34 void JvmtiPendingMonitors::transition_raw_monitors() {
  35   assert((Threads::number_of_threads()==1),
  36          "Java thread has not created yet or more than one java thread \
  37 is running. Raw monitor transition will not work");
  38   JavaThread *current_java_thread = JavaThread::current();
  39   assert(current_java_thread->thread_state() == _thread_in_vm, "Must be in vm");
  40   {
  41     ThreadBlockInVM __tbivm(current_java_thread);
  42     for(int i=0; i< count(); i++) {
  43       JvmtiRawMonitor *rmonitor = monitors()->at(i);
  44       int r = rmonitor->raw_enter(current_java_thread);
  45       assert(r == ObjectMonitor::OM_OK, "raw_enter should have worked");
  46     }
  47   }