src/share/vm/prims/jvmtiRawMonitor.hpp

Wed, 23 Jan 2013 13:02:39 -0500

author
jprovino
date
Wed, 23 Jan 2013 13:02:39 -0500
changeset 4542
db9981fd3124
parent 2314
f95d63e2154a
child 4492
8b46b0196eb0
permissions
-rw-r--r--

8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
Summary: Rename INCLUDE_ALTERNATE_GCS to INCLUDE_ALL_GCS and replace SERIALGC with INCLUDE_ALL_GCS.
Reviewed-by: coleenp, stefank

acorn@2233 1 /*
stefank@2314 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
acorn@2233 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
acorn@2233 4 *
acorn@2233 5 * This code is free software; you can redistribute it and/or modify it
acorn@2233 6 * under the terms of the GNU General Public License version 2 only, as
acorn@2233 7 * published by the Free Software Foundation.
acorn@2233 8 *
acorn@2233 9 * This code is distributed in the hope that it will be useful, but WITHOUT
acorn@2233 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
acorn@2233 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
acorn@2233 12 * version 2 for more details (a copy is included in the LICENSE file that
acorn@2233 13 * accompanied this code).
acorn@2233 14 *
acorn@2233 15 * You should have received a copy of the GNU General Public License version
acorn@2233 16 * 2 along with this work; if not, write to the Free Software Foundation,
acorn@2233 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
acorn@2233 18 *
acorn@2233 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
acorn@2233 20 * or visit www.oracle.com if you need additional information or have any
acorn@2233 21 * questions.
acorn@2233 22 *
acorn@2233 23 */
acorn@2233 24
stefank@2314 25 #ifndef SHARE_VM_PRIMS_JVMTIRAWMONITOR_HPP
stefank@2314 26 #define SHARE_VM_PRIMS_JVMTIRAWMONITOR_HPP
stefank@2314 27
stefank@2314 28 #ifndef JVMTI_KERNEL
stefank@2314 29 #include "runtime/objectMonitor.hpp"
stefank@2314 30 #include "utilities/growableArray.hpp"
stefank@2314 31 #endif
stefank@2314 32
acorn@2233 33 //
acorn@2233 34 // class JvmtiRawMonitor
acorn@2233 35 //
acorn@2233 36 // Used by JVMTI methods: All RawMonitor methods (CreateRawMonitor, EnterRawMonitor, etc.)
acorn@2233 37 //
acorn@2233 38 // Wrapper for ObjectMonitor class that saves the Monitor's name
acorn@2233 39 //
acorn@2233 40
acorn@2233 41 class JvmtiRawMonitor : public ObjectMonitor {
acorn@2233 42 private:
acorn@2233 43 int _magic;
acorn@2233 44 char * _name;
acorn@2233 45 // JVMTI_RM_MAGIC is set in contructor and unset in destructor.
acorn@2233 46 enum { JVMTI_RM_MAGIC = (int)(('T' << 24) | ('I' << 16) | ('R' << 8) | 'M') };
acorn@2233 47
acorn@2233 48 int SimpleEnter (Thread * Self) ;
acorn@2233 49 int SimpleExit (Thread * Self) ;
acorn@2233 50 int SimpleWait (Thread * Self, jlong millis) ;
acorn@2233 51 int SimpleNotify (Thread * Self, bool All) ;
acorn@2233 52
acorn@2233 53 public:
acorn@2233 54 JvmtiRawMonitor(const char *name);
acorn@2233 55 ~JvmtiRawMonitor();
acorn@2233 56 int raw_enter(TRAPS);
acorn@2233 57 int raw_exit(TRAPS);
acorn@2233 58 int raw_wait(jlong millis, bool interruptable, TRAPS);
acorn@2233 59 int raw_notify(TRAPS);
acorn@2233 60 int raw_notifyAll(TRAPS);
acorn@2233 61 int magic() { return _magic; }
acorn@2233 62 const char *get_name() { return _name; }
acorn@2233 63 bool is_valid();
acorn@2233 64 };
acorn@2233 65
acorn@2233 66 // Onload pending raw monitors
acorn@2233 67 // Class is used to cache onload or onstart monitor enter
acorn@2233 68 // which will transition into real monitor when
acorn@2233 69 // VM is fully initialized.
acorn@2233 70 class JvmtiPendingMonitors : public AllStatic {
acorn@2233 71
acorn@2233 72 private:
acorn@2233 73 static GrowableArray<JvmtiRawMonitor*> *_monitors; // Cache raw monitor enter
acorn@2233 74
acorn@2233 75 inline static GrowableArray<JvmtiRawMonitor*>* monitors() { return _monitors; }
acorn@2233 76
acorn@2233 77 static void dispose() {
acorn@2233 78 delete monitors();
acorn@2233 79 }
acorn@2233 80
acorn@2233 81 public:
acorn@2233 82 static void enter(JvmtiRawMonitor *monitor) {
acorn@2233 83 monitors()->append(monitor);
acorn@2233 84 }
acorn@2233 85
acorn@2233 86 static int count() {
acorn@2233 87 return monitors()->length();
acorn@2233 88 }
acorn@2233 89
acorn@2233 90 static void destroy(JvmtiRawMonitor *monitor) {
acorn@2233 91 while (monitors()->contains(monitor)) {
acorn@2233 92 monitors()->remove(monitor);
acorn@2233 93 }
acorn@2233 94 }
acorn@2233 95
acorn@2233 96 // Return false if monitor is not found in the list.
acorn@2233 97 static bool exit(JvmtiRawMonitor *monitor) {
acorn@2233 98 if (monitors()->contains(monitor)) {
acorn@2233 99 monitors()->remove(monitor);
acorn@2233 100 return true;
acorn@2233 101 } else {
acorn@2233 102 return false;
acorn@2233 103 }
acorn@2233 104 }
acorn@2233 105
acorn@2233 106 static void transition_raw_monitors();
acorn@2233 107 };
stefank@2314 108
stefank@2314 109 #endif // SHARE_VM_PRIMS_JVMTIRAWMONITOR_HPP

mercurial