Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/runtime/dtraceJSDT.hpp
32285 views
/*1* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_RUNTIME_DTRACEJSDT_HPP25#define SHARE_VM_RUNTIME_DTRACEJSDT_HPP2627#include "code/nmethod.hpp"28#ifdef TARGET_ARCH_x8629# include "nativeInst_x86.hpp"30#endif31#ifdef TARGET_ARCH_aarch3232# include "nativeInst_aarch32.hpp"33#endif34#ifdef TARGET_ARCH_aarch6435# include "nativeInst_aarch64.hpp"36#endif37#ifdef TARGET_ARCH_sparc38# include "nativeInst_sparc.hpp"39#endif40#ifdef TARGET_ARCH_zero41# include "nativeInst_zero.hpp"42#endif43#ifdef TARGET_ARCH_arm44# include "nativeInst_arm.hpp"45#endif46#ifdef TARGET_ARCH_ppc47# include "nativeInst_ppc.hpp"48#endif4950class RegisteredProbes;51typedef jlong OpaqueProbes;5253class DTraceJSDT : AllStatic {54private:5556static int pd_activate(void* moduleBaseAddress, jstring module,57jint providers_count, JVM_DTraceProvider* providers);58static void pd_dispose(int handle);59static jboolean pd_is_supported();6061public:6263static OpaqueProbes activate(64jint version, jstring module_name, jint providers_count,65JVM_DTraceProvider* providers, TRAPS);66static jboolean is_probe_enabled(jmethodID method);67static void dispose(OpaqueProbes handle);68static jboolean is_supported();69};7071class RegisteredProbes : public CHeapObj<mtInternal> {72private:73nmethod** _nmethods; // all the probe methods74size_t _count; // number of probe methods75int _helper_handle; // DTrace-assigned identifier7677public:78RegisteredProbes(size_t count) {79_count = count;80_nmethods = NEW_C_HEAP_ARRAY(nmethod*, count, mtInternal);81}8283~RegisteredProbes() {84for (size_t i = 0; i < _count; ++i) {85// Let the sweeper reclaim it86_nmethods[i]->make_not_entrant();87_nmethods[i]->method()->clear_code();88}89FREE_C_HEAP_ARRAY(nmethod*, _nmethods, mtInternal);90_nmethods = NULL;91_count = 0;92}9394static RegisteredProbes* toRegisteredProbes(OpaqueProbes p) {95return (RegisteredProbes*)(intptr_t)p;96}9798static OpaqueProbes toOpaqueProbes(RegisteredProbes* p) {99return (OpaqueProbes)(intptr_t)p;100}101102void set_helper_handle(int handle) { _helper_handle = handle; }103int helper_handle() const { return _helper_handle; }104105nmethod* nmethod_at(size_t i) {106assert(i >= 0 && i < _count, "bad nmethod index");107return _nmethods[i];108}109110void nmethod_at_put(size_t i, nmethod* nm) {111assert(i >= 0 && i < _count, "bad nmethod index");112_nmethods[i] = nm;113}114};115116#endif // SHARE_VM_RUNTIME_DTRACEJSDT_HPP117118119