src/share/vm/runtime/objectMonitor.cpp

Print this page


   1 /*
   2  * Copyright (c) 1998, 2009, 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  */
  24 
  25 # include "incls/_precompiled.incl"
  26 # include "incls/_objectMonitor.cpp.incl"


























  27 
  28 #if defined(__GNUC__) && !defined(IA64)
  29   // Need to inhibit inlining for older versions of GCC to avoid build-time failures
  30   #define ATTR __attribute__((noinline))
  31 #else
  32   #define ATTR
  33 #endif
  34 
  35 
  36 #ifdef DTRACE_ENABLED
  37 
  38 // Only bother with this argument setup if dtrace is available
  39 // TODO-FIXME: probes should not fire when caller is _blocked.  assert() accordingly.
  40 
  41 HS_DTRACE_PROBE_DECL4(hotspot, monitor__notify,
  42   jlong, uintptr_t, char*, int);
  43 HS_DTRACE_PROBE_DECL4(hotspot, monitor__notifyAll,
  44   jlong, uintptr_t, char*, int);
  45 HS_DTRACE_PROBE_DECL4(hotspot, monitor__contended__enter,
  46   jlong, uintptr_t, char*, int);


   1 /*
   2  * Copyright (c) 1998, 2010, 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  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/vmSymbols.hpp"
  27 #include "memory/resourceArea.hpp"
  28 #include "oops/markOop.hpp"
  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/handles.inline.hpp"
  31 #include "runtime/interfaceSupport.hpp"
  32 #include "runtime/mutexLocker.hpp"
  33 #include "runtime/objectMonitor.hpp"
  34 #include "runtime/objectMonitor.inline.hpp"
  35 #include "runtime/osThread.hpp"
  36 #include "runtime/stubRoutines.hpp"
  37 #include "runtime/thread.hpp"
  38 #include "services/threadService.hpp"
  39 #include "utilities/dtrace.hpp"
  40 #include "utilities/preserveException.hpp"
  41 #ifdef TARGET_OS_FAMILY_linux
  42 # include "os_linux.inline.hpp"
  43 # include "thread_linux.inline.hpp"
  44 #endif
  45 #ifdef TARGET_OS_FAMILY_solaris
  46 # include "os_solaris.inline.hpp"
  47 # include "thread_solaris.inline.hpp"
  48 #endif
  49 #ifdef TARGET_OS_FAMILY_windows
  50 # include "os_windows.inline.hpp"
  51 # include "thread_windows.inline.hpp"
  52 #endif
  53 
  54 #if defined(__GNUC__) && !defined(IA64)
  55   // Need to inhibit inlining for older versions of GCC to avoid build-time failures
  56   #define ATTR __attribute__((noinline))
  57 #else
  58   #define ATTR
  59 #endif
  60 
  61 
  62 #ifdef DTRACE_ENABLED
  63 
  64 // Only bother with this argument setup if dtrace is available
  65 // TODO-FIXME: probes should not fire when caller is _blocked.  assert() accordingly.
  66 
  67 HS_DTRACE_PROBE_DECL4(hotspot, monitor__notify,
  68   jlong, uintptr_t, char*, int);
  69 HS_DTRACE_PROBE_DECL4(hotspot, monitor__notifyAll,
  70   jlong, uintptr_t, char*, int);
  71 HS_DTRACE_PROBE_DECL4(hotspot, monitor__contended__enter,
  72   jlong, uintptr_t, char*, int);