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