src/share/vm/runtime/dtraceJSDT.hpp

Tue, 22 Sep 2009 21:12:37 -0600

author
dcubed
date
Tue, 22 Sep 2009 21:12:37 -0600
changeset 1414
87770dcf831b
parent 631
d1605aabd0a1
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6876794: 4/4 sp07t002 hangs very intermittently
Summary: remove over locking by VMThread on "is thread suspended?" check
Reviewed-by: dholmes, acorn, andrew

kamg@551 1 /*
xdono@631 2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
kamg@551 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
kamg@551 4 *
kamg@551 5 * This code is free software; you can redistribute it and/or modify it
kamg@551 6 * under the terms of the GNU General Public License version 2 only, as
kamg@551 7 * published by the Free Software Foundation.
kamg@551 8 *
kamg@551 9 * This code is distributed in the hope that it will be useful, but WITHOUT
kamg@551 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
kamg@551 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kamg@551 12 * version 2 for more details (a copy is included in the LICENSE file that
kamg@551 13 * accompanied this code).
kamg@551 14 *
kamg@551 15 * You should have received a copy of the GNU General Public License version
kamg@551 16 * 2 along with this work; if not, write to the Free Software Foundation,
kamg@551 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
kamg@551 18 *
kamg@551 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
kamg@551 20 * CA 95054 USA or visit www.sun.com if you need additional information or
kamg@551 21 * have any questions.
kamg@551 22 *
kamg@551 23 */
kamg@551 24
kamg@551 25 class RegisteredProbes;
kamg@551 26 typedef jlong OpaqueProbes;
kamg@551 27
kamg@551 28 class DTraceJSDT : AllStatic {
kamg@551 29 private:
kamg@551 30
kamg@551 31 static int pd_activate(void* moduleBaseAddress, jstring module,
kamg@551 32 jint providers_count, JVM_DTraceProvider* providers);
kamg@551 33 static void pd_dispose(int handle);
kamg@551 34 static jboolean pd_is_supported();
kamg@551 35
kamg@551 36 public:
kamg@551 37
kamg@551 38 static OpaqueProbes activate(
kamg@551 39 jint version, jstring module_name, jint providers_count,
kamg@551 40 JVM_DTraceProvider* providers, TRAPS);
kamg@551 41 static jboolean is_probe_enabled(jmethodID method);
kamg@551 42 static void dispose(OpaqueProbes handle);
kamg@551 43 static jboolean is_supported();
kamg@551 44 };
kamg@551 45
kamg@551 46 class RegisteredProbes : public CHeapObj {
kamg@551 47 private:
kamg@551 48 nmethod** _nmethods; // all the probe methods
kamg@551 49 size_t _count; // number of probe methods
kamg@551 50 int _helper_handle; // DTrace-assigned identifier
kamg@551 51
kamg@551 52 public:
kamg@551 53 RegisteredProbes(size_t count) {
kamg@551 54 _count = count;
kamg@551 55 _nmethods = NEW_C_HEAP_ARRAY(nmethod*, count);
kamg@551 56 }
kamg@551 57
kamg@551 58 ~RegisteredProbes() {
kamg@551 59 for (size_t i = 0; i < _count; ++i) {
kamg@551 60 // Let the sweeper reclaim it
kamg@551 61 _nmethods[i]->make_not_entrant();
kamg@551 62 _nmethods[i]->method()->clear_code();
kamg@551 63 }
kamg@551 64 FREE_C_HEAP_ARRAY(nmethod*, _nmethods);
kamg@551 65 _nmethods = NULL;
kamg@551 66 _count = 0;
kamg@551 67 }
kamg@551 68
kamg@551 69 static RegisteredProbes* toRegisteredProbes(OpaqueProbes p) {
kamg@551 70 return (RegisteredProbes*)(intptr_t)p;
kamg@551 71 }
kamg@551 72
kamg@551 73 static OpaqueProbes toOpaqueProbes(RegisteredProbes* p) {
kamg@551 74 return (OpaqueProbes)(intptr_t)p;
kamg@551 75 }
kamg@551 76
kamg@551 77 void set_helper_handle(int handle) { _helper_handle = handle; }
kamg@551 78 int helper_handle() const { return _helper_handle; }
kamg@551 79
kamg@551 80 nmethod* nmethod_at(size_t i) {
kamg@551 81 assert(i >= 0 && i < _count, "bad nmethod index");
kamg@551 82 return _nmethods[i];
kamg@551 83 }
kamg@551 84
kamg@551 85 void nmethod_at_put(size_t i, nmethod* nm) {
kamg@551 86 assert(i >= 0 && i < _count, "bad nmethod index");
kamg@551 87 _nmethods[i] = nm;
kamg@551 88 }
kamg@551 89 };

mercurial