1 /* 2 * Copyright (c) 1997, 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/_jni.cpp.incl" 27 28 static jint CurrentVersion = JNI_VERSION_1_6; 29 30 31 // The DT_RETURN_MARK macros create a scoped object to fire the dtrace 32 // '-return' probe regardless of the return path is taken out of the function. 33 // Methods that have multiple return paths use this to avoid having to 34 // instrument each return path. Methods that use CHECK or THROW must use this 35 // since those macros can cause an immedate uninstrumented return. 36 // 37 // In order to get the return value, a reference to the variable containing 38 // the return value must be passed to the contructor of the object, and 39 // the return value must be set before return (since the mark object has 40 // a reference to it). 41 // 42 // Example: 43 // DT_RETURN_MARK_DECL(SomeFunc, int); 44 // JNI_ENTRY(int, SomeFunc, ...) 45 // int return_value = 0; 46 // DT_RETURN_MARK(SomeFunc, int, (const int&)return_value); | 1 /* 2 * Copyright (c) 1997, 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/classLoader.hpp" 27 #include "classfile/javaClasses.hpp" 28 #include "classfile/symbolTable.hpp" 29 #include "classfile/systemDictionary.hpp" 30 #include "classfile/vmSymbols.hpp" 31 #include "interpreter/linkResolver.hpp" 32 #include "memory/allocation.inline.hpp" 33 #include "memory/gcLocker.inline.hpp" 34 #include "memory/oopFactory.hpp" 35 #include "memory/universe.inline.hpp" 36 #include "oops/instanceKlass.hpp" 37 #include "oops/instanceOop.hpp" 38 #include "oops/markOop.hpp" 39 #include "oops/methodOop.hpp" 40 #include "oops/objArrayKlass.hpp" 41 #include "oops/objArrayOop.hpp" 42 #include "oops/oop.inline.hpp" 43 #include "oops/symbolOop.hpp" 44 #include "oops/typeArrayKlass.hpp" 45 #include "oops/typeArrayOop.hpp" 46 #include "prims/jni.h" 47 #include "prims/jniCheck.hpp" 48 #include "prims/jniFastGetField.hpp" 49 #include "prims/jvm.h" 50 #include "prims/jvm_misc.hpp" 51 #include "prims/jvmtiExport.hpp" 52 #include "prims/jvmtiThreadState.hpp" 53 #include "runtime/compilationPolicy.hpp" 54 #include "runtime/fieldDescriptor.hpp" 55 #include "runtime/fprofiler.hpp" 56 #include "runtime/handles.inline.hpp" 57 #include "runtime/interfaceSupport.hpp" 58 #include "runtime/java.hpp" 59 #include "runtime/javaCalls.hpp" 60 #include "runtime/jfieldIDWorkaround.hpp" 61 #include "runtime/reflection.hpp" 62 #include "runtime/sharedRuntime.hpp" 63 #include "runtime/signature.hpp" 64 #include "runtime/vm_operations.hpp" 65 #include "services/runtimeService.hpp" 66 #include "utilities/defaultStream.hpp" 67 #include "utilities/dtrace.hpp" 68 #include "utilities/events.hpp" 69 #include "utilities/histogram.hpp" 70 #ifdef TARGET_ARCH_x86 71 # include "jniTypes_x86.hpp" 72 #endif 73 #ifdef TARGET_ARCH_sparc 74 # include "jniTypes_sparc.hpp" 75 #endif 76 #ifdef TARGET_ARCH_zero 77 # include "jniTypes_zero.hpp" 78 #endif 79 #ifdef TARGET_OS_FAMILY_linux 80 # include "os_linux.inline.hpp" 81 # include "thread_linux.inline.hpp" 82 #endif 83 #ifdef TARGET_OS_FAMILY_solaris 84 # include "os_solaris.inline.hpp" 85 # include "thread_solaris.inline.hpp" 86 #endif 87 #ifdef TARGET_OS_FAMILY_windows 88 # include "os_windows.inline.hpp" 89 # include "thread_windows.inline.hpp" 90 #endif 91 92 static jint CurrentVersion = JNI_VERSION_1_6; 93 94 95 // The DT_RETURN_MARK macros create a scoped object to fire the dtrace 96 // '-return' probe regardless of the return path is taken out of the function. 97 // Methods that have multiple return paths use this to avoid having to 98 // instrument each return path. Methods that use CHECK or THROW must use this 99 // since those macros can cause an immedate uninstrumented return. 100 // 101 // In order to get the return value, a reference to the variable containing 102 // the return value must be passed to the contructor of the object, and 103 // the return value must be set before return (since the mark object has 104 // a reference to it). 105 // 106 // Example: 107 // DT_RETURN_MARK_DECL(SomeFunc, int); 108 // JNI_ENTRY(int, SomeFunc, ...) 109 // int return_value = 0; 110 // DT_RETURN_MARK(SomeFunc, int, (const int&)return_value); |