1 /* Copyright (C) 2000 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 /* Note: this file must be compilable by the C compiler (for now,
10 assuming GNU C is ok). This means you must never use `//'
11 comments, and all C++-specific code must be conditional on
14 #ifndef __GCJ_JVMPI_H__
15 #define __GCJ_JVMPI_H__
19 /* JVMPI version numbers. FIXME: this is a semi-random number. The
20 documentation doesn't say what it should be. */
21 #define JVMPI_VERSION_1 0x00020001
23 /* JVMPI return codes. FIXME: These are semi-random numbers. The
24 documentation doesn't say what they should be. */
25 #define JVMPI_SUCCESS 0
27 #define JVMPI_NOT_AVAILABLE 2
29 /* An opaque pointer representing an object ID. */
31 typedef struct _jobjectID
* jobjectID
;
35 /* Source line number. */
37 /* Method being executed. */
44 /* Number of frames in the call trace. */
46 /* An array of frames representing the trace. Callees first. */
47 JVMPI_CallFrame
*frames
;
52 /* Name of the field. */
54 /* Signature of the field. */
55 char *field_signature
;
58 /* The documentation doesn't actually specify what the
59 JVMPI_DUMP_LEVEL macros should be defined to. Here's a reasonable
61 #define JVMPI_DUMP_LEVEL_0 0
62 #define JVMPI_DUMP_LEVEL_1 1
63 #define JVMPI_DUMP_LEVEL_2 2
64 #define JVMPI_DUMP_LEVEL_3 3
68 /* One of JVMPI_DUMP_LEVEL_0, JVMPI_DUMP_LEVEL_1 or
69 JVMPI_DUMP_LEVEL_2. */
75 /* Offset from the beginning of the method. */
77 /* Line number from the beginning of the source file. */
83 /* Name of the method. */
85 /* Signature of the method. */
86 char *method_signature
;
87 /* Start line number from the beginning of the source file. */
89 /* End line number from the beginning of the source file. */
95 /* An opaque pointer representing a raw monitor. */
96 struct _JVMPI_RawMonitor
;
97 typedef struct _JVMPI_RawMonitor
*JVMPI_RawMonitor
;
99 /* JVMPI event codes. FIXME: These are semi-random numbers. The
100 documentation doesn't say what they should be. */
101 #define JVMPI_EVENT_ARENA_DELETE 0
102 #define JVMPI_EVENT_ARENA_NEW 1
103 #define JVMPI_EVENT_CLASS_LOAD 2
104 #define JVMPI_EVENT_CLASS_LOAD_HOOK 3
105 #define JVMPI_EVENT_CLASS_UNLOAD 4
106 #define JVMPI_EVENT_COMPILED_METHOD_LOAD 5
107 #define JVMPI_EVENT_COMPILED_METHOD_UNLOAD 6
108 #define JVMPI_EVENT_DATA_DUMP_REQUEST 7
109 #define JVMPI_EVENT_DATA_RESET_REQUEST 8
110 #define JVMPI_EVENT_GC_FINISH 9
111 #define JVMPI_EVENT_GC_START 10
112 #define JVMPI_EVENT_HEAP_DUMP 11
113 #define JVMPI_EVENT_JNI_GLOBALREF_ALLOC 12
114 #define JVMPI_EVENT_JNI_GLOBALREF_FREE 13
115 #define JVMPI_EVENT_JNI_WEAK_GLOBALREF_ALLOC 14
116 #define JVMPI_EVENT_JNI_WEAK_GLOBALREF_FREE 15
117 #define JVMPI_EVENT_JVM_INIT_DONE 16
118 #define JVMPI_EVENT_JVM_SHUT_DOWN 17
119 #define JVMPI_EVENT_METHOD_ENTRY 18
120 #define JVMPI_EVENT_METHOD_ENTRY2 19
121 #define JVMPI_EVENT_METHOD_EXIT 20
122 #define JVMPI_EVENT_MONITOR_CONTENDED_ENTER 21
123 #define JVMPI_EVENT_MONITOR_CONTENDED_ENTERED 22
124 #define JVMPI_EVENT_MONITOR_CONTENDED_EXIT 23
125 #define JVMPI_EVENT_MONITOR_DUMP 24
126 #define JVMPI_EVENT_MONITOR_WAIT 25
127 #define JVMPI_EVENT_MONITOR_WAITED 26
128 #define JVMPI_EVENT_OBJECT_ALLOC 27
129 #define JVMPI_EVENT_OBJECT_DUMP 28
130 #define JVMPI_EVENT_OBJECT_FREE 29
131 #define JVMPI_EVENT_OBJECT_MOVE 30
132 #define JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTER 31
133 #define JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTERED 32
134 #define JVMPI_EVENT_RAW_MONITOR_CONTENDED_EXIT 33
135 #define JVMPI_EVENT_THREAD_END 34
136 #define JVMPI_EVENT_THREAD_START 35
137 #define JVMPI_EVENT_INSTRUCTION_START 36
145 /* Evn where this event occurred. */
156 JVMPI_Method
*methods
;
157 jint num_static_fields
;
158 JVMPI_Field
*statics
;
159 jint num_instance_fields
;
160 JVMPI_Field
*instances
;
184 JNIEnv
*thread_env_id
;
193 /* JVMPI version number. */
196 /* Implemented by the user... */
197 void (*NotifyEvent
) (JVMPI_Event
*event
);
199 /* Implemented by the runtime... */
200 jint (*EnableEvent
) (jint event_type
, void *arg
);
201 jint (*DisableEvent
) (jint event_type
, void *arg
);
202 jint (*RequestEvent
) (jint event_type
, void *arg
);
203 void (*GetCallTrace
) (JVMPI_CallTrace
*trace
, jint depth
);
204 void (*ProfilerExit
) (jint
);
205 JVMPI_RawMonitor (*RawMonitorCreate
) (char *lock_name
);
206 void (*RawMonitorEnter
) (JVMPI_RawMonitor lock_id
);
207 void (*RawMonitorExit
) (JVMPI_RawMonitor lock_id
);
208 void (*RawMonitorWait
) (JVMPI_RawMonitor lock_id
, jlong ms
);
209 void (*RawMonitorNotifyAll
) (JVMPI_RawMonitor lock_id
);
210 void (*RawMonitorDestroy
) (JVMPI_RawMonitor lock_id
);
211 jlong (*GetCurrentThreadCpuTime
) (void);
212 void (*SuspendThread
) (JNIEnv
*env
);
213 void (*ResumeThread
) (JNIEnv
*env
);
214 jint (*GetThreadStatus
) (JNIEnv
*env
);
215 jboolean (*ThreadHasRun
) (JNIEnv
*env
);
216 jint (*CreateSystemThread
) (char *name
, jint priority
, void (*f
) (void *));
217 void (*SetThreadLocalStorage
) (JNIEnv
*env_id
, void *ptr
);
218 void *(*GetThreadLocalStorage
) (JNIEnv
*env_id
);
219 void (*DisableGC
) (void);
220 void (*EnableGC
) (void);
221 void (*RunGC
) (void);
222 jobjectID (*GetThreadObject
) (JNIEnv
*env
);
223 jobjectID (*GetMethodClass
) (jmethodID mid
);
227 #endif /* __GCJ_JVMPI_H__ */