| OLD | NEW |
| 1 /* | 1 /* |
| 2 This file is provided under a dual BSD/GPLv2 license. When using or | 2 This file is provided under a dual BSD/GPLv2 license. When using or |
| 3 redistributing this file, you may do so under either license. | 3 redistributing this file, you may do so under either license. |
| 4 | 4 |
| 5 GPL LICENSE SUMMARY | 5 GPL LICENSE SUMMARY |
| 6 | 6 |
| 7 Copyright (c) 2005-2012 Intel Corporation. All rights reserved. | 7 Copyright (c) 2005-2012 Intel Corporation. All rights reserved. |
| 8 | 8 |
| 9 This program is free software; you can redistribute it and/or modify | 9 This program is free software; you can redistribute it and/or modify |
| 10 it under the terms of version 2 of the GNU General Public License as | 10 it under the terms of version 2 of the GNU General Public License as |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 /* | 61 /* |
| 62 * Various constants used by functions | 62 * Various constants used by functions |
| 63 */ | 63 */ |
| 64 | 64 |
| 65 /* event notification */ | 65 /* event notification */ |
| 66 typedef enum iJIT_jvm_event | 66 typedef enum iJIT_jvm_event |
| 67 { | 67 { |
| 68 | 68 |
| 69 /* shutdown */ | 69 /* shutdown */ |
| 70 | 70 |
| 71 /* | 71 /* |
| 72 * Program exiting EventSpecificData NA | 72 * Program exiting EventSpecificData NA |
| 73 */ | 73 */ |
| 74 iJVM_EVENT_TYPE_SHUTDOWN = 2, | 74 iJVM_EVENT_TYPE_SHUTDOWN = 2, |
| 75 | 75 |
| 76 /* JIT profiling */ | 76 /* JIT profiling */ |
| 77 | 77 |
| 78 /* | 78 /* |
| 79 * issued after method code jitted into memory but before code is executed | 79 * issued after method code jitted into memory but before code is executed |
| 80 * EventSpecificData is an iJIT_Method_Load | 80 * EventSpecificData is an iJIT_Method_Load |
| 81 */ | 81 */ |
| 82 iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED=13, | 82 iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED=13, |
| 83 | 83 |
| 84 /* issued before unload. Method code will no longer be executed, but code | 84 /* issued before unload. Method code will no longer be executed, but code |
| 85 * and info are still in memory. The VTune profiler may capture method | 85 * and info are still in memory. The VTune profiler may capture method |
| 86 * code only at this point EventSpecificData is iJIT_Method_Id | 86 * code only at this point EventSpecificData is iJIT_Method_Id |
| 87 */ | 87 */ |
| 88 iJVM_EVENT_TYPE_METHOD_UNLOAD_START, | 88 iJVM_EVENT_TYPE_METHOD_UNLOAD_START, |
| 89 | 89 |
| 90 /* Method Profiling */ | 90 /* Method Profiling */ |
| 91 | 91 |
| 92 /* method name, Id and stack is supplied | 92 /* method name, Id and stack is supplied |
| 93 * issued when a method is about to be entered EventSpecificData is | 93 * issued when a method is about to be entered EventSpecificData is |
| 94 * iJIT_Method_NIDS | 94 * iJIT_Method_NIDS |
| 95 */ | 95 */ |
| 96 iJVM_EVENT_TYPE_ENTER_NIDS = 19, | 96 iJVM_EVENT_TYPE_ENTER_NIDS = 19, |
| 97 | 97 |
| 98 /* method name, Id and stack is supplied | 98 /* method name, Id and stack is supplied |
| 99 * issued when a method is about to be left EventSpecificData is | 99 * issued when a method is about to be left EventSpecificData is |
| 100 * iJIT_Method_NIDS | 100 * iJIT_Method_NIDS |
| 101 */ | 101 */ |
| 102 iJVM_EVENT_TYPE_LEAVE_NIDS | 102 iJVM_EVENT_TYPE_LEAVE_NIDS |
| 103 } iJIT_JVM_EVENT; | 103 } iJIT_JVM_EVENT; |
| 104 | 104 |
| 105 typedef enum _iJIT_ModeFlags | 105 typedef enum _iJIT_ModeFlags |
| 106 { | 106 { |
| 107 /* No need to Notify VTune, since VTune is not running */ | 107 /* No need to Notify VTune, since VTune is not running */ |
| 108 iJIT_NO_NOTIFICATIONS = 0x0000, | 108 iJIT_NO_NOTIFICATIONS = 0x0000, |
| 109 | 109 |
| 110 /* when turned on the jit must call | 110 /* when turned on the jit must call |
| 111 * iJIT_NotifyEvent | 111 * iJIT_NotifyEvent |
| 112 * ( | 112 * ( |
| 113 * iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, | 113 * iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, |
| 114 * ) | 114 * ) |
| 115 * for all the method already jitted | 115 * for all the method already jitted |
| 116 */ | 116 */ |
| 117 iJIT_BE_NOTIFY_ON_LOAD = 0x0001, | 117 iJIT_BE_NOTIFY_ON_LOAD = 0x0001, |
| 118 | 118 |
| 119 /* when turned on the jit must call | 119 /* when turned on the jit must call |
| 120 * iJIT_NotifyEvent | 120 * iJIT_NotifyEvent |
| 121 * ( | 121 * ( |
| 122 * iJVM_EVENT_TYPE_METHOD_UNLOAD_FINISHED, | 122 * iJVM_EVENT_TYPE_METHOD_UNLOAD_FINISHED, |
| 123 * ) for all the method that are unloaded | 123 * ) for all the method that are unloaded |
| 124 */ | 124 */ |
| 125 iJIT_BE_NOTIFY_ON_UNLOAD = 0x0002, | 125 iJIT_BE_NOTIFY_ON_UNLOAD = 0x0002, |
| 126 | 126 |
| 127 /* when turned on the jit must instrument all | 127 /* when turned on the jit must instrument all |
| 128 * the currently jited code with calls on | 128 * the currently jited code with calls on |
| 129 * method entries | 129 * method entries |
| 130 */ | 130 */ |
| 131 iJIT_BE_NOTIFY_ON_METHOD_ENTRY = 0x0004, | 131 iJIT_BE_NOTIFY_ON_METHOD_ENTRY = 0x0004, |
| 132 | 132 |
| 133 /* when turned on the jit must instrument all | 133 /* when turned on the jit must instrument all |
| 134 * the currently jited code with calls | 134 * the currently jited code with calls |
| 135 * on method exit | 135 * on method exit |
| 136 */ | 136 */ |
| 137 iJIT_BE_NOTIFY_ON_METHOD_EXIT = 0x0008 | 137 iJIT_BE_NOTIFY_ON_METHOD_EXIT = 0x0008 |
| 138 | 138 |
| 139 } iJIT_ModeFlags; | 139 } iJIT_ModeFlags; |
| 140 | 140 |
| 141 | 141 |
| 142 /* Flags used by iJIT_IsProfilingActive() */ | 142 /* Flags used by iJIT_IsProfilingActive() */ |
| 143 typedef enum _iJIT_IsProfilingActiveFlags | 143 typedef enum _iJIT_IsProfilingActiveFlags |
| 144 { | 144 { |
| 145 /* No profiler is running. Currently not used */ | 145 /* No profiler is running. Currently not used */ |
| 146 iJIT_NOTHING_RUNNING = 0x0000, | 146 iJIT_NOTHING_RUNNING = 0x0000, |
| 147 | 147 |
| 148 /* Sampling is running. This is the default value | 148 /* Sampling is running. This is the default value |
| 149 * returned by iJIT_IsProfilingActive() | 149 * returned by iJIT_IsProfilingActive() |
| 150 */ | 150 */ |
| 151 iJIT_SAMPLING_ON = 0x0001, | 151 iJIT_SAMPLING_ON = 0x0001, |
| 152 | 152 |
| 153 /* Call Graph is running */ | 153 /* Call Graph is running */ |
| 154 iJIT_CALLGRAPH_ON = 0x0002 | 154 iJIT_CALLGRAPH_ON = 0x0002 |
| 155 | 155 |
| 156 } iJIT_IsProfilingActiveFlags; | 156 } iJIT_IsProfilingActiveFlags; |
| 157 | 157 |
| 158 /* Enumerator for the environment of methods*/ | 158 /* Enumerator for the environment of methods*/ |
| 159 typedef enum _iJDEnvironmentType | 159 typedef enum _iJDEnvironmentType |
| 160 { | 160 { |
| 161 iJDE_JittingAPI = 2 | 161 iJDE_JittingAPI = 2 |
| 162 } iJDEnvironmentType; | 162 } iJDEnvironmentType; |
| 163 | 163 |
| 164 /********************************** | 164 /********************************** |
| 165 * Data structures for the events * | 165 * Data structures for the events * |
| 166 **********************************/ | 166 **********************************/ |
| 167 | 167 |
| 168 /* structure for the events: | 168 /* structure for the events: |
| 169 * iJVM_EVENT_TYPE_METHOD_UNLOAD_START | 169 * iJVM_EVENT_TYPE_METHOD_UNLOAD_START |
| 170 */ | 170 */ |
| 171 | 171 |
| 172 typedef struct _iJIT_Method_Id | 172 typedef struct _iJIT_Method_Id |
| 173 { | 173 { |
| 174 /* Id of the method (same as the one passed in | 174 /* Id of the method (same as the one passed in |
| 175 * the iJIT_Method_Load struct | 175 * the iJIT_Method_Load struct |
| 176 */ | 176 */ |
| 177 unsigned int method_id; | 177 unsigned int method_id; |
| 178 | 178 |
| 179 } *piJIT_Method_Id, iJIT_Method_Id; | 179 } *piJIT_Method_Id, iJIT_Method_Id; |
| 180 | 180 |
| 181 | 181 |
| 182 /* structure for the events: | 182 /* structure for the events: |
| 183 * iJVM_EVENT_TYPE_ENTER_NIDS, | 183 * iJVM_EVENT_TYPE_ENTER_NIDS, |
| 184 * iJVM_EVENT_TYPE_LEAVE_NIDS, | 184 * iJVM_EVENT_TYPE_LEAVE_NIDS, |
| 185 * iJVM_EVENT_TYPE_EXCEPTION_OCCURRED_NIDS | 185 * iJVM_EVENT_TYPE_EXCEPTION_OCCURRED_NIDS |
| 186 */ | 186 */ |
| 187 | 187 |
| 188 typedef struct _iJIT_Method_NIDS | 188 typedef struct _iJIT_Method_NIDS |
| 189 { | 189 { |
| 190 /* unique method ID */ | 190 /* unique method ID */ |
| 191 unsigned int method_id; | 191 unsigned int method_id; |
| 192 | 192 |
| 193 /* NOTE: no need to fill this field, it's filled by VTune */ | 193 /* NOTE: no need to fill this field, it's filled by VTune */ |
| 194 unsigned int stack_id; | 194 unsigned int stack_id; |
| 195 | 195 |
| 196 /* method name (just the method, without the class) */ | 196 /* method name (just the method, without the class) */ |
| 197 char* method_name; | 197 char* method_name; |
| 198 } *piJIT_Method_NIDS, iJIT_Method_NIDS; | 198 } *piJIT_Method_NIDS, iJIT_Method_NIDS; |
| 199 | 199 |
| 200 /* structures for the events: | 200 /* structures for the events: |
| 201 * iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED | 201 * iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED |
| 202 */ | 202 */ |
| 203 | 203 |
| 204 typedef struct _LineNumberInfo | 204 typedef struct _LineNumberInfo |
| 205 { | 205 { |
| 206 /* x86 Offset from the begining of the method*/ | 206 /* x86 Offset from the begining of the method*/ |
| 207 unsigned int Offset; | 207 unsigned int Offset; |
| 208 | 208 |
| 209 /* source line number from the begining of the source file */ | 209 /* source line number from the begining of the source file */ |
| 210 unsigned int LineNumber; | 210 unsigned int LineNumber; |
| 211 | 211 |
| 212 } *pLineNumberInfo, LineNumberInfo; | 212 } *pLineNumberInfo, LineNumberInfo; |
| 213 | 213 |
| 214 typedef struct _iJIT_Method_Load | 214 typedef struct _iJIT_Method_Load |
| 215 { | 215 { |
| 216 /* unique method ID - can be any unique value, (except 0 - 999) */ | 216 /* unique method ID - can be any unique value, (except 0 - 999) */ |
| 217 unsigned int method_id; | 217 unsigned int method_id; |
| 218 | 218 |
| 219 /* method name (can be with or without the class and signature, in any case | 219 /* method name (can be with or without the class and signature, in any case |
| 220 * the class name will be added to it) | 220 * the class name will be added to it) |
| 221 */ | 221 */ |
| 222 char* method_name; | 222 char* method_name; |
| 223 | 223 |
| 224 /* virtual address of that method - This determines the method range for the | 224 /* virtual address of that method - This determines the method range for the |
| 225 * iJVM_EVENT_TYPE_ENTER/LEAVE_METHOD_ADDR events | 225 * iJVM_EVENT_TYPE_ENTER/LEAVE_METHOD_ADDR events |
| 226 */ | 226 */ |
| 227 void* method_load_address; | 227 void* method_load_address; |
| 228 | 228 |
| 229 /* Size in memory - Must be exact */ | 229 /* Size in memory - Must be exact */ |
| 230 unsigned int method_size; | 230 unsigned int method_size; |
| 231 | 231 |
| 232 /* Line Table size in number of entries - Zero if none */ | 232 /* Line Table size in number of entries - Zero if none */ |
| 233 unsigned int line_number_size; | 233 unsigned int line_number_size; |
| 234 | 234 |
| 235 /* Pointer to the begining of the line numbers info array */ | 235 /* Pointer to the begining of the line numbers info array */ |
| 236 pLineNumberInfo line_number_table; | 236 pLineNumberInfo line_number_table; |
| 237 | 237 |
| 238 /* unique class ID */ | 238 /* unique class ID */ |
| 239 unsigned int class_id; | 239 unsigned int class_id; |
| 240 | 240 |
| 241 /* class file name */ | 241 /* class file name */ |
| 242 char* class_file_name; | 242 char* class_file_name; |
| 243 | 243 |
| 244 /* source file name */ | 244 /* source file name */ |
| 245 char* source_file_name; | 245 char* source_file_name; |
| 246 | 246 |
| 247 /* bits supplied by the user for saving in the JIT file */ | 247 /* bits supplied by the user for saving in the JIT file */ |
| 248 void* user_data; | 248 void* user_data; |
| 249 | 249 |
| 250 /* the size of the user data buffer */ | 250 /* the size of the user data buffer */ |
| 251 unsigned int user_data_size; | 251 unsigned int user_data_size; |
| 252 | 252 |
| 253 /* NOTE: no need to fill this field, it's filled by VTune */ | 253 /* NOTE: no need to fill this field, it's filled by VTune */ |
| 254 iJDEnvironmentType env; | 254 iJDEnvironmentType env; |
| 255 | 255 |
| 256 } *piJIT_Method_Load, iJIT_Method_Load; | 256 } *piJIT_Method_Load, iJIT_Method_Load; |
| 257 | 257 |
| 258 /* API Functions */ | 258 /* API Functions */ |
| 259 #ifdef __cplusplus | 259 #ifdef __cplusplus |
| 260 extern "C" { | 260 extern "C" { |
| 261 #endif | 261 #endif |
| 262 | 262 |
| 263 #ifndef CDECL | 263 #ifndef CDECL |
| 264 # if defined WIN32 || defined _WIN32 | 264 # if defined WIN32 || defined _WIN32 |
| 265 # define CDECL __cdecl | 265 # define CDECL __cdecl |
| 266 # else /* defined WIN32 || defined _WIN32 */ | 266 # else /* defined WIN32 || defined _WIN32 */ |
| 267 # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__ | 267 # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__ |
| 268 # define CDECL /* not actual on x86_64 platform */ | 268 # define CDECL /* not actual on x86_64 platform */ |
| 269 # else /* _M_X64 || _M_AMD64 || __x86_64__ */ | 269 # else /* _M_X64 || _M_AMD64 || __x86_64__ */ |
| 270 # define CDECL __attribute__ ((cdecl)) | 270 # define CDECL __attribute__ ((cdecl)) |
| 271 # endif /* _M_X64 || _M_AMD64 || __x86_64__ */ | 271 # endif /* _M_X64 || _M_AMD64 || __x86_64__ */ |
| 272 # endif /* defined WIN32 || defined _WIN32 */ | 272 # endif /* defined WIN32 || defined _WIN32 */ |
| 273 #endif /* CDECL */ | 273 #endif /* CDECL */ |
| 274 | 274 |
| 275 #define JITAPI CDECL | 275 #define JITAPI CDECL |
| 276 | 276 |
| 277 /* called when the settings are changed with new settings */ | 277 /* called when the settings are changed with new settings */ |
| 278 typedef void (*iJIT_ModeChangedEx)(void *UserData, iJIT_ModeFlags Flags); | 278 typedef void (*iJIT_ModeChangedEx)(void *UserData, iJIT_ModeFlags Flags); |
| 279 | 279 |
| 280 int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData); | 280 int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData); |
| 281 | 281 |
| 282 /* The new mode call back routine */ | 282 /* The new mode call back routine */ |
| 283 void JITAPI iJIT_RegisterCallbackEx(void *userdata, | 283 void JITAPI iJIT_RegisterCallbackEx(void *userdata, |
| 284 iJIT_ModeChangedEx NewModeCallBackFuncEx); | 284 iJIT_ModeChangedEx NewModeCallBackFuncEx); |
| 285 | 285 |
| 286 iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive(void); | 286 iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive(void); |
| 287 | 287 |
| 288 void JITAPI FinalizeThread(void); | 288 void JITAPI FinalizeThread(void); |
| 289 | 289 |
| 290 void JITAPI FinalizeProcess(void); | 290 void JITAPI FinalizeProcess(void); |
| 291 | 291 |
| 292 unsigned int JITAPI iJIT_GetNewMethodID(void); | 292 unsigned int JITAPI iJIT_GetNewMethodID(void); |
| 293 | 293 |
| 294 #ifdef __cplusplus | 294 #ifdef __cplusplus |
| 295 } | 295 } |
| 296 #endif | 296 #endif |
| 297 | 297 |
| 298 #endif /* __JITPROFILING_H__ */ | 298 #endif /* __JITPROFILING_H__ */ |
| OLD | NEW |