src/share/vm/prims/jvmtiRawMonitor.hpp

Fri, 25 Jan 2013 10:04:08 -0500

author
zgu
date
Fri, 25 Jan 2013 10:04:08 -0500
changeset 4492
8b46b0196eb0
parent 2314
f95d63e2154a
child 6876
710a3c8b516e
permissions
-rw-r--r--

8000692: Remove old KERNEL code
Summary: Removed depreciated kernel VM source code from hotspot VM
Reviewed-by: dholmes, acorn

acorn@2233 1 /*
zgu@4492 2 * Copyright (c) 1999, 2013, 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 #include "runtime/objectMonitor.hpp"
stefank@2314 29 #include "utilities/growableArray.hpp"
stefank@2314 30
acorn@2233 31 //
acorn@2233 32 // class JvmtiRawMonitor
acorn@2233 33 //
acorn@2233 34 // Used by JVMTI methods: All RawMonitor methods (CreateRawMonitor, EnterRawMonitor, etc.)
acorn@2233 35 //
acorn@2233 36 // Wrapper for ObjectMonitor class that saves the Monitor's name
acorn@2233 37 //
acorn@2233 38
acorn@2233 39 class JvmtiRawMonitor : public ObjectMonitor {
acorn@2233 40 private:
acorn@2233 41 int _magic;
acorn@2233 42 char * _name;
acorn@2233 43 // JVMTI_RM_MAGIC is set in contructor and unset in destructor.
acorn@2233 44 enum { JVMTI_RM_MAGIC = (int)(('T' << 24) | ('I' << 16) | ('R' << 8) | 'M') };
acorn@2233 45
acorn@2233 46 int SimpleEnter (Thread * Self) ;
acorn@2233 47 int SimpleExit (Thread * Self) ;
acorn@2233 48 int SimpleWait (Thread * Self, jlong millis) ;
acorn@2233 49 int SimpleNotify (Thread * Self, bool All) ;
acorn@2233 50
acorn@2233 51 public:
acorn@2233 52 JvmtiRawMonitor(const char *name);
acorn@2233 53 ~JvmtiRawMonitor();
acorn@2233 54 int raw_enter(TRAPS);
acorn@2233 55 int raw_exit(TRAPS);
acorn@2233 56 int raw_wait(jlong millis, bool interruptable, TRAPS);
acorn@2233 57 int raw_notify(TRAPS);
acorn@2233 58 int raw_notifyAll(TRAPS);
acorn@2233 59 int magic() { return _magic; }
acorn@2233 60 const char *get_name() { return _name; }
acorn@2233 61 bool is_valid();
acorn@2233 62 };
acorn@2233 63
acorn@2233 64 // Onload pending raw monitors
acorn@2233 65 // Class is used to cache onload or onstart monitor enter
acorn@2233 66 // which will transition into real monitor when
acorn@2233 67 // VM is fully initialized.
acorn@2233 68 class JvmtiPendingMonitors : public AllStatic {
acorn@2233 69
acorn@2233 70 private:
acorn@2233 71 static GrowableArray<JvmtiRawMonitor*> *_monitors; // Cache raw monitor enter
acorn@2233 72
acorn@2233 73 inline static GrowableArray<JvmtiRawMonitor*>* monitors() { return _monitors; }
acorn@2233 74
acorn@2233 75 static void dispose() {
acorn@2233 76 delete monitors();
acorn@2233 77 }
acorn@2233 78
acorn@2233 79 public:
acorn@2233 80 static void enter(JvmtiRawMonitor *monitor) {
acorn@2233 81 monitors()->append(monitor);
acorn@2233 82 }
acorn@2233 83
acorn@2233 84 static int count() {
acorn@2233 85 return monitors()->length();
acorn@2233 86 }
acorn@2233 87
acorn@2233 88 static void destroy(JvmtiRawMonitor *monitor) {
acorn@2233 89 while (monitors()->contains(monitor)) {
acorn@2233 90 monitors()->remove(monitor);
acorn@2233 91 }
acorn@2233 92 }
acorn@2233 93
acorn@2233 94 // Return false if monitor is not found in the list.
acorn@2233 95 static bool exit(JvmtiRawMonitor *monitor) {
acorn@2233 96 if (monitors()->contains(monitor)) {
acorn@2233 97 monitors()->remove(monitor);
acorn@2233 98 return true;
acorn@2233 99 } else {
acorn@2233 100 return false;
acorn@2233 101 }
acorn@2233 102 }
acorn@2233 103
acorn@2233 104 static void transition_raw_monitors();
acorn@2233 105 };
stefank@2314 106
stefank@2314 107 #endif // SHARE_VM_PRIMS_JVMTIRAWMONITOR_HPP

mercurial