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

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

mercurial