1
|
1 |
/*
|
|
2 |
* Copyright 1997-2007 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 |
* have any questions.
|
|
22 |
*
|
|
23 |
*/
|
|
24 |
|
|
25 |
#ifndef _JAVASOFT_JVM_H_
|
|
26 |
#define _JAVASOFT_JVM_H_
|
|
27 |
|
|
28 |
// HotSpot integration note:
|
|
29 |
//
|
|
30 |
// This file and jvm.h used with the JDK are identical,
|
|
31 |
// except for the three includes removed below and the
|
|
32 |
// SUPPORT_OLD_REFLECTION sections cut out of the JDK's jvm.h.
|
|
33 |
|
|
34 |
// #include <sys/stat.h>
|
|
35 |
// #include "jni.h"
|
|
36 |
// #include "jvm_md.h"
|
|
37 |
|
|
38 |
|
|
39 |
#ifdef __cplusplus
|
|
40 |
extern "C" {
|
|
41 |
#endif
|
|
42 |
|
|
43 |
/*
|
|
44 |
* This file contains additional functions exported from the VM.
|
|
45 |
* These functions are complementary to the standard JNI support.
|
|
46 |
* There are three parts to this file:
|
|
47 |
*
|
|
48 |
* First, this file contains the VM-related functions needed by native
|
|
49 |
* libraries in the standard Java API. For example, the java.lang.Object
|
|
50 |
* class needs VM-level functions that wait for and notify monitors.
|
|
51 |
*
|
|
52 |
* Second, this file contains the functions and constant definitions
|
|
53 |
* needed by the byte code verifier and class file format checker.
|
|
54 |
* These functions allow the verifier and format checker to be written
|
|
55 |
* in a VM-independent way.
|
|
56 |
*
|
|
57 |
* Third, this file contains various I/O and nerwork operations needed
|
|
58 |
* by the standard Java I/O and network APIs.
|
|
59 |
*/
|
|
60 |
|
|
61 |
/*
|
|
62 |
* Bump the version number when either of the following happens:
|
|
63 |
*
|
|
64 |
* 1. There is a change in JVM_* functions.
|
|
65 |
*
|
|
66 |
* 2. There is a change in the contract between VM and Java classes.
|
|
67 |
* For example, if the VM relies on a new private field in Thread
|
|
68 |
* class.
|
|
69 |
*/
|
|
70 |
|
|
71 |
#define JVM_INTERFACE_VERSION 4
|
|
72 |
|
|
73 |
|
|
74 |
JNIEXPORT jint JNICALL
|
|
75 |
JVM_GetInterfaceVersion(void);
|
|
76 |
|
|
77 |
/*************************************************************************
|
|
78 |
PART 1: Functions for Native Libraries
|
|
79 |
************************************************************************/
|
|
80 |
/*
|
|
81 |
* java.lang.Object
|
|
82 |
*/
|
|
83 |
JNIEXPORT jint JNICALL
|
|
84 |
JVM_IHashCode(JNIEnv *env, jobject obj);
|
|
85 |
|
|
86 |
JNIEXPORT void JNICALL
|
|
87 |
JVM_MonitorWait(JNIEnv *env, jobject obj, jlong ms);
|
|
88 |
|
|
89 |
JNIEXPORT void JNICALL
|
|
90 |
JVM_MonitorNotify(JNIEnv *env, jobject obj);
|
|
91 |
|
|
92 |
JNIEXPORT void JNICALL
|
|
93 |
JVM_MonitorNotifyAll(JNIEnv *env, jobject obj);
|
|
94 |
|
|
95 |
JNIEXPORT jobject JNICALL
|
|
96 |
JVM_Clone(JNIEnv *env, jobject obj);
|
|
97 |
|
|
98 |
/*
|
|
99 |
* java.lang.String
|
|
100 |
*/
|
|
101 |
JNIEXPORT jstring JNICALL
|
|
102 |
JVM_InternString(JNIEnv *env, jstring str);
|
|
103 |
|
|
104 |
/*
|
|
105 |
* java.lang.System
|
|
106 |
*/
|
|
107 |
JNIEXPORT jlong JNICALL
|
|
108 |
JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored);
|
|
109 |
|
|
110 |
JNIEXPORT jlong JNICALL
|
|
111 |
JVM_NanoTime(JNIEnv *env, jclass ignored);
|
|
112 |
|
|
113 |
JNIEXPORT void JNICALL
|
|
114 |
JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos,
|
|
115 |
jobject dst, jint dst_pos, jint length);
|
|
116 |
|
|
117 |
JNIEXPORT jobject JNICALL
|
|
118 |
JVM_InitProperties(JNIEnv *env, jobject p);
|
|
119 |
|
|
120 |
/*
|
|
121 |
* java.io.File
|
|
122 |
*/
|
|
123 |
JNIEXPORT void JNICALL
|
|
124 |
JVM_OnExit(void (*func)(void));
|
|
125 |
|
|
126 |
/*
|
|
127 |
* java.lang.Runtime
|
|
128 |
*/
|
|
129 |
JNIEXPORT void JNICALL
|
|
130 |
JVM_Exit(jint code);
|
|
131 |
|
|
132 |
JNIEXPORT void JNICALL
|
|
133 |
JVM_Halt(jint code);
|
|
134 |
|
|
135 |
JNIEXPORT void JNICALL
|
|
136 |
JVM_GC(void);
|
|
137 |
|
|
138 |
/* Returns the number of real-time milliseconds that have elapsed since the
|
|
139 |
* least-recently-inspected heap object was last inspected by the garbage
|
|
140 |
* collector.
|
|
141 |
*
|
|
142 |
* For simple stop-the-world collectors this value is just the time
|
|
143 |
* since the most recent collection. For generational collectors it is the
|
|
144 |
* time since the oldest generation was most recently collected. Other
|
|
145 |
* collectors are free to return a pessimistic estimate of the elapsed time, or
|
|
146 |
* simply the time since the last full collection was performed.
|
|
147 |
*
|
|
148 |
* Note that in the presence of reference objects, a given object that is no
|
|
149 |
* longer strongly reachable may have to be inspected multiple times before it
|
|
150 |
* can be reclaimed.
|
|
151 |
*/
|
|
152 |
JNIEXPORT jlong JNICALL
|
|
153 |
JVM_MaxObjectInspectionAge(void);
|
|
154 |
|
|
155 |
JNIEXPORT void JNICALL
|
|
156 |
JVM_TraceInstructions(jboolean on);
|
|
157 |
|
|
158 |
JNIEXPORT void JNICALL
|
|
159 |
JVM_TraceMethodCalls(jboolean on);
|
|
160 |
|
|
161 |
JNIEXPORT jlong JNICALL
|
|
162 |
JVM_TotalMemory(void);
|
|
163 |
|
|
164 |
JNIEXPORT jlong JNICALL
|
|
165 |
JVM_FreeMemory(void);
|
|
166 |
|
|
167 |
JNIEXPORT jlong JNICALL
|
|
168 |
JVM_MaxMemory(void);
|
|
169 |
|
|
170 |
JNIEXPORT jint JNICALL
|
|
171 |
JVM_ActiveProcessorCount(void);
|
|
172 |
|
|
173 |
JNIEXPORT void * JNICALL
|
|
174 |
JVM_LoadLibrary(const char *name);
|
|
175 |
|
|
176 |
JNIEXPORT void JNICALL
|
|
177 |
JVM_UnloadLibrary(void * handle);
|
|
178 |
|
|
179 |
JNIEXPORT void * JNICALL
|
|
180 |
JVM_FindLibraryEntry(void *handle, const char *name);
|
|
181 |
|
|
182 |
JNIEXPORT jboolean JNICALL
|
|
183 |
JVM_IsSupportedJNIVersion(jint version);
|
|
184 |
|
|
185 |
/*
|
|
186 |
* java.lang.Float and java.lang.Double
|
|
187 |
*/
|
|
188 |
JNIEXPORT jboolean JNICALL
|
|
189 |
JVM_IsNaN(jdouble d);
|
|
190 |
|
|
191 |
/*
|
|
192 |
* java.lang.Throwable
|
|
193 |
*/
|
|
194 |
JNIEXPORT void JNICALL
|
|
195 |
JVM_FillInStackTrace(JNIEnv *env, jobject throwable);
|
|
196 |
|
|
197 |
JNIEXPORT void JNICALL
|
|
198 |
JVM_PrintStackTrace(JNIEnv *env, jobject throwable, jobject printable);
|
|
199 |
|
|
200 |
JNIEXPORT jint JNICALL
|
|
201 |
JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable);
|
|
202 |
|
|
203 |
JNIEXPORT jobject JNICALL
|
|
204 |
JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index);
|
|
205 |
|
|
206 |
/*
|
|
207 |
* java.lang.Compiler
|
|
208 |
*/
|
|
209 |
JNIEXPORT void JNICALL
|
|
210 |
JVM_InitializeCompiler (JNIEnv *env, jclass compCls);
|
|
211 |
|
|
212 |
JNIEXPORT jboolean JNICALL
|
|
213 |
JVM_IsSilentCompiler(JNIEnv *env, jclass compCls);
|
|
214 |
|
|
215 |
JNIEXPORT jboolean JNICALL
|
|
216 |
JVM_CompileClass(JNIEnv *env, jclass compCls, jclass cls);
|
|
217 |
|
|
218 |
JNIEXPORT jboolean JNICALL
|
|
219 |
JVM_CompileClasses(JNIEnv *env, jclass cls, jstring jname);
|
|
220 |
|
|
221 |
JNIEXPORT jobject JNICALL
|
|
222 |
JVM_CompilerCommand(JNIEnv *env, jclass compCls, jobject arg);
|
|
223 |
|
|
224 |
JNIEXPORT void JNICALL
|
|
225 |
JVM_EnableCompiler(JNIEnv *env, jclass compCls);
|
|
226 |
|
|
227 |
JNIEXPORT void JNICALL
|
|
228 |
JVM_DisableCompiler(JNIEnv *env, jclass compCls);
|
|
229 |
|
|
230 |
/*
|
|
231 |
* java.lang.Thread
|
|
232 |
*/
|
|
233 |
JNIEXPORT void JNICALL
|
|
234 |
JVM_StartThread(JNIEnv *env, jobject thread);
|
|
235 |
|
|
236 |
JNIEXPORT void JNICALL
|
|
237 |
JVM_StopThread(JNIEnv *env, jobject thread, jobject exception);
|
|
238 |
|
|
239 |
JNIEXPORT jboolean JNICALL
|
|
240 |
JVM_IsThreadAlive(JNIEnv *env, jobject thread);
|
|
241 |
|
|
242 |
JNIEXPORT void JNICALL
|
|
243 |
JVM_SuspendThread(JNIEnv *env, jobject thread);
|
|
244 |
|
|
245 |
JNIEXPORT void JNICALL
|
|
246 |
JVM_ResumeThread(JNIEnv *env, jobject thread);
|
|
247 |
|
|
248 |
JNIEXPORT void JNICALL
|
|
249 |
JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio);
|
|
250 |
|
|
251 |
JNIEXPORT void JNICALL
|
|
252 |
JVM_Yield(JNIEnv *env, jclass threadClass);
|
|
253 |
|
|
254 |
JNIEXPORT void JNICALL
|
|
255 |
JVM_Sleep(JNIEnv *env, jclass threadClass, jlong millis);
|
|
256 |
|
|
257 |
JNIEXPORT jobject JNICALL
|
|
258 |
JVM_CurrentThread(JNIEnv *env, jclass threadClass);
|
|
259 |
|
|
260 |
JNIEXPORT jint JNICALL
|
|
261 |
JVM_CountStackFrames(JNIEnv *env, jobject thread);
|
|
262 |
|
|
263 |
JNIEXPORT void JNICALL
|
|
264 |
JVM_Interrupt(JNIEnv *env, jobject thread);
|
|
265 |
|
|
266 |
JNIEXPORT jboolean JNICALL
|
|
267 |
JVM_IsInterrupted(JNIEnv *env, jobject thread, jboolean clearInterrupted);
|
|
268 |
|
|
269 |
JNIEXPORT jboolean JNICALL
|
|
270 |
JVM_HoldsLock(JNIEnv *env, jclass threadClass, jobject obj);
|
|
271 |
|
|
272 |
JNIEXPORT void JNICALL
|
|
273 |
JVM_DumpAllStacks(JNIEnv *env, jclass unused);
|
|
274 |
|
|
275 |
JNIEXPORT jobjectArray JNICALL
|
|
276 |
JVM_GetAllThreads(JNIEnv *env, jclass dummy);
|
|
277 |
|
|
278 |
/* getStackTrace() and getAllStackTraces() method */
|
|
279 |
JNIEXPORT jobjectArray JNICALL
|
|
280 |
JVM_DumpThreads(JNIEnv *env, jclass threadClass, jobjectArray threads);
|
|
281 |
|
|
282 |
/*
|
|
283 |
* java.lang.SecurityManager
|
|
284 |
*/
|
|
285 |
JNIEXPORT jclass JNICALL
|
|
286 |
JVM_CurrentLoadedClass(JNIEnv *env);
|
|
287 |
|
|
288 |
JNIEXPORT jobject JNICALL
|
|
289 |
JVM_CurrentClassLoader(JNIEnv *env);
|
|
290 |
|
|
291 |
JNIEXPORT jobjectArray JNICALL
|
|
292 |
JVM_GetClassContext(JNIEnv *env);
|
|
293 |
|
|
294 |
JNIEXPORT jint JNICALL
|
|
295 |
JVM_ClassDepth(JNIEnv *env, jstring name);
|
|
296 |
|
|
297 |
JNIEXPORT jint JNICALL
|
|
298 |
JVM_ClassLoaderDepth(JNIEnv *env);
|
|
299 |
|
|
300 |
/*
|
|
301 |
* java.lang.Package
|
|
302 |
*/
|
|
303 |
JNIEXPORT jstring JNICALL
|
|
304 |
JVM_GetSystemPackage(JNIEnv *env, jstring name);
|
|
305 |
|
|
306 |
JNIEXPORT jobjectArray JNICALL
|
|
307 |
JVM_GetSystemPackages(JNIEnv *env);
|
|
308 |
|
|
309 |
/*
|
|
310 |
* java.io.ObjectInputStream
|
|
311 |
*/
|
|
312 |
JNIEXPORT jobject JNICALL
|
|
313 |
JVM_AllocateNewObject(JNIEnv *env, jobject obj, jclass currClass,
|
|
314 |
jclass initClass);
|
|
315 |
|
|
316 |
JNIEXPORT jobject JNICALL
|
|
317 |
JVM_AllocateNewArray(JNIEnv *env, jobject obj, jclass currClass,
|
|
318 |
jint length);
|
|
319 |
|
|
320 |
JNIEXPORT jobject JNICALL
|
|
321 |
JVM_LatestUserDefinedLoader(JNIEnv *env);
|
|
322 |
|
|
323 |
/*
|
|
324 |
* This function has been deprecated and should not be considered
|
|
325 |
* part of the specified JVM interface.
|
|
326 |
*/
|
|
327 |
JNIEXPORT jclass JNICALL
|
|
328 |
JVM_LoadClass0(JNIEnv *env, jobject obj, jclass currClass,
|
|
329 |
jstring currClassName);
|
|
330 |
|
|
331 |
/*
|
|
332 |
* java.lang.reflect.Array
|
|
333 |
*/
|
|
334 |
JNIEXPORT jint JNICALL
|
|
335 |
JVM_GetArrayLength(JNIEnv *env, jobject arr);
|
|
336 |
|
|
337 |
JNIEXPORT jobject JNICALL
|
|
338 |
JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index);
|
|
339 |
|
|
340 |
JNIEXPORT jvalue JNICALL
|
|
341 |
JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode);
|
|
342 |
|
|
343 |
JNIEXPORT void JNICALL
|
|
344 |
JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val);
|
|
345 |
|
|
346 |
JNIEXPORT void JNICALL
|
|
347 |
JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v,
|
|
348 |
unsigned char vCode);
|
|
349 |
|
|
350 |
JNIEXPORT jobject JNICALL
|
|
351 |
JVM_NewArray(JNIEnv *env, jclass eltClass, jint length);
|
|
352 |
|
|
353 |
JNIEXPORT jobject JNICALL
|
|
354 |
JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim);
|
|
355 |
|
|
356 |
/*
|
|
357 |
* java.lang.Class and java.lang.ClassLoader
|
|
358 |
*/
|
|
359 |
/*
|
|
360 |
* Returns the class in which the code invoking the native method
|
|
361 |
* belongs.
|
|
362 |
*
|
|
363 |
* Note that in JDK 1.1, native methods did not create a frame.
|
|
364 |
* In 1.2, they do. Therefore native methods like Class.forName
|
|
365 |
* can no longer look at the current frame for the caller class.
|
|
366 |
*/
|
|
367 |
JNIEXPORT jclass JNICALL
|
|
368 |
JVM_GetCallerClass(JNIEnv *env, int n);
|
|
369 |
|
|
370 |
/*
|
|
371 |
* Find primitive classes
|
|
372 |
* utf: class name
|
|
373 |
*/
|
|
374 |
JNIEXPORT jclass JNICALL
|
|
375 |
JVM_FindPrimitiveClass(JNIEnv *env, const char *utf);
|
|
376 |
|
|
377 |
/*
|
|
378 |
* Link the class
|
|
379 |
*/
|
|
380 |
JNIEXPORT void JNICALL
|
|
381 |
JVM_ResolveClass(JNIEnv *env, jclass cls);
|
|
382 |
|
|
383 |
/*
|
|
384 |
* Find a class from a given class loader. Throw ClassNotFoundException
|
|
385 |
* or NoClassDefFoundError depending on the value of the last
|
|
386 |
* argument.
|
|
387 |
*/
|
|
388 |
JNIEXPORT jclass JNICALL
|
|
389 |
JVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init,
|
|
390 |
jobject loader, jboolean throwError);
|
|
391 |
|
|
392 |
/*
|
|
393 |
* Find a class from a given class.
|
|
394 |
*/
|
|
395 |
JNIEXPORT jclass JNICALL
|
|
396 |
JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init,
|
|
397 |
jclass from);
|
|
398 |
|
|
399 |
/* Find a loaded class cached by the VM */
|
|
400 |
JNIEXPORT jclass JNICALL
|
|
401 |
JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name);
|
|
402 |
|
|
403 |
/* Define a class */
|
|
404 |
JNIEXPORT jclass JNICALL
|
|
405 |
JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf,
|
|
406 |
jsize len, jobject pd);
|
|
407 |
|
|
408 |
/* Define a class with a source (added in JDK1.5) */
|
|
409 |
JNIEXPORT jclass JNICALL
|
|
410 |
JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader,
|
|
411 |
const jbyte *buf, jsize len, jobject pd,
|
|
412 |
const char *source);
|
|
413 |
|
|
414 |
/*
|
|
415 |
* Reflection support functions
|
|
416 |
*/
|
|
417 |
|
|
418 |
JNIEXPORT jstring JNICALL
|
|
419 |
JVM_GetClassName(JNIEnv *env, jclass cls);
|
|
420 |
|
|
421 |
JNIEXPORT jobjectArray JNICALL
|
|
422 |
JVM_GetClassInterfaces(JNIEnv *env, jclass cls);
|
|
423 |
|
|
424 |
JNIEXPORT jobject JNICALL
|
|
425 |
JVM_GetClassLoader(JNIEnv *env, jclass cls);
|
|
426 |
|
|
427 |
JNIEXPORT jboolean JNICALL
|
|
428 |
JVM_IsInterface(JNIEnv *env, jclass cls);
|
|
429 |
|
|
430 |
JNIEXPORT jobjectArray JNICALL
|
|
431 |
JVM_GetClassSigners(JNIEnv *env, jclass cls);
|
|
432 |
|
|
433 |
JNIEXPORT void JNICALL
|
|
434 |
JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers);
|
|
435 |
|
|
436 |
JNIEXPORT jobject JNICALL
|
|
437 |
JVM_GetProtectionDomain(JNIEnv *env, jclass cls);
|
|
438 |
|
|
439 |
JNIEXPORT void JNICALL
|
|
440 |
JVM_SetProtectionDomain(JNIEnv *env, jclass cls, jobject protection_domain);
|
|
441 |
|
|
442 |
JNIEXPORT jboolean JNICALL
|
|
443 |
JVM_IsArrayClass(JNIEnv *env, jclass cls);
|
|
444 |
|
|
445 |
JNIEXPORT jboolean JNICALL
|
|
446 |
JVM_IsPrimitiveClass(JNIEnv *env, jclass cls);
|
|
447 |
|
|
448 |
JNIEXPORT jclass JNICALL
|
|
449 |
JVM_GetComponentType(JNIEnv *env, jclass cls);
|
|
450 |
|
|
451 |
JNIEXPORT jint JNICALL
|
|
452 |
JVM_GetClassModifiers(JNIEnv *env, jclass cls);
|
|
453 |
|
|
454 |
JNIEXPORT jobjectArray JNICALL
|
|
455 |
JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass);
|
|
456 |
|
|
457 |
JNIEXPORT jclass JNICALL
|
|
458 |
JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass);
|
|
459 |
|
|
460 |
/* Generics support (JDK 1.5) */
|
|
461 |
JNIEXPORT jstring JNICALL
|
|
462 |
JVM_GetClassSignature(JNIEnv *env, jclass cls);
|
|
463 |
|
|
464 |
/* Annotations support (JDK 1.5) */
|
|
465 |
JNIEXPORT jbyteArray JNICALL
|
|
466 |
JVM_GetClassAnnotations(JNIEnv *env, jclass cls);
|
|
467 |
|
|
468 |
/* Annotations support (JDK 1.6) */
|
|
469 |
|
|
470 |
// field is a handle to a java.lang.reflect.Field object
|
|
471 |
JNIEXPORT jbyteArray JNICALL
|
|
472 |
JVM_GetFieldAnnotations(JNIEnv *env, jobject field);
|
|
473 |
|
|
474 |
// method is a handle to a java.lang.reflect.Method object
|
|
475 |
JNIEXPORT jbyteArray JNICALL
|
|
476 |
JVM_GetMethodAnnotations(JNIEnv *env, jobject method);
|
|
477 |
|
|
478 |
// method is a handle to a java.lang.reflect.Method object
|
|
479 |
JNIEXPORT jbyteArray JNICALL
|
|
480 |
JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method);
|
|
481 |
|
|
482 |
// method is a handle to a java.lang.reflect.Method object
|
|
483 |
JNIEXPORT jbyteArray JNICALL
|
|
484 |
JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method);
|
|
485 |
|
|
486 |
|
|
487 |
/*
|
|
488 |
* New (JDK 1.4) reflection implementation
|
|
489 |
*/
|
|
490 |
|
|
491 |
JNIEXPORT jobjectArray JNICALL
|
|
492 |
JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly);
|
|
493 |
|
|
494 |
JNIEXPORT jobjectArray JNICALL
|
|
495 |
JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly);
|
|
496 |
|
|
497 |
JNIEXPORT jobjectArray JNICALL
|
|
498 |
JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly);
|
|
499 |
|
|
500 |
/* Differs from JVM_GetClassModifiers in treatment of inner classes.
|
|
501 |
This returns the access flags for the class as specified in the
|
|
502 |
class file rather than searching the InnerClasses attribute (if
|
|
503 |
present) to find the source-level access flags. Only the values of
|
|
504 |
the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
|
|
505 |
valid. */
|
|
506 |
JNIEXPORT jint JNICALL
|
|
507 |
JVM_GetClassAccessFlags(JNIEnv *env, jclass cls);
|
|
508 |
|
|
509 |
/*
|
|
510 |
* Constant pool access; currently used to implement reflective access to annotations (JDK 1.5)
|
|
511 |
*/
|
|
512 |
|
|
513 |
JNIEXPORT jobject JNICALL
|
|
514 |
JVM_GetClassConstantPool(JNIEnv *env, jclass cls);
|
|
515 |
|
|
516 |
JNIEXPORT jint JNICALL JVM_ConstantPoolGetSize
|
|
517 |
(JNIEnv *env, jobject unused, jobject jcpool);
|
|
518 |
|
|
519 |
JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt
|
|
520 |
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
|
521 |
|
|
522 |
JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded
|
|
523 |
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
|
524 |
|
|
525 |
JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt
|
|
526 |
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
|
527 |
|
|
528 |
JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded
|
|
529 |
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
|
530 |
|
|
531 |
JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAt
|
|
532 |
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
|
533 |
|
|
534 |
JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded
|
|
535 |
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
|
536 |
|
|
537 |
JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt
|
|
538 |
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
|
539 |
|
|
540 |
JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt
|
|
541 |
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
|
542 |
|
|
543 |
JNIEXPORT jlong JNICALL JVM_ConstantPoolGetLongAt
|
|
544 |
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
|
545 |
|
|
546 |
JNIEXPORT jfloat JNICALL JVM_ConstantPoolGetFloatAt
|
|
547 |
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
|
548 |
|
|
549 |
JNIEXPORT jdouble JNICALL JVM_ConstantPoolGetDoubleAt
|
|
550 |
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
|
551 |
|
|
552 |
JNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt
|
|
553 |
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
|
554 |
|
|
555 |
JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At
|
|
556 |
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
|
557 |
|
|
558 |
/*
|
|
559 |
* java.security.*
|
|
560 |
*/
|
|
561 |
|
|
562 |
JNIEXPORT jobject JNICALL
|
|
563 |
JVM_DoPrivileged(JNIEnv *env, jclass cls,
|
|
564 |
jobject action, jobject context, jboolean wrapException);
|
|
565 |
|
|
566 |
JNIEXPORT jobject JNICALL
|
|
567 |
JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);
|
|
568 |
|
|
569 |
JNIEXPORT jobject JNICALL
|
|
570 |
JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls);
|
|
571 |
|
|
572 |
/*
|
|
573 |
* Signal support, used to implement the shutdown sequence. Every VM must
|
|
574 |
* support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts
|
|
575 |
* (^C) and the latter for external termination (kill, system shutdown, etc.).
|
|
576 |
* Other platform-dependent signal values may also be supported.
|
|
577 |
*/
|
|
578 |
|
|
579 |
JNIEXPORT void * JNICALL
|
|
580 |
JVM_RegisterSignal(jint sig, void *handler);
|
|
581 |
|
|
582 |
JNIEXPORT jboolean JNICALL
|
|
583 |
JVM_RaiseSignal(jint sig);
|
|
584 |
|
|
585 |
JNIEXPORT jint JNICALL
|
|
586 |
JVM_FindSignal(const char *name);
|
|
587 |
|
|
588 |
/*
|
|
589 |
* Retrieve the assertion directives for the specified class.
|
|
590 |
*/
|
|
591 |
JNIEXPORT jboolean JNICALL
|
|
592 |
JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls);
|
|
593 |
|
|
594 |
/*
|
|
595 |
* Retrieve the assertion directives from the VM.
|
|
596 |
*/
|
|
597 |
JNIEXPORT jobject JNICALL
|
|
598 |
JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused);
|
|
599 |
|
|
600 |
/*
|
|
601 |
* sun.misc.AtomicLong
|
|
602 |
*/
|
|
603 |
JNIEXPORT jboolean JNICALL
|
|
604 |
JVM_SupportsCX8(void);
|
|
605 |
|
|
606 |
JNIEXPORT jboolean JNICALL
|
|
607 |
JVM_CX8Field(JNIEnv *env, jobject obj, jfieldID fldID, jlong oldVal, jlong newVal);
|
|
608 |
|
|
609 |
/*************************************************************************
|
|
610 |
PART 2: Support for the Verifier and Class File Format Checker
|
|
611 |
************************************************************************/
|
|
612 |
/*
|
|
613 |
* Return the class name in UTF format. The result is valid
|
|
614 |
* until JVM_ReleaseUTf is called.
|
|
615 |
*
|
|
616 |
* The caller must treat the string as a constant and not modify it
|
|
617 |
* in any way.
|
|
618 |
*/
|
|
619 |
JNIEXPORT const char * JNICALL
|
|
620 |
JVM_GetClassNameUTF(JNIEnv *env, jclass cb);
|
|
621 |
|
|
622 |
/*
|
|
623 |
* Returns the constant pool types in the buffer provided by "types."
|
|
624 |
*/
|
|
625 |
JNIEXPORT void JNICALL
|
|
626 |
JVM_GetClassCPTypes(JNIEnv *env, jclass cb, unsigned char *types);
|
|
627 |
|
|
628 |
/*
|
|
629 |
* Returns the number of Constant Pool entries.
|
|
630 |
*/
|
|
631 |
JNIEXPORT jint JNICALL
|
|
632 |
JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cb);
|
|
633 |
|
|
634 |
/*
|
|
635 |
* Returns the number of *declared* fields or methods.
|
|
636 |
*/
|
|
637 |
JNIEXPORT jint JNICALL
|
|
638 |
JVM_GetClassFieldsCount(JNIEnv *env, jclass cb);
|
|
639 |
|
|
640 |
JNIEXPORT jint JNICALL
|
|
641 |
JVM_GetClassMethodsCount(JNIEnv *env, jclass cb);
|
|
642 |
|
|
643 |
/*
|
|
644 |
* Returns the CP indexes of exceptions raised by a given method.
|
|
645 |
* Places the result in the given buffer.
|
|
646 |
*
|
|
647 |
* The method is identified by method_index.
|
|
648 |
*/
|
|
649 |
JNIEXPORT void JNICALL
|
|
650 |
JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cb, jint method_index,
|
|
651 |
unsigned short *exceptions);
|
|
652 |
/*
|
|
653 |
* Returns the number of exceptions raised by a given method.
|
|
654 |
* The method is identified by method_index.
|
|
655 |
*/
|
|
656 |
JNIEXPORT jint JNICALL
|
|
657 |
JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cb, jint method_index);
|
|
658 |
|
|
659 |
/*
|
|
660 |
* Returns the byte code sequence of a given method.
|
|
661 |
* Places the result in the given buffer.
|
|
662 |
*
|
|
663 |
* The method is identified by method_index.
|
|
664 |
*/
|
|
665 |
JNIEXPORT void JNICALL
|
|
666 |
JVM_GetMethodIxByteCode(JNIEnv *env, jclass cb, jint method_index,
|
|
667 |
unsigned char *code);
|
|
668 |
|
|
669 |
/*
|
|
670 |
* Returns the length of the byte code sequence of a given method.
|
|
671 |
* The method is identified by method_index.
|
|
672 |
*/
|
|
673 |
JNIEXPORT jint JNICALL
|
|
674 |
JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cb, jint method_index);
|
|
675 |
|
|
676 |
/*
|
|
677 |
* A structure used to a capture exception table entry in a Java method.
|
|
678 |
*/
|
|
679 |
typedef struct {
|
|
680 |
jint start_pc;
|
|
681 |
jint end_pc;
|
|
682 |
jint handler_pc;
|
|
683 |
jint catchType;
|
|
684 |
} JVM_ExceptionTableEntryType;
|
|
685 |
|
|
686 |
/*
|
|
687 |
* Returns the exception table entry at entry_index of a given method.
|
|
688 |
* Places the result in the given buffer.
|
|
689 |
*
|
|
690 |
* The method is identified by method_index.
|
|
691 |
*/
|
|
692 |
JNIEXPORT void JNICALL
|
|
693 |
JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cb, jint method_index,
|
|
694 |
jint entry_index,
|
|
695 |
JVM_ExceptionTableEntryType *entry);
|
|
696 |
|
|
697 |
/*
|
|
698 |
* Returns the length of the exception table of a given method.
|
|
699 |
* The method is identified by method_index.
|
|
700 |
*/
|
|
701 |
JNIEXPORT jint JNICALL
|
|
702 |
JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cb, int index);
|
|
703 |
|
|
704 |
/*
|
|
705 |
* Returns the modifiers of a given field.
|
|
706 |
* The field is identified by field_index.
|
|
707 |
*/
|
|
708 |
JNIEXPORT jint JNICALL
|
|
709 |
JVM_GetFieldIxModifiers(JNIEnv *env, jclass cb, int index);
|
|
710 |
|
|
711 |
/*
|
|
712 |
* Returns the modifiers of a given method.
|
|
713 |
* The method is identified by method_index.
|
|
714 |
*/
|
|
715 |
JNIEXPORT jint JNICALL
|
|
716 |
JVM_GetMethodIxModifiers(JNIEnv *env, jclass cb, int index);
|
|
717 |
|
|
718 |
/*
|
|
719 |
* Returns the number of local variables of a given method.
|
|
720 |
* The method is identified by method_index.
|
|
721 |
*/
|
|
722 |
JNIEXPORT jint JNICALL
|
|
723 |
JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cb, int index);
|
|
724 |
|
|
725 |
/*
|
|
726 |
* Returns the number of arguments (including this pointer) of a given method.
|
|
727 |
* The method is identified by method_index.
|
|
728 |
*/
|
|
729 |
JNIEXPORT jint JNICALL
|
|
730 |
JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cb, int index);
|
|
731 |
|
|
732 |
/*
|
|
733 |
* Returns the maximum amount of stack (in words) used by a given method.
|
|
734 |
* The method is identified by method_index.
|
|
735 |
*/
|
|
736 |
JNIEXPORT jint JNICALL
|
|
737 |
JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cb, int index);
|
|
738 |
|
|
739 |
/*
|
|
740 |
* Is a given method a constructor.
|
|
741 |
* The method is identified by method_index.
|
|
742 |
*/
|
|
743 |
JNIEXPORT jboolean JNICALL
|
|
744 |
JVM_IsConstructorIx(JNIEnv *env, jclass cb, int index);
|
|
745 |
|
|
746 |
/*
|
|
747 |
* Returns the name of a given method in UTF format.
|
|
748 |
* The result remains valid until JVM_ReleaseUTF is called.
|
|
749 |
*
|
|
750 |
* The caller must treat the string as a constant and not modify it
|
|
751 |
* in any way.
|
|
752 |
*/
|
|
753 |
JNIEXPORT const char * JNICALL
|
|
754 |
JVM_GetMethodIxNameUTF(JNIEnv *env, jclass cb, jint index);
|
|
755 |
|
|
756 |
/*
|
|
757 |
* Returns the signature of a given method in UTF format.
|
|
758 |
* The result remains valid until JVM_ReleaseUTF is called.
|
|
759 |
*
|
|
760 |
* The caller must treat the string as a constant and not modify it
|
|
761 |
* in any way.
|
|
762 |
*/
|
|
763 |
JNIEXPORT const char * JNICALL
|
|
764 |
JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index);
|
|
765 |
|
|
766 |
/*
|
|
767 |
* Returns the name of the field refered to at a given constant pool
|
|
768 |
* index.
|
|
769 |
*
|
|
770 |
* The result is in UTF format and remains valid until JVM_ReleaseUTF
|
|
771 |
* is called.
|
|
772 |
*
|
|
773 |
* The caller must treat the string as a constant and not modify it
|
|
774 |
* in any way.
|
|
775 |
*/
|
|
776 |
JNIEXPORT const char * JNICALL
|
|
777 |
JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index);
|
|
778 |
|
|
779 |
/*
|
|
780 |
* Returns the name of the method refered to at a given constant pool
|
|
781 |
* index.
|
|
782 |
*
|
|
783 |
* The result is in UTF format and remains valid until JVM_ReleaseUTF
|
|
784 |
* is called.
|
|
785 |
*
|
|
786 |
* The caller must treat the string as a constant and not modify it
|
|
787 |
* in any way.
|
|
788 |
*/
|
|
789 |
JNIEXPORT const char * JNICALL
|
|
790 |
JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index);
|
|
791 |
|
|
792 |
/*
|
|
793 |
* Returns the signature of the method refered to at a given constant pool
|
|
794 |
* index.
|
|
795 |
*
|
|
796 |
* The result is in UTF format and remains valid until JVM_ReleaseUTF
|
|
797 |
* is called.
|
|
798 |
*
|
|
799 |
* The caller must treat the string as a constant and not modify it
|
|
800 |
* in any way.
|
|
801 |
*/
|
|
802 |
JNIEXPORT const char * JNICALL
|
|
803 |
JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index);
|
|
804 |
|
|
805 |
/*
|
|
806 |
* Returns the signature of the field refered to at a given constant pool
|
|
807 |
* index.
|
|
808 |
*
|
|
809 |
* The result is in UTF format and remains valid until JVM_ReleaseUTF
|
|
810 |
* is called.
|
|
811 |
*
|
|
812 |
* The caller must treat the string as a constant and not modify it
|
|
813 |
* in any way.
|
|
814 |
*/
|
|
815 |
JNIEXPORT const char * JNICALL
|
|
816 |
JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index);
|
|
817 |
|
|
818 |
/*
|
|
819 |
* Returns the class name refered to at a given constant pool index.
|
|
820 |
*
|
|
821 |
* The result is in UTF format and remains valid until JVM_ReleaseUTF
|
|
822 |
* is called.
|
|
823 |
*
|
|
824 |
* The caller must treat the string as a constant and not modify it
|
|
825 |
* in any way.
|
|
826 |
*/
|
|
827 |
JNIEXPORT const char * JNICALL
|
|
828 |
JVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index);
|
|
829 |
|
|
830 |
/*
|
|
831 |
* Returns the class name refered to at a given constant pool index.
|
|
832 |
*
|
|
833 |
* The constant pool entry must refer to a CONSTANT_Fieldref.
|
|
834 |
*
|
|
835 |
* The result is in UTF format and remains valid until JVM_ReleaseUTF
|
|
836 |
* is called.
|
|
837 |
*
|
|
838 |
* The caller must treat the string as a constant and not modify it
|
|
839 |
* in any way.
|
|
840 |
*/
|
|
841 |
JNIEXPORT const char * JNICALL
|
|
842 |
JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index);
|
|
843 |
|
|
844 |
/*
|
|
845 |
* Returns the class name refered to at a given constant pool index.
|
|
846 |
*
|
|
847 |
* The constant pool entry must refer to CONSTANT_Methodref or
|
|
848 |
* CONSTANT_InterfaceMethodref.
|
|
849 |
*
|
|
850 |
* The result is in UTF format and remains valid until JVM_ReleaseUTF
|
|
851 |
* is called.
|
|
852 |
*
|
|
853 |
* The caller must treat the string as a constant and not modify it
|
|
854 |
* in any way.
|
|
855 |
*/
|
|
856 |
JNIEXPORT const char * JNICALL
|
|
857 |
JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cb, jint index);
|
|
858 |
|
|
859 |
/*
|
|
860 |
* Returns the modifiers of a field in calledClass. The field is
|
|
861 |
* referred to in class cb at constant pool entry index.
|
|
862 |
*
|
|
863 |
* The caller must treat the string as a constant and not modify it
|
|
864 |
* in any way.
|
|
865 |
*
|
|
866 |
* Returns -1 if the field does not exist in calledClass.
|
|
867 |
*/
|
|
868 |
JNIEXPORT jint JNICALL
|
|
869 |
JVM_GetCPFieldModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);
|
|
870 |
|
|
871 |
/*
|
|
872 |
* Returns the modifiers of a method in calledClass. The method is
|
|
873 |
* referred to in class cb at constant pool entry index.
|
|
874 |
*
|
|
875 |
* Returns -1 if the method does not exist in calledClass.
|
|
876 |
*/
|
|
877 |
JNIEXPORT jint JNICALL
|
|
878 |
JVM_GetCPMethodModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);
|
|
879 |
|
|
880 |
/*
|
|
881 |
* Releases the UTF string obtained from the VM.
|
|
882 |
*/
|
|
883 |
JNIEXPORT void JNICALL
|
|
884 |
JVM_ReleaseUTF(const char *utf);
|
|
885 |
|
|
886 |
/*
|
|
887 |
* Compare if two classes are in the same package.
|
|
888 |
*/
|
|
889 |
JNIEXPORT jboolean JNICALL
|
|
890 |
JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2);
|
|
891 |
|
|
892 |
/* Constants in class files */
|
|
893 |
|
|
894 |
#define JVM_ACC_PUBLIC 0x0001 /* visible to everyone */
|
|
895 |
#define JVM_ACC_PRIVATE 0x0002 /* visible only to the defining class */
|
|
896 |
#define JVM_ACC_PROTECTED 0x0004 /* visible to subclasses */
|
|
897 |
#define JVM_ACC_STATIC 0x0008 /* instance variable is static */
|
|
898 |
#define JVM_ACC_FINAL 0x0010 /* no further subclassing, overriding */
|
|
899 |
#define JVM_ACC_SYNCHRONIZED 0x0020 /* wrap method call in monitor lock */
|
|
900 |
#define JVM_ACC_SUPER 0x0020 /* funky handling of invokespecial */
|
|
901 |
#define JVM_ACC_VOLATILE 0x0040 /* can not cache in registers */
|
|
902 |
#define JVM_ACC_BRIDGE 0x0040 /* bridge method generated by compiler */
|
|
903 |
#define JVM_ACC_TRANSIENT 0x0080 /* not persistent */
|
|
904 |
#define JVM_ACC_VARARGS 0x0080 /* method declared with variable number of args */
|
|
905 |
#define JVM_ACC_NATIVE 0x0100 /* implemented in C */
|
|
906 |
#define JVM_ACC_INTERFACE 0x0200 /* class is an interface */
|
|
907 |
#define JVM_ACC_ABSTRACT 0x0400 /* no definition provided */
|
|
908 |
#define JVM_ACC_STRICT 0x0800 /* strict floating point */
|
|
909 |
#define JVM_ACC_SYNTHETIC 0x1000 /* compiler-generated class, method or field */
|
|
910 |
#define JVM_ACC_ANNOTATION 0x2000 /* annotation type */
|
|
911 |
#define JVM_ACC_ENUM 0x4000 /* field is declared as element of enum */
|
|
912 |
|
|
913 |
#define JVM_ACC_PUBLIC_BIT 0
|
|
914 |
#define JVM_ACC_PRIVATE_BIT 1
|
|
915 |
#define JVM_ACC_PROTECTED_BIT 2
|
|
916 |
#define JVM_ACC_STATIC_BIT 3
|
|
917 |
#define JVM_ACC_FINAL_BIT 4
|
|
918 |
#define JVM_ACC_SYNCHRONIZED_BIT 5
|
|
919 |
#define JVM_ACC_SUPER_BIT 5
|
|
920 |
#define JVM_ACC_VOLATILE_BIT 6
|
|
921 |
#define JVM_ACC_BRIDGE_BIT 6
|
|
922 |
#define JVM_ACC_TRANSIENT_BIT 7
|
|
923 |
#define JVM_ACC_VARARGS_BIT 7
|
|
924 |
#define JVM_ACC_NATIVE_BIT 8
|
|
925 |
#define JVM_ACC_INTERFACE_BIT 9
|
|
926 |
#define JVM_ACC_ABSTRACT_BIT 10
|
|
927 |
#define JVM_ACC_STRICT_BIT 11
|
|
928 |
#define JVM_ACC_SYNTHETIC_BIT 12
|
|
929 |
#define JVM_ACC_ANNOTATION_BIT 13
|
|
930 |
#define JVM_ACC_ENUM_BIT 14
|
|
931 |
|
|
932 |
// NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/utilities/ConstantTag.java
|
|
933 |
enum {
|
|
934 |
JVM_CONSTANT_Utf8 = 1,
|
|
935 |
JVM_CONSTANT_Unicode, /* unused */
|
|
936 |
JVM_CONSTANT_Integer,
|
|
937 |
JVM_CONSTANT_Float,
|
|
938 |
JVM_CONSTANT_Long,
|
|
939 |
JVM_CONSTANT_Double,
|
|
940 |
JVM_CONSTANT_Class,
|
|
941 |
JVM_CONSTANT_String,
|
|
942 |
JVM_CONSTANT_Fieldref,
|
|
943 |
JVM_CONSTANT_Methodref,
|
|
944 |
JVM_CONSTANT_InterfaceMethodref,
|
|
945 |
JVM_CONSTANT_NameAndType
|
|
946 |
};
|
|
947 |
|
|
948 |
/* Used in the newarray instruction. */
|
|
949 |
|
|
950 |
#define JVM_T_BOOLEAN 4
|
|
951 |
#define JVM_T_CHAR 5
|
|
952 |
#define JVM_T_FLOAT 6
|
|
953 |
#define JVM_T_DOUBLE 7
|
|
954 |
#define JVM_T_BYTE 8
|
|
955 |
#define JVM_T_SHORT 9
|
|
956 |
#define JVM_T_INT 10
|
|
957 |
#define JVM_T_LONG 11
|
|
958 |
|
|
959 |
/* JVM method signatures */
|
|
960 |
|
|
961 |
#define JVM_SIGNATURE_ARRAY '['
|
|
962 |
#define JVM_SIGNATURE_BYTE 'B'
|
|
963 |
#define JVM_SIGNATURE_CHAR 'C'
|
|
964 |
#define JVM_SIGNATURE_CLASS 'L'
|
|
965 |
#define JVM_SIGNATURE_ENDCLASS ';'
|
|
966 |
#define JVM_SIGNATURE_ENUM 'E'
|
|
967 |
#define JVM_SIGNATURE_FLOAT 'F'
|
|
968 |
#define JVM_SIGNATURE_DOUBLE 'D'
|
|
969 |
#define JVM_SIGNATURE_FUNC '('
|
|
970 |
#define JVM_SIGNATURE_ENDFUNC ')'
|
|
971 |
#define JVM_SIGNATURE_INT 'I'
|
|
972 |
#define JVM_SIGNATURE_LONG 'J'
|
|
973 |
#define JVM_SIGNATURE_SHORT 'S'
|
|
974 |
#define JVM_SIGNATURE_VOID 'V'
|
|
975 |
#define JVM_SIGNATURE_BOOLEAN 'Z'
|
|
976 |
|
|
977 |
/*
|
|
978 |
* A function defined by the byte-code verifier and called by the VM.
|
|
979 |
* This is not a function implemented in the VM.
|
|
980 |
*
|
|
981 |
* Returns JNI_FALSE if verification fails. A detailed error message
|
|
982 |
* will be places in msg_buf, whose length is specified by buf_len.
|
|
983 |
*/
|
|
984 |
typedef jboolean (*verifier_fn_t)(JNIEnv *env,
|
|
985 |
jclass cb,
|
|
986 |
char * msg_buf,
|
|
987 |
jint buf_len);
|
|
988 |
|
|
989 |
|
|
990 |
/*
|
|
991 |
* Support for a VM-independent class format checker.
|
|
992 |
*/
|
|
993 |
typedef struct {
|
|
994 |
unsigned long code; /* byte code */
|
|
995 |
unsigned long excs; /* exceptions */
|
|
996 |
unsigned long etab; /* catch table */
|
|
997 |
unsigned long lnum; /* line number */
|
|
998 |
unsigned long lvar; /* local vars */
|
|
999 |
} method_size_info;
|
|
1000 |
|
|
1001 |
typedef struct {
|
|
1002 |
unsigned int constants; /* constant pool */
|
|
1003 |
unsigned int fields;
|
|
1004 |
unsigned int methods;
|
|
1005 |
unsigned int interfaces;
|
|
1006 |
unsigned int fields2; /* number of static 2-word fields */
|
|
1007 |
unsigned int innerclasses; /* # of records in InnerClasses attr */
|
|
1008 |
|
|
1009 |
method_size_info clinit; /* memory used in clinit */
|
|
1010 |
method_size_info main; /* used everywhere else */
|
|
1011 |
} class_size_info;
|
|
1012 |
|
|
1013 |
/*
|
|
1014 |
* Functions defined in libjava.so to perform string conversions.
|
|
1015 |
*
|
|
1016 |
*/
|
|
1017 |
|
|
1018 |
typedef jstring (*to_java_string_fn_t)(JNIEnv *env, char *str);
|
|
1019 |
|
|
1020 |
typedef char *(*to_c_string_fn_t)(JNIEnv *env, jstring s, jboolean *b);
|
|
1021 |
|
|
1022 |
/* This is the function defined in libjava.so that performs class
|
|
1023 |
* format checks. This functions fills in size information about
|
|
1024 |
* the class file and returns:
|
|
1025 |
*
|
|
1026 |
* 0: good
|
|
1027 |
* -1: out of memory
|
|
1028 |
* -2: bad format
|
|
1029 |
* -3: unsupported version
|
|
1030 |
* -4: bad class name
|
|
1031 |
*/
|
|
1032 |
|
|
1033 |
typedef jint (*check_format_fn_t)(char *class_name,
|
|
1034 |
unsigned char *data,
|
|
1035 |
unsigned int data_size,
|
|
1036 |
class_size_info *class_size,
|
|
1037 |
char *message_buffer,
|
|
1038 |
jint buffer_length,
|
|
1039 |
jboolean measure_only,
|
|
1040 |
jboolean check_relaxed);
|
|
1041 |
|
|
1042 |
#define JVM_RECOGNIZED_CLASS_MODIFIERS (JVM_ACC_PUBLIC | \
|
|
1043 |
JVM_ACC_FINAL | \
|
|
1044 |
JVM_ACC_SUPER | \
|
|
1045 |
JVM_ACC_INTERFACE | \
|
|
1046 |
JVM_ACC_ABSTRACT | \
|
|
1047 |
JVM_ACC_ANNOTATION | \
|
|
1048 |
JVM_ACC_ENUM | \
|
|
1049 |
JVM_ACC_SYNTHETIC)
|
|
1050 |
|
|
1051 |
#define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \
|
|
1052 |
JVM_ACC_PRIVATE | \
|
|
1053 |
JVM_ACC_PROTECTED | \
|
|
1054 |
JVM_ACC_STATIC | \
|
|
1055 |
JVM_ACC_FINAL | \
|
|
1056 |
JVM_ACC_VOLATILE | \
|
|
1057 |
JVM_ACC_TRANSIENT | \
|
|
1058 |
JVM_ACC_ENUM | \
|
|
1059 |
JVM_ACC_SYNTHETIC)
|
|
1060 |
|
|
1061 |
#define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \
|
|
1062 |
JVM_ACC_PRIVATE | \
|
|
1063 |
JVM_ACC_PROTECTED | \
|
|
1064 |
JVM_ACC_STATIC | \
|
|
1065 |
JVM_ACC_FINAL | \
|
|
1066 |
JVM_ACC_SYNCHRONIZED | \
|
|
1067 |
JVM_ACC_BRIDGE | \
|
|
1068 |
JVM_ACC_VARARGS | \
|
|
1069 |
JVM_ACC_NATIVE | \
|
|
1070 |
JVM_ACC_ABSTRACT | \
|
|
1071 |
JVM_ACC_STRICT | \
|
|
1072 |
JVM_ACC_SYNTHETIC)
|
|
1073 |
|
|
1074 |
/*
|
|
1075 |
* This is the function defined in libjava.so to perform path
|
|
1076 |
* canonicalization. VM call this function before opening jar files
|
|
1077 |
* to load system classes.
|
|
1078 |
*
|
|
1079 |
*/
|
|
1080 |
|
|
1081 |
typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len);
|
|
1082 |
|
|
1083 |
/*************************************************************************
|
|
1084 |
PART 3: I/O and Network Support
|
|
1085 |
************************************************************************/
|
|
1086 |
|
|
1087 |
/* Note that the JVM IO functions are expected to return JVM_IO_ERR
|
|
1088 |
* when there is any kind of error. The caller can then use the
|
|
1089 |
* platform specific support (e.g., errno) to get the detailed
|
|
1090 |
* error info. The JVM_GetLastErrorString procedure may also be used
|
|
1091 |
* to obtain a descriptive error string.
|
|
1092 |
*/
|
|
1093 |
#define JVM_IO_ERR (-1)
|
|
1094 |
|
|
1095 |
/* For interruptible IO. Returning JVM_IO_INTR indicates that an IO
|
|
1096 |
* operation has been disrupted by Thread.interrupt. There are a
|
|
1097 |
* number of technical difficulties related to interruptible IO that
|
|
1098 |
* need to be solved. For example, most existing programs do not handle
|
|
1099 |
* InterruptedIOExceptions specially, they simply treat those as any
|
|
1100 |
* IOExceptions, which typically indicate fatal errors.
|
|
1101 |
*
|
|
1102 |
* There are also two modes of operation for interruptible IO. In the
|
|
1103 |
* resumption mode, an interrupted IO operation is guaranteed not to
|
|
1104 |
* have any side-effects, and can be restarted. In the termination mode,
|
|
1105 |
* an interrupted IO operation corrupts the underlying IO stream, so
|
|
1106 |
* that the only reasonable operation on an interrupted stream is to
|
|
1107 |
* close that stream. The resumption mode seems to be impossible to
|
|
1108 |
* implement on Win32 and Solaris. Implementing the termination mode is
|
|
1109 |
* easier, but it's not clear that's the right semantics.
|
|
1110 |
*
|
|
1111 |
* Interruptible IO is not supported on Win32.It can be enabled/disabled
|
|
1112 |
* using a compile-time flag on Solaris. Third-party JVM ports do not
|
|
1113 |
* need to implement interruptible IO.
|
|
1114 |
*/
|
|
1115 |
#define JVM_IO_INTR (-2)
|
|
1116 |
|
|
1117 |
/* Write a string into the given buffer, in the platform's local encoding,
|
|
1118 |
* that describes the most recent system-level error to occur in this thread.
|
|
1119 |
* Return the length of the string or zero if no error occurred.
|
|
1120 |
*/
|
|
1121 |
JNIEXPORT jint JNICALL
|
|
1122 |
JVM_GetLastErrorString(char *buf, int len);
|
|
1123 |
|
|
1124 |
/*
|
|
1125 |
* Convert a pathname into native format. This function does syntactic
|
|
1126 |
* cleanup, such as removing redundant separator characters. It modifies
|
|
1127 |
* the given pathname string in place.
|
|
1128 |
*/
|
|
1129 |
JNIEXPORT char * JNICALL
|
|
1130 |
JVM_NativePath(char *);
|
|
1131 |
|
|
1132 |
/*
|
|
1133 |
* JVM I/O error codes
|
|
1134 |
*/
|
|
1135 |
#define JVM_EEXIST -100
|
|
1136 |
|
|
1137 |
/*
|
|
1138 |
* Open a file descriptor. This function returns a negative error code
|
|
1139 |
* on error, and a non-negative integer that is the file descriptor on
|
|
1140 |
* success.
|
|
1141 |
*/
|
|
1142 |
JNIEXPORT jint JNICALL
|
|
1143 |
JVM_Open(const char *fname, jint flags, jint mode);
|
|
1144 |
|
|
1145 |
/*
|
|
1146 |
* Close a file descriptor. This function returns -1 on error, and 0
|
|
1147 |
* on success.
|
|
1148 |
*
|
|
1149 |
* fd the file descriptor to close.
|
|
1150 |
*/
|
|
1151 |
JNIEXPORT jint JNICALL
|
|
1152 |
JVM_Close(jint fd);
|
|
1153 |
|
|
1154 |
/*
|
|
1155 |
* Read data from a file decriptor into a char array.
|
|
1156 |
*
|
|
1157 |
* fd the file descriptor to read from.
|
|
1158 |
* buf the buffer where to put the read data.
|
|
1159 |
* nbytes the number of bytes to read.
|
|
1160 |
*
|
|
1161 |
* This function returns -1 on error, and 0 on success.
|
|
1162 |
*/
|
|
1163 |
JNIEXPORT jint JNICALL
|
|
1164 |
JVM_Read(jint fd, char *buf, jint nbytes);
|
|
1165 |
|
|
1166 |
/*
|
|
1167 |
* Write data from a char array to a file decriptor.
|
|
1168 |
*
|
|
1169 |
* fd the file descriptor to read from.
|
|
1170 |
* buf the buffer from which to fetch the data.
|
|
1171 |
* nbytes the number of bytes to write.
|
|
1172 |
*
|
|
1173 |
* This function returns -1 on error, and 0 on success.
|
|
1174 |
*/
|
|
1175 |
JNIEXPORT jint JNICALL
|
|
1176 |
JVM_Write(jint fd, char *buf, jint nbytes);
|
|
1177 |
|
|
1178 |
/*
|
|
1179 |
* Returns the number of bytes available for reading from a given file
|
|
1180 |
* descriptor
|
|
1181 |
*/
|
|
1182 |
JNIEXPORT jint JNICALL
|
|
1183 |
JVM_Available(jint fd, jlong *pbytes);
|
|
1184 |
|
|
1185 |
/*
|
|
1186 |
* Move the file descriptor pointer from whence by offset.
|
|
1187 |
*
|
|
1188 |
* fd the file descriptor to move.
|
|
1189 |
* offset the number of bytes to move it by.
|
|
1190 |
* whence the start from where to move it.
|
|
1191 |
*
|
|
1192 |
* This function returns the resulting pointer location.
|
|
1193 |
*/
|
|
1194 |
JNIEXPORT jlong JNICALL
|
|
1195 |
JVM_Lseek(jint fd, jlong offset, jint whence);
|
|
1196 |
|
|
1197 |
/*
|
|
1198 |
* Set the length of the file associated with the given descriptor to the given
|
|
1199 |
* length. If the new length is longer than the current length then the file
|
|
1200 |
* is extended; the contents of the extended portion are not defined. The
|
|
1201 |
* value of the file pointer is undefined after this procedure returns.
|
|
1202 |
*/
|
|
1203 |
JNIEXPORT jint JNICALL
|
|
1204 |
JVM_SetLength(jint fd, jlong length);
|
|
1205 |
|
|
1206 |
/*
|
|
1207 |
* Synchronize the file descriptor's in memory state with that of the
|
|
1208 |
* physical device. Return of -1 is an error, 0 is OK.
|
|
1209 |
*/
|
|
1210 |
JNIEXPORT jint JNICALL
|
|
1211 |
JVM_Sync(jint fd);
|
|
1212 |
|
|
1213 |
/*
|
|
1214 |
* Networking library support
|
|
1215 |
*/
|
|
1216 |
|
|
1217 |
JNIEXPORT jint JNICALL
|
|
1218 |
JVM_InitializeSocketLibrary(void);
|
|
1219 |
|
|
1220 |
struct sockaddr;
|
|
1221 |
|
|
1222 |
JNIEXPORT jint JNICALL
|
|
1223 |
JVM_Socket(jint domain, jint type, jint protocol);
|
|
1224 |
|
|
1225 |
JNIEXPORT jint JNICALL
|
|
1226 |
JVM_SocketClose(jint fd);
|
|
1227 |
|
|
1228 |
JNIEXPORT jint JNICALL
|
|
1229 |
JVM_SocketShutdown(jint fd, jint howto);
|
|
1230 |
|
|
1231 |
JNIEXPORT jint JNICALL
|
|
1232 |
JVM_Recv(jint fd, char *buf, jint nBytes, jint flags);
|
|
1233 |
|
|
1234 |
JNIEXPORT jint JNICALL
|
|
1235 |
JVM_Send(jint fd, char *buf, jint nBytes, jint flags);
|
|
1236 |
|
|
1237 |
JNIEXPORT jint JNICALL
|
|
1238 |
JVM_Timeout(int fd, long timeout);
|
|
1239 |
|
|
1240 |
JNIEXPORT jint JNICALL
|
|
1241 |
JVM_Listen(jint fd, jint count);
|
|
1242 |
|
|
1243 |
JNIEXPORT jint JNICALL
|
|
1244 |
JVM_Connect(jint fd, struct sockaddr *him, jint len);
|
|
1245 |
|
|
1246 |
JNIEXPORT jint JNICALL
|
|
1247 |
JVM_Bind(jint fd, struct sockaddr *him, jint len);
|
|
1248 |
|
|
1249 |
JNIEXPORT jint JNICALL
|
|
1250 |
JVM_Accept(jint fd, struct sockaddr *him, jint *len);
|
|
1251 |
|
|
1252 |
JNIEXPORT jint JNICALL
|
|
1253 |
JVM_RecvFrom(jint fd, char *buf, int nBytes,
|
|
1254 |
int flags, struct sockaddr *from, int *fromlen);
|
|
1255 |
|
|
1256 |
JNIEXPORT jint JNICALL
|
|
1257 |
JVM_SendTo(jint fd, char *buf, int len,
|
|
1258 |
int flags, struct sockaddr *to, int tolen);
|
|
1259 |
|
|
1260 |
JNIEXPORT jint JNICALL
|
|
1261 |
JVM_SocketAvailable(jint fd, jint *result);
|
|
1262 |
|
|
1263 |
|
|
1264 |
JNIEXPORT jint JNICALL
|
|
1265 |
JVM_GetSockName(jint fd, struct sockaddr *him, int *len);
|
|
1266 |
|
|
1267 |
JNIEXPORT jint JNICALL
|
|
1268 |
JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen);
|
|
1269 |
|
|
1270 |
JNIEXPORT jint JNICALL
|
|
1271 |
JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen);
|
|
1272 |
|
|
1273 |
/*
|
|
1274 |
* These routines are only reentrant on Windows
|
|
1275 |
*/
|
|
1276 |
|
|
1277 |
#ifdef _WINDOWS
|
|
1278 |
|
|
1279 |
JNIEXPORT struct protoent * JNICALL
|
|
1280 |
JVM_GetProtoByName(char* name);
|
|
1281 |
|
|
1282 |
JNIEXPORT struct hostent* JNICALL
|
|
1283 |
JVM_GetHostByAddr(const char* name, int len, int type);
|
|
1284 |
|
|
1285 |
JNIEXPORT struct hostent* JNICALL
|
|
1286 |
JVM_GetHostByName(char* name);
|
|
1287 |
|
|
1288 |
#endif /* _WINDOWS */
|
|
1289 |
|
|
1290 |
JNIEXPORT int JNICALL
|
|
1291 |
JVM_GetHostName(char* name, int namelen);
|
|
1292 |
|
|
1293 |
/*
|
|
1294 |
* The standard printing functions supported by the Java VM. (Should they
|
|
1295 |
* be renamed to JVM_* in the future?
|
|
1296 |
*/
|
|
1297 |
|
|
1298 |
/*
|
|
1299 |
* BE CAREFUL! The following functions do not implement the
|
|
1300 |
* full feature set of standard C printf formats.
|
|
1301 |
*/
|
|
1302 |
int
|
|
1303 |
jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
|
|
1304 |
|
|
1305 |
int
|
|
1306 |
jio_snprintf(char *str, size_t count, const char *fmt, ...);
|
|
1307 |
|
|
1308 |
int
|
|
1309 |
jio_fprintf(FILE *, const char *fmt, ...);
|
|
1310 |
|
|
1311 |
int
|
|
1312 |
jio_vfprintf(FILE *, const char *fmt, va_list args);
|
|
1313 |
|
|
1314 |
|
|
1315 |
JNIEXPORT void * JNICALL
|
|
1316 |
JVM_RawMonitorCreate(void);
|
|
1317 |
|
|
1318 |
JNIEXPORT void JNICALL
|
|
1319 |
JVM_RawMonitorDestroy(void *mon);
|
|
1320 |
|
|
1321 |
JNIEXPORT jint JNICALL
|
|
1322 |
JVM_RawMonitorEnter(void *mon);
|
|
1323 |
|
|
1324 |
JNIEXPORT void JNICALL
|
|
1325 |
JVM_RawMonitorExit(void *mon);
|
|
1326 |
|
|
1327 |
|
|
1328 |
#ifdef SUPPORT_OLD_REFLECTION
|
|
1329 |
|
|
1330 |
/*
|
|
1331 |
* Support for old native code-based (pre-JDK 1.4) reflection implementation.
|
|
1332 |
* Disabled by default in the product build.
|
|
1333 |
*
|
|
1334 |
* See reflection.hpp for information on SUPPORT_OLD_REFLECTION
|
|
1335 |
*/
|
|
1336 |
|
|
1337 |
/*
|
|
1338 |
* reflecting fields and methods.
|
|
1339 |
* which: 0 --- MEMBER_PUBLIC
|
|
1340 |
* 1 --- MEMBER_DECLARED
|
|
1341 |
* NOTE: absent in product build by default
|
|
1342 |
*/
|
|
1343 |
|
|
1344 |
JNIEXPORT jobjectArray JNICALL
|
|
1345 |
JVM_GetClassFields(JNIEnv *env, jclass cls, jint which);
|
|
1346 |
|
|
1347 |
JNIEXPORT jobjectArray JNICALL
|
|
1348 |
JVM_GetClassMethods(JNIEnv *env, jclass cls, jint which);
|
|
1349 |
|
|
1350 |
JNIEXPORT jobjectArray JNICALL
|
|
1351 |
JVM_GetClassConstructors(JNIEnv *env, jclass cls, jint which);
|
|
1352 |
|
|
1353 |
JNIEXPORT jobject JNICALL
|
|
1354 |
JVM_GetClassField(JNIEnv *env, jclass cls, jstring name, jint which);
|
|
1355 |
|
|
1356 |
JNIEXPORT jobject JNICALL
|
|
1357 |
JVM_GetClassMethod(JNIEnv *env, jclass cls, jstring name, jobjectArray types,
|
|
1358 |
jint which);
|
|
1359 |
JNIEXPORT jobject JNICALL
|
|
1360 |
JVM_GetClassConstructor(JNIEnv *env, jclass cls, jobjectArray types,
|
|
1361 |
jint which);
|
|
1362 |
|
|
1363 |
/*
|
|
1364 |
* Implements Class.newInstance
|
|
1365 |
*/
|
|
1366 |
JNIEXPORT jobject JNICALL
|
|
1367 |
JVM_NewInstance(JNIEnv *env, jclass cls);
|
|
1368 |
|
|
1369 |
/*
|
|
1370 |
* java.lang.reflect.Field
|
|
1371 |
*/
|
|
1372 |
JNIEXPORT jobject JNICALL
|
|
1373 |
JVM_GetField(JNIEnv *env, jobject field, jobject obj);
|
|
1374 |
|
|
1375 |
JNIEXPORT jvalue JNICALL
|
|
1376 |
JVM_GetPrimitiveField(JNIEnv *env, jobject field, jobject obj,
|
|
1377 |
unsigned char wCode);
|
|
1378 |
|
|
1379 |
JNIEXPORT void JNICALL
|
|
1380 |
JVM_SetField(JNIEnv *env, jobject field, jobject obj, jobject val);
|
|
1381 |
|
|
1382 |
JNIEXPORT void JNICALL
|
|
1383 |
JVM_SetPrimitiveField(JNIEnv *env, jobject field, jobject obj, jvalue v,
|
|
1384 |
unsigned char vCode);
|
|
1385 |
|
|
1386 |
/*
|
|
1387 |
* java.lang.reflect.Method
|
|
1388 |
*/
|
|
1389 |
JNIEXPORT jobject JNICALL
|
|
1390 |
JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0);
|
|
1391 |
|
|
1392 |
/*
|
|
1393 |
* java.lang.reflect.Constructor
|
|
1394 |
*/
|
|
1395 |
JNIEXPORT jobject JNICALL
|
|
1396 |
JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0);
|
|
1397 |
|
|
1398 |
#endif /* SUPPORT_OLD_REFLECTION */
|
|
1399 |
|
|
1400 |
/*
|
|
1401 |
* java.lang.management support
|
|
1402 |
*/
|
|
1403 |
JNIEXPORT void* JNICALL
|
|
1404 |
JVM_GetManagement(jint version);
|
|
1405 |
|
|
1406 |
/*
|
|
1407 |
* com.sun.tools.attach.VirtualMachine support
|
|
1408 |
*
|
|
1409 |
* Initialize the agent properties with the properties maintained in the VM.
|
|
1410 |
*/
|
|
1411 |
JNIEXPORT jobject JNICALL
|
|
1412 |
JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
|
|
1413 |
|
|
1414 |
/* Generics reflection support.
|
|
1415 |
*
|
|
1416 |
* Returns information about the given class's EnclosingMethod
|
|
1417 |
* attribute, if present, or null if the class had no enclosing
|
|
1418 |
* method.
|
|
1419 |
*
|
|
1420 |
* If non-null, the returned array contains three elements. Element 0
|
|
1421 |
* is the java.lang.Class of which the enclosing method is a member,
|
|
1422 |
* and elements 1 and 2 are the java.lang.Strings for the enclosing
|
|
1423 |
* method's name and descriptor, respectively.
|
|
1424 |
*/
|
|
1425 |
JNIEXPORT jobjectArray JNICALL
|
|
1426 |
JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass);
|
|
1427 |
|
|
1428 |
/*
|
|
1429 |
* Java thread state support
|
|
1430 |
*/
|
|
1431 |
enum {
|
|
1432 |
JAVA_THREAD_STATE_NEW = 0,
|
|
1433 |
JAVA_THREAD_STATE_RUNNABLE = 1,
|
|
1434 |
JAVA_THREAD_STATE_BLOCKED = 2,
|
|
1435 |
JAVA_THREAD_STATE_WAITING = 3,
|
|
1436 |
JAVA_THREAD_STATE_TIMED_WAITING = 4,
|
|
1437 |
JAVA_THREAD_STATE_TERMINATED = 5,
|
|
1438 |
JAVA_THREAD_STATE_COUNT = 6
|
|
1439 |
};
|
|
1440 |
|
|
1441 |
/*
|
|
1442 |
* Returns an array of the threadStatus values representing the
|
|
1443 |
* given Java thread state. Returns NULL if the VM version is
|
|
1444 |
* incompatible with the JDK or doesn't support the given
|
|
1445 |
* Java thread state.
|
|
1446 |
*/
|
|
1447 |
JNIEXPORT jintArray JNICALL
|
|
1448 |
JVM_GetThreadStateValues(JNIEnv* env, jint javaThreadState);
|
|
1449 |
|
|
1450 |
/*
|
|
1451 |
* Returns an array of the substate names representing the
|
|
1452 |
* given Java thread state. Returns NULL if the VM version is
|
|
1453 |
* incompatible with the JDK or the VM doesn't support
|
|
1454 |
* the given Java thread state.
|
|
1455 |
* values must be the jintArray returned from JVM_GetThreadStateValues
|
|
1456 |
* and javaThreadState.
|
|
1457 |
*/
|
|
1458 |
JNIEXPORT jobjectArray JNICALL
|
|
1459 |
JVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values);
|
|
1460 |
|
|
1461 |
/* =========================================================================
|
|
1462 |
* The following defines a private JVM interface that the JDK can query
|
|
1463 |
* for the JVM version and capabilities. sun.misc.Version defines
|
|
1464 |
* the methods for getting the VM version and its capabilities.
|
|
1465 |
*
|
|
1466 |
* When a new bit is added, the following should be updated to provide
|
|
1467 |
* access to the new capability:
|
|
1468 |
* HS: JVM_GetVersionInfo and Abstract_VM_Version class
|
|
1469 |
* SDK: Version class
|
|
1470 |
*
|
|
1471 |
* Similary, a private JDK interface JDK_GetVersionInfo0 is defined for
|
|
1472 |
* JVM to query for the JDK version and capabilities.
|
|
1473 |
*
|
|
1474 |
* When a new bit is added, the following should be updated to provide
|
|
1475 |
* access to the new capability:
|
|
1476 |
* HS: JDK_Version class
|
|
1477 |
* SDK: JDK_GetVersionInfo0
|
|
1478 |
*
|
|
1479 |
* ==========================================================================
|
|
1480 |
*/
|
|
1481 |
typedef struct {
|
|
1482 |
/* HotSpot Express VM version string:
|
|
1483 |
* <major>.<minor>-bxx[-<identifier>][-<debug_flavor>]
|
|
1484 |
*/
|
|
1485 |
unsigned int jvm_version; /* Consists of major.minor.0.build */
|
|
1486 |
unsigned int update_version : 8; /* 0 in HotSpot Express VM */
|
|
1487 |
unsigned int special_update_version : 8; /* 0 in HotSpot Express VM */
|
|
1488 |
unsigned int reserved1 : 16;
|
|
1489 |
unsigned int reserved2;
|
|
1490 |
|
|
1491 |
/* The following bits represents JVM supports that JDK has dependency on.
|
|
1492 |
* JDK can use these bits to determine which JVM version
|
|
1493 |
* and support it has to maintain runtime compatibility.
|
|
1494 |
*
|
|
1495 |
* When a new bit is added in a minor or update release, make sure
|
|
1496 |
* the new bit is also added in the main/baseline.
|
|
1497 |
*/
|
|
1498 |
unsigned int is_attachable : 1;
|
|
1499 |
unsigned int is_kernel_jvm : 1;
|
|
1500 |
unsigned int : 30;
|
|
1501 |
unsigned int : 32;
|
|
1502 |
unsigned int : 32;
|
|
1503 |
} jvm_version_info;
|
|
1504 |
|
|
1505 |
#define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
|
|
1506 |
#define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
|
|
1507 |
// Micro version is 0 in HotSpot Express VM (set in jvm.cpp).
|
|
1508 |
#define JVM_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8)
|
|
1509 |
/* Build number is available in all HotSpot Express VM builds.
|
|
1510 |
* It is defined in make/hotspot_version file.
|
|
1511 |
*/
|
|
1512 |
#define JVM_VERSION_BUILD(version) ((version & 0x000000FF))
|
|
1513 |
|
|
1514 |
JNIEXPORT void JNICALL
|
|
1515 |
JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size);
|
|
1516 |
|
|
1517 |
typedef struct {
|
|
1518 |
// Naming convention of RE build version string: n.n.n[_uu[c]][-<identifier>]-bxx
|
|
1519 |
unsigned int jdk_version; /* Consists of major, minor, micro (n.n.n) */
|
|
1520 |
/* and build number (xx) */
|
|
1521 |
unsigned int update_version : 8; /* Update release version (uu) */
|
|
1522 |
unsigned int special_update_version : 8; /* Special update release version (c)*/
|
|
1523 |
unsigned int reserved1 : 16;
|
|
1524 |
unsigned int reserved2;
|
|
1525 |
|
|
1526 |
/* The following bits represents new JDK supports that VM has dependency on.
|
|
1527 |
* VM implementation can use these bits to determine which JDK version
|
|
1528 |
* and support it has to maintain runtime compatibility.
|
|
1529 |
*
|
|
1530 |
* When a new bit is added in a minor or update release, make sure
|
|
1531 |
* the new bit is also added in the main/baseline.
|
|
1532 |
*/
|
|
1533 |
unsigned int thread_park_blocker : 1;
|
|
1534 |
unsigned int : 31;
|
|
1535 |
unsigned int : 32;
|
|
1536 |
unsigned int : 32;
|
|
1537 |
} jdk_version_info;
|
|
1538 |
|
|
1539 |
#define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
|
|
1540 |
#define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
|
|
1541 |
#define JDK_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8)
|
|
1542 |
|
|
1543 |
/* Build number is available only for RE build (i.e. JDK_BUILD_NUMBER is set to bNN)
|
|
1544 |
* It will be zero for internal builds.
|
|
1545 |
*/
|
|
1546 |
#define JDK_VERSION_BUILD(version) ((version & 0x000000FF))
|
|
1547 |
|
|
1548 |
/*
|
|
1549 |
* This is the function JDK_GetVersionInfo0 defined in libjava.so
|
|
1550 |
* that is dynamically looked up by JVM.
|
|
1551 |
*/
|
|
1552 |
typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size);
|
|
1553 |
|
|
1554 |
/*
|
|
1555 |
* This structure is used by the launcher to get the default thread
|
|
1556 |
* stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a
|
|
1557 |
* version of 1.1. As it is not supported otherwise, it has been removed
|
|
1558 |
* from jni.h
|
|
1559 |
*/
|
|
1560 |
typedef struct JDK1_1InitArgs {
|
|
1561 |
jint version;
|
|
1562 |
|
|
1563 |
char **properties;
|
|
1564 |
jint checkSource;
|
|
1565 |
jint nativeStackSize;
|
|
1566 |
jint javaStackSize;
|
|
1567 |
jint minHeapSize;
|
|
1568 |
jint maxHeapSize;
|
|
1569 |
jint verifyMode;
|
|
1570 |
char *classpath;
|
|
1571 |
|
|
1572 |
jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args);
|
|
1573 |
void (JNICALL *exit)(jint code);
|
|
1574 |
void (JNICALL *abort)(void);
|
|
1575 |
|
|
1576 |
jint enableClassGC;
|
|
1577 |
jint enableVerboseGC;
|
|
1578 |
jint disableAsyncGC;
|
|
1579 |
jint verbose;
|
|
1580 |
jboolean debugging;
|
|
1581 |
jint debugPort;
|
|
1582 |
} JDK1_1InitArgs;
|
|
1583 |
|
|
1584 |
#ifdef __cplusplus
|
|
1585 |
} /* extern "C" */
|
|
1586 |
#endif /* __cplusplus */
|
|
1587 |
|
|
1588 |
#endif /* !_JAVASOFT_JVM_H_ */
|