author | rwestberg |
Fri, 01 Jun 2018 10:15:48 +0200 | |
changeset 50336 | 1b6ea6bcd21a |
parent 47777 | d85284ccd1bd |
permissions | -rw-r--r-- |
2 | 1 |
/* |
47777
d85284ccd1bd
8189731: Disable CFLH when there are no transformers
sspitsyn
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
#include <jni.h> |
|
27 |
||
28 |
#include "JPLISAgent.h" |
|
29 |
#include "JPLISAssert.h" |
|
30 |
#include "Utilities.h" |
|
31 |
#include "JavaExceptions.h" |
|
1090
c5805b1672a6
6732421: Removed old javavm and Classic VM files from the jdk7 sources
ohair
parents:
2
diff
changeset
|
32 |
#include "FileSystemSupport.h" /* For uintptr_t */ |
2 | 33 |
#include "sun_instrument_InstrumentationImpl.h" |
34 |
||
35 |
/* |
|
36 |
* Copyright 2003 Wily Technology, Inc. |
|
37 |
*/ |
|
38 |
||
39 |
/** |
|
40 |
* This module contains the native method implementations to back the |
|
41 |
* sun.instrument.InstrumentationImpl class. |
|
42 |
* The bridge between Java and native code is built by storing a native |
|
43 |
* pointer to the JPLISAgent data structure in a 64 bit scalar field |
|
44 |
* in the InstrumentationImpl instance which is passed to each method. |
|
45 |
*/ |
|
46 |
||
47 |
||
48 |
/* |
|
49 |
* Native methods |
|
50 |
*/ |
|
51 |
||
52 |
/* |
|
33653
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
25859
diff
changeset
|
53 |
* Declare library specific JNI_Onload entry if static build |
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
25859
diff
changeset
|
54 |
*/ |
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
25859
diff
changeset
|
55 |
DEF_STATIC_JNI_OnLoad |
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
25859
diff
changeset
|
56 |
|
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
25859
diff
changeset
|
57 |
/* |
2 | 58 |
* Class: sun_instrument_InstrumentationImpl |
59 |
* Method: isModifiableClass0 |
|
60 |
* Signature: (Ljava/lang/Class;)Z |
|
61 |
*/ |
|
62 |
JNIEXPORT jboolean JNICALL |
|
63 |
Java_sun_instrument_InstrumentationImpl_isModifiableClass0 |
|
64 |
(JNIEnv * jnienv, jobject implThis, jlong agent, jclass clazz) { |
|
65 |
return isModifiableClass(jnienv, (JPLISAgent*)(intptr_t)agent, clazz); |
|
66 |
} |
|
67 |
||
68 |
/* |
|
69 |
* Class: sun_instrument_InstrumentationImpl |
|
70 |
* Method: isRetransformClassesSupported0 |
|
71 |
* Signature: ()Z |
|
72 |
*/ |
|
73 |
JNIEXPORT jboolean JNICALL |
|
74 |
Java_sun_instrument_InstrumentationImpl_isRetransformClassesSupported0 |
|
75 |
(JNIEnv * jnienv, jobject implThis, jlong agent) { |
|
76 |
return isRetransformClassesSupported(jnienv, (JPLISAgent*)(intptr_t)agent); |
|
77 |
} |
|
78 |
||
79 |
/* |
|
80 |
* Class: sun_instrument_InstrumentationImpl |
|
47777
d85284ccd1bd
8189731: Disable CFLH when there are no transformers
sspitsyn
parents:
47216
diff
changeset
|
81 |
* Method: setHasTransformers |
d85284ccd1bd
8189731: Disable CFLH when there are no transformers
sspitsyn
parents:
47216
diff
changeset
|
82 |
* Signature: (Z)V |
d85284ccd1bd
8189731: Disable CFLH when there are no transformers
sspitsyn
parents:
47216
diff
changeset
|
83 |
*/ |
d85284ccd1bd
8189731: Disable CFLH when there are no transformers
sspitsyn
parents:
47216
diff
changeset
|
84 |
JNIEXPORT void JNICALL |
d85284ccd1bd
8189731: Disable CFLH when there are no transformers
sspitsyn
parents:
47216
diff
changeset
|
85 |
Java_sun_instrument_InstrumentationImpl_setHasTransformers |
d85284ccd1bd
8189731: Disable CFLH when there are no transformers
sspitsyn
parents:
47216
diff
changeset
|
86 |
(JNIEnv * jnienv, jobject implThis, jlong agent, jboolean has) { |
d85284ccd1bd
8189731: Disable CFLH when there are no transformers
sspitsyn
parents:
47216
diff
changeset
|
87 |
setHasTransformers(jnienv, (JPLISAgent*)(intptr_t)agent, has); |
d85284ccd1bd
8189731: Disable CFLH when there are no transformers
sspitsyn
parents:
47216
diff
changeset
|
88 |
} |
d85284ccd1bd
8189731: Disable CFLH when there are no transformers
sspitsyn
parents:
47216
diff
changeset
|
89 |
|
d85284ccd1bd
8189731: Disable CFLH when there are no transformers
sspitsyn
parents:
47216
diff
changeset
|
90 |
/* |
d85284ccd1bd
8189731: Disable CFLH when there are no transformers
sspitsyn
parents:
47216
diff
changeset
|
91 |
* Class: sun_instrument_InstrumentationImpl |
2 | 92 |
* Method: setHasRetransformableTransformers |
93 |
* Signature: (Z)V |
|
94 |
*/ |
|
95 |
JNIEXPORT void JNICALL |
|
96 |
Java_sun_instrument_InstrumentationImpl_setHasRetransformableTransformers |
|
97 |
(JNIEnv * jnienv, jobject implThis, jlong agent, jboolean has) { |
|
98 |
setHasRetransformableTransformers(jnienv, (JPLISAgent*)(intptr_t)agent, has); |
|
99 |
} |
|
100 |
||
101 |
/* |
|
102 |
* Class: sun_instrument_InstrumentationImpl |
|
103 |
* Method: retransformClasses0 |
|
104 |
* Signature: ([Ljava/lang/Class;)V |
|
105 |
*/ |
|
106 |
JNIEXPORT void JNICALL |
|
107 |
Java_sun_instrument_InstrumentationImpl_retransformClasses0 |
|
108 |
(JNIEnv * jnienv, jobject implThis, jlong agent, jobjectArray classes) { |
|
109 |
retransformClasses(jnienv, (JPLISAgent*)(intptr_t)agent, classes); |
|
110 |
} |
|
111 |
||
112 |
/* |
|
113 |
* Class: sun_instrument_InstrumentationImpl |
|
114 |
* Method: redefineClasses0 |
|
115 |
* Signature: ([Ljava/lang/instrument/ClassDefinition;)V |
|
116 |
*/ |
|
117 |
JNIEXPORT void JNICALL Java_sun_instrument_InstrumentationImpl_redefineClasses0 |
|
118 |
(JNIEnv * jnienv, jobject implThis, jlong agent, jobjectArray classDefinitions) { |
|
119 |
redefineClasses(jnienv, (JPLISAgent*)(intptr_t)agent, classDefinitions); |
|
120 |
} |
|
121 |
||
122 |
/* |
|
123 |
* Class: sun_instrument_InstrumentationImpl |
|
124 |
* Method: getAllLoadedClasses0 |
|
125 |
* Signature: ()[Ljava/lang/Class; |
|
126 |
*/ |
|
127 |
JNIEXPORT jobjectArray JNICALL Java_sun_instrument_InstrumentationImpl_getAllLoadedClasses0 |
|
128 |
(JNIEnv * jnienv, jobject implThis, jlong agent) { |
|
129 |
return getAllLoadedClasses(jnienv, (JPLISAgent*)(intptr_t)agent); |
|
130 |
} |
|
131 |
||
132 |
/* |
|
133 |
* Class: sun_instrument_InstrumentationImpl |
|
134 |
* Method: getInitiatedClasses0 |
|
135 |
* Signature: (Ljava/lang/ClassLoader;)[Ljava/lang/Class; |
|
136 |
*/ |
|
137 |
JNIEXPORT jobjectArray JNICALL Java_sun_instrument_InstrumentationImpl_getInitiatedClasses0 |
|
138 |
(JNIEnv * jnienv, jobject implThis, jlong agent, jobject classLoader) { |
|
139 |
return getInitiatedClasses(jnienv, (JPLISAgent*)(intptr_t)agent, classLoader); |
|
140 |
} |
|
141 |
||
142 |
/* |
|
143 |
* Class: sun_instrument_InstrumentationImpl |
|
144 |
* Method: getObjectSize0 |
|
145 |
* Signature: (Ljava/lang/Object;)J |
|
146 |
*/ |
|
147 |
JNIEXPORT jlong JNICALL Java_sun_instrument_InstrumentationImpl_getObjectSize0 |
|
148 |
(JNIEnv * jnienv, jobject implThis, jlong agent, jobject objectToSize) { |
|
149 |
return getObjectSize(jnienv, (JPLISAgent*)(intptr_t)agent, objectToSize); |
|
150 |
} |
|
151 |
||
152 |
||
153 |
/* |
|
154 |
* Class: sun_instrument_InstrumentationImpl |
|
155 |
* Method: appendToClassLoaderSearch0 |
|
156 |
* Signature: (Ljava/lang/String;Z)V |
|
157 |
*/ |
|
158 |
JNIEXPORT void JNICALL Java_sun_instrument_InstrumentationImpl_appendToClassLoaderSearch0 |
|
159 |
(JNIEnv * jnienv, jobject implThis, jlong agent, jstring jarFile, jboolean isBootLoader) { |
|
160 |
appendToClassLoaderSearch(jnienv, (JPLISAgent*)(intptr_t)agent, jarFile, isBootLoader); |
|
161 |
} |
|
162 |
||
163 |
||
164 |
/* |
|
165 |
* Class: sun_instrument_InstrumentationImpl |
|
166 |
* Method: setNativeMethodPrefixes |
|
167 |
* Signature: ([Ljava/lang/String;Z)V |
|
168 |
*/ |
|
169 |
JNIEXPORT void JNICALL Java_sun_instrument_InstrumentationImpl_setNativeMethodPrefixes |
|
170 |
(JNIEnv * jnienv, jobject implThis, jlong agent, jobjectArray prefixArray, jboolean isRetransformable) { |
|
171 |
setNativeMethodPrefixes(jnienv, (JPLISAgent*)(intptr_t)agent, prefixArray, isRetransformable); |
|
172 |
} |
|
45004
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
173 |
|
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
174 |
|
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
175 |
/* |
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
176 |
* Class: sun_instrument_InstrumentationImpl |
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
177 |
* Method: loadAgent0 |
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
178 |
*/ |
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
179 |
JNIEXPORT void JNICALL Java_sun_instrument_InstrumentationImpl_loadAgent0 |
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
180 |
(JNIEnv* env, jclass clazz, jstring jarfile) |
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
181 |
{ |
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
182 |
extern jint loadAgent(JNIEnv* env, jstring path); |
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
183 |
if (loadAgent(env, jarfile) != JNI_OK) { |
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
184 |
if (!(*env)->ExceptionCheck(env)) { |
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
185 |
createAndThrowInternalError(env); |
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
186 |
} |
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
187 |
} |
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
188 |
} |
ea3137042a61
8178380: Module system implementation refresh (5/2017)
alanb
parents:
33653
diff
changeset
|
189 |