src/share/vm/runtime/dtraceJSDT.hpp

Thu, 24 May 2018 19:24:53 +0800

author
aoqi
date
Thu, 24 May 2018 19:24:53 +0800
changeset 8861
2a33b32dd03c
parent 6876
710a3c8b516e
permissions
-rw-r--r--

#7046 Disable the compilation when branch offset is beyond short branch
Contributed-by: fujie, aoqi

     1 /*
     2  * Copyright (c) 1997, 2012, 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 /*
    26  * This file has been modified by Loongson Technology in 2015. These
    27  * modifications are Copyright (c) 2015 Loongson Technology, and are made
    28  * available on the same license terms set forth above.
    29  */
    31 #ifndef SHARE_VM_RUNTIME_DTRACEJSDT_HPP
    32 #define SHARE_VM_RUNTIME_DTRACEJSDT_HPP
    34 #include "code/nmethod.hpp"
    35 #ifdef TARGET_ARCH_x86
    36 # include "nativeInst_x86.hpp"
    37 #endif
    38 #ifdef TARGET_ARCH_sparc
    39 # include "nativeInst_sparc.hpp"
    40 #endif
    41 #ifdef TARGET_ARCH_zero
    42 # include "nativeInst_zero.hpp"
    43 #endif
    44 #ifdef TARGET_ARCH_arm
    45 # include "nativeInst_arm.hpp"
    46 #endif
    47 #ifdef TARGET_ARCH_ppc
    48 # include "nativeInst_ppc.hpp"
    49 #endif
    50 #ifdef TARGET_ARCH_mips
    51 # include "nativeInst_mips.hpp"
    52 #endif
    54 class RegisteredProbes;
    55 typedef jlong OpaqueProbes;
    57 class DTraceJSDT : AllStatic {
    58  private:
    60   static int pd_activate(void* moduleBaseAddress, jstring module,
    61       jint providers_count, JVM_DTraceProvider* providers);
    62   static void pd_dispose(int handle);
    63   static jboolean pd_is_supported();
    65  public:
    67   static OpaqueProbes activate(
    68       jint version, jstring module_name, jint providers_count,
    69       JVM_DTraceProvider* providers, TRAPS);
    70   static jboolean is_probe_enabled(jmethodID method);
    71   static void dispose(OpaqueProbes handle);
    72   static jboolean is_supported();
    73 };
    75 class RegisteredProbes : public CHeapObj<mtInternal> {
    76  private:
    77   nmethod** _nmethods;      // all the probe methods
    78   size_t    _count;         // number of probe methods
    79   int       _helper_handle; // DTrace-assigned identifier
    81  public:
    82   RegisteredProbes(size_t count) {
    83     _count = count;
    84     _nmethods = NEW_C_HEAP_ARRAY(nmethod*, count, mtInternal);
    85   }
    87   ~RegisteredProbes() {
    88     for (size_t i = 0; i < _count; ++i) {
    89       // Let the sweeper reclaim it
    90       _nmethods[i]->make_not_entrant();
    91       _nmethods[i]->method()->clear_code();
    92     }
    93     FREE_C_HEAP_ARRAY(nmethod*, _nmethods, mtInternal);
    94     _nmethods = NULL;
    95     _count = 0;
    96   }
    98   static RegisteredProbes* toRegisteredProbes(OpaqueProbes p) {
    99     return (RegisteredProbes*)(intptr_t)p;
   100   }
   102   static OpaqueProbes toOpaqueProbes(RegisteredProbes* p) {
   103     return (OpaqueProbes)(intptr_t)p;
   104   }
   106   void set_helper_handle(int handle) { _helper_handle = handle; }
   107   int helper_handle() const { return _helper_handle; }
   109   nmethod* nmethod_at(size_t i) {
   110     assert(i >= 0 && i < _count, "bad nmethod index");
   111     return _nmethods[i];
   112   }
   114   void nmethod_at_put(size_t i, nmethod* nm) {
   115     assert(i >= 0 && i < _count, "bad nmethod index");
   116     _nmethods[i] = nm;
   117   }
   118 };
   120 #endif // SHARE_VM_RUNTIME_DTRACEJSDT_HPP

mercurial