V8 Project
jitprofiling.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _iJIT_Method_Id
 
struct  _iJIT_Method_NIDS
 
struct  _LineNumberInfo
 
struct  _iJIT_Method_Load
 

Macros

#define CDECL   __attribute__ ((cdecl))
 
#define JITAPI   CDECL
 

Typedefs

typedef enum iJIT_jvm_event iJIT_JVM_EVENT
 
typedef enum _iJIT_ModeFlags iJIT_ModeFlags
 
typedef enum _iJIT_IsProfilingActiveFlags iJIT_IsProfilingActiveFlags
 
typedef enum _iJDEnvironmentType iJDEnvironmentType
 
typedef struct _iJIT_Method_IdpiJIT_Method_Id
 
typedef struct _iJIT_Method_Id iJIT_Method_Id
 
typedef struct _iJIT_Method_NIDSpiJIT_Method_NIDS
 
typedef struct _iJIT_Method_NIDS iJIT_Method_NIDS
 
typedef struct _LineNumberInfopLineNumberInfo
 
typedef struct _LineNumberInfo LineNumberInfo
 
typedef struct _iJIT_Method_LoadpiJIT_Method_Load
 
typedef struct _iJIT_Method_Load iJIT_Method_Load
 
typedef void(* iJIT_ModeChangedEx) (void *UserData, iJIT_ModeFlags Flags)
 

Enumerations

enum  iJIT_jvm_event {
  iJVM_EVENT_TYPE_SHUTDOWN = 2 , iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED =13 , iJVM_EVENT_TYPE_METHOD_UNLOAD_START , iJVM_EVENT_TYPE_ENTER_NIDS = 19 ,
  iJVM_EVENT_TYPE_LEAVE_NIDS
}
 
enum  _iJIT_ModeFlags {
  iJIT_NO_NOTIFICATIONS = 0x0000 , iJIT_BE_NOTIFY_ON_LOAD = 0x0001 , iJIT_BE_NOTIFY_ON_UNLOAD = 0x0002 , iJIT_BE_NOTIFY_ON_METHOD_ENTRY = 0x0004 ,
  iJIT_BE_NOTIFY_ON_METHOD_EXIT = 0x0008
}
 
enum  _iJIT_IsProfilingActiveFlags { iJIT_NOTHING_RUNNING = 0x0000 , iJIT_SAMPLING_ON = 0x0001 , iJIT_CALLGRAPH_ON = 0x0002 }
 
enum  _iJDEnvironmentType { iJDE_JittingAPI = 2 }
 

Functions

int JITAPI iJIT_NotifyEvent (iJIT_JVM_EVENT event_type, void *EventSpecificData)
 
void JITAPI iJIT_RegisterCallbackEx (void *userdata, iJIT_ModeChangedEx NewModeCallBackFuncEx)
 
iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive (void)
 
void JITAPI FinalizeThread (void)
 
void JITAPI FinalizeProcess (void)
 
unsigned int JITAPI iJIT_GetNewMethodID (void)
 

Macro Definition Documentation

◆ CDECL

#define CDECL   __attribute__ ((cdecl))

Definition at line 270 of file jitprofiling.h.

◆ JITAPI

#define JITAPI   CDECL

Definition at line 275 of file jitprofiling.h.

Typedef Documentation

◆ iJDEnvironmentType

◆ iJIT_IsProfilingActiveFlags

◆ iJIT_JVM_EVENT

◆ iJIT_Method_Id

◆ iJIT_Method_Load

◆ iJIT_Method_NIDS

◆ iJIT_ModeChangedEx

typedef void(* iJIT_ModeChangedEx) (void *UserData, iJIT_ModeFlags Flags)

Definition at line 278 of file jitprofiling.h.

◆ iJIT_ModeFlags

◆ LineNumberInfo

◆ piJIT_Method_Id

typedef struct _iJIT_Method_Id * piJIT_Method_Id

◆ piJIT_Method_Load

◆ piJIT_Method_NIDS

◆ pLineNumberInfo

typedef struct _LineNumberInfo * pLineNumberInfo

Enumeration Type Documentation

◆ _iJDEnvironmentType

Enumerator
iJDE_JittingAPI 

Definition at line 159 of file jitprofiling.h.

160 {
161  iJDE_JittingAPI = 2
@ iJDE_JittingAPI
Definition: jitprofiling.h:161
enum _iJDEnvironmentType iJDEnvironmentType

◆ _iJIT_IsProfilingActiveFlags

Enumerator
iJIT_NOTHING_RUNNING 
iJIT_SAMPLING_ON 
iJIT_CALLGRAPH_ON 

Definition at line 143 of file jitprofiling.h.

144 {
145  /* No profiler is running. Currently not used */
146  iJIT_NOTHING_RUNNING = 0x0000,
147 
148  /* Sampling is running. This is the default value
149  * returned by iJIT_IsProfilingActive()
150  */
151  iJIT_SAMPLING_ON = 0x0001,
152 
153  /* Call Graph is running */
154  iJIT_CALLGRAPH_ON = 0x0002
155 
@ iJIT_NOTHING_RUNNING
Definition: jitprofiling.h:146
@ iJIT_SAMPLING_ON
Definition: jitprofiling.h:151
@ iJIT_CALLGRAPH_ON
Definition: jitprofiling.h:154
enum _iJIT_IsProfilingActiveFlags iJIT_IsProfilingActiveFlags

◆ _iJIT_ModeFlags

Enumerator
iJIT_NO_NOTIFICATIONS 
iJIT_BE_NOTIFY_ON_LOAD 
iJIT_BE_NOTIFY_ON_UNLOAD 
iJIT_BE_NOTIFY_ON_METHOD_ENTRY 
iJIT_BE_NOTIFY_ON_METHOD_EXIT 

Definition at line 105 of file jitprofiling.h.

106 {
107  /* No need to Notify VTune, since VTune is not running */
108  iJIT_NO_NOTIFICATIONS = 0x0000,
109 
110  /* when turned on the jit must call
111  * iJIT_NotifyEvent
112  * (
113  * iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED,
114  * )
115  * for all the method already jitted
116  */
117  iJIT_BE_NOTIFY_ON_LOAD = 0x0001,
118 
119  /* when turned on the jit must call
120  * iJIT_NotifyEvent
121  * (
122  * iJVM_EVENT_TYPE_METHOD_UNLOAD_FINISHED,
123  * ) for all the method that are unloaded
124  */
125  iJIT_BE_NOTIFY_ON_UNLOAD = 0x0002,
126 
127  /* when turned on the jit must instrument all
128  * the currently jited code with calls on
129  * method entries
130  */
132 
133  /* when turned on the jit must instrument all
134  * the currently jited code with calls
135  * on method exit
136  */
138 
@ iJIT_BE_NOTIFY_ON_METHOD_ENTRY
Definition: jitprofiling.h:131
@ iJIT_BE_NOTIFY_ON_METHOD_EXIT
Definition: jitprofiling.h:137
@ iJIT_BE_NOTIFY_ON_UNLOAD
Definition: jitprofiling.h:125
@ iJIT_BE_NOTIFY_ON_LOAD
Definition: jitprofiling.h:117
@ iJIT_NO_NOTIFICATIONS
Definition: jitprofiling.h:108
enum _iJIT_ModeFlags iJIT_ModeFlags

◆ iJIT_jvm_event

Enumerator
iJVM_EVENT_TYPE_SHUTDOWN 
iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED 
iJVM_EVENT_TYPE_METHOD_UNLOAD_START 
iJVM_EVENT_TYPE_ENTER_NIDS 
iJVM_EVENT_TYPE_LEAVE_NIDS 

Definition at line 66 of file jitprofiling.h.

67 {
68 
69  /* shutdown */
70 
71  /*
72  * Program exiting EventSpecificData NA
73  */
75 
76  /* JIT profiling */
77 
78  /*
79  * issued after method code jitted into memory but before code is executed
80  * EventSpecificData is an iJIT_Method_Load
81  */
83 
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
86  * code only at this point EventSpecificData is iJIT_Method_Id
87  */
89 
90  /* Method Profiling */
91 
92  /* method name, Id and stack is supplied
93  * issued when a method is about to be entered EventSpecificData is
94  * iJIT_Method_NIDS
95  */
97 
98  /* method name, Id and stack is supplied
99  * issued when a method is about to be left EventSpecificData is
100  * iJIT_Method_NIDS
101  */
@ iJVM_EVENT_TYPE_ENTER_NIDS
Definition: jitprofiling.h:96
@ iJVM_EVENT_TYPE_LEAVE_NIDS
Definition: jitprofiling.h:102
@ iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED
Definition: jitprofiling.h:82
@ iJVM_EVENT_TYPE_METHOD_UNLOAD_START
Definition: jitprofiling.h:88
@ iJVM_EVENT_TYPE_SHUTDOWN
Definition: jitprofiling.h:74
enum iJIT_jvm_event iJIT_JVM_EVENT

Function Documentation

◆ FinalizeProcess()

void JITAPI FinalizeProcess ( void  )

Definition at line 465 of file jitprofiling.cc.

466 {
467  if (m_libHandle)
468  {
469 #if ITT_PLATFORM==ITT_PLATFORM_WIN
470  FreeLibrary(m_libHandle);
471 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
472  dlclose(m_libHandle);
473 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
474  m_libHandle = NULL;
475  }
476 
478 #if ITT_PLATFORM==ITT_PLATFORM_WIN
479  TlsFree (threadLocalStorageHandle);
480 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
481  pthread_key_delete(threadLocalStorageHandle);
482 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
483 }
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
static DWORD threadLocalStorageHandle
HINSTANCE m_libHandle
Definition: jitprofiling.cc:86

References m_libHandle, NULL, and threadLocalStorageHandle.

◆ FinalizeThread()

void JITAPI FinalizeThread ( void  )

Definition at line 439 of file jitprofiling.cc.

440 {
442  {
443 #if ITT_PLATFORM==ITT_PLATFORM_WIN
444  pThreadStack threadStack = (pThreadStack)TlsGetValue (threadLocalStorageHandle);
445 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
446  pThreadStack threadStack = (pThreadStack)pthread_getspecific(threadLocalStorageHandle);
447 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
448  if (threadStack)
449  {
450  free (threadStack);
451  threadStack = NULL;
452 #if ITT_PLATFORM==ITT_PLATFORM_WIN
453  TlsSetValue (threadLocalStorageHandle, threadStack);
454 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
455  pthread_setspecific(threadLocalStorageHandle, threadStack);
456 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
457  }
458  }
459 }
struct ThreadStack * pThreadStack

References NULL, and threadLocalStorageHandle.

◆ iJIT_GetNewMethodID()

unsigned int JITAPI iJIT_GetNewMethodID ( void  )

Definition at line 490 of file jitprofiling.cc.

491 {
492  static unsigned int methodID = 0x100000;
493 
494  if (methodID == 0)
495  return 0; // ERROR : this is not a valid value
496 
497  return methodID++;
498 }

Referenced by vTune::internal::VTUNEJITInterface::event_handler().

+ Here is the caller graph for this function:

◆ iJIT_IsProfilingActive()

iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive ( void  )

Definition at line 286 of file jitprofiling.cc.

287 {
288  if (!iJIT_DLL_is_missing)
289  {
290  loadiJIT_Funcs();
291  }
292 
293  return executionMode;
294 }
static int iJIT_DLL_is_missing
static int loadiJIT_Funcs(void)
static iJIT_IsProfilingActiveFlags executionMode

References executionMode, iJIT_DLL_is_missing, and loadiJIT_Funcs().

+ Here is the call graph for this function:

◆ iJIT_NotifyEvent()

int JITAPI iJIT_NotifyEvent ( iJIT_JVM_EVENT  event_type,
void *  EventSpecificData 
)

Definition at line 151 of file jitprofiling.cc.

152 {
153  int ReturnValue;
154 
155  /*******************************************************************************
156  ** This section is for debugging outside of VTune.
157  ** It creates the environment variables that indicates call graph mode.
158  ** If running outside of VTune remove the remark.
159  **
160 
161  static int firstTime = 1;
162  char DoCallGraph[12] = "DoCallGraph";
163  if (firstTime)
164  {
165  firstTime = 0;
166  SetEnvironmentVariable( "BISTRO_COLLECTORS_DO_CALLGRAPH", DoCallGraph);
167  }
168 
169  ** end of section.
170  *******************************************************************************/
171 
172  /* initialization part - the functions have not been loaded yet. This part
173  ** will load the functions, and check if we are in Call Graph mode.
174  ** (for special treatment).
175  */
176  if (!FUNC_NotifyEvent)
177  {
179  return 0;
180 
181  // load the Function from the DLL
182  if (!loadiJIT_Funcs())
183  return 0;
184 
185  /* Call Graph initialization. */
186  }
187 
188  /* If the event is method entry/exit, check that in the current mode
189  ** VTune is allowed to receive it
190  */
191  if ((event_type == iJVM_EVENT_TYPE_ENTER_NIDS || event_type == iJVM_EVENT_TYPE_LEAVE_NIDS) &&
193  {
194  return 0;
195  }
196  /* This section is performed when method enter event occurs.
197  ** It updates the virtual stack, or creates it if this is the first
198  ** method entry in the thread. The stack pointer is decreased.
199  */
200  if (event_type == iJVM_EVENT_TYPE_ENTER_NIDS)
201  {
202 #if ITT_PLATFORM==ITT_PLATFORM_WIN
203  pThreadStack threadStack = (pThreadStack)TlsGetValue (threadLocalStorageHandle);
204 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
205  pThreadStack threadStack = (pThreadStack)pthread_getspecific(threadLocalStorageHandle);
206 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
207 
208  // check for use of reserved method IDs
209  if ( ((piJIT_Method_NIDS) EventSpecificData)->method_id <= 999 )
210  return 0;
211 
212  if (!threadStack)
213  {
214  // initialize the stack.
215  threadStack = (pThreadStack) calloc (sizeof(ThreadStack), 1);
216  threadStack->TopStack = INIT_TOP_Stack;
217  threadStack->CurrentStack = INIT_TOP_Stack;
218 #if ITT_PLATFORM==ITT_PLATFORM_WIN
219  TlsSetValue(threadLocalStorageHandle,(void*)threadStack);
220 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
221  pthread_setspecific(threadLocalStorageHandle,(void*)threadStack);
222 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
223  }
224 
225  // decrease the stack.
226  ((piJIT_Method_NIDS) EventSpecificData)->stack_id = (threadStack->CurrentStack)--;
227  }
228 
229  /* This section is performed when method leave event occurs
230  ** It updates the virtual stack.
231  ** Increases the stack pointer.
232  ** If the stack pointer reached the top (left the global function)
233  ** increase the pointer and the top pointer.
234  */
235  if (event_type == iJVM_EVENT_TYPE_LEAVE_NIDS)
236  {
237 #if ITT_PLATFORM==ITT_PLATFORM_WIN
238  pThreadStack threadStack = (pThreadStack)TlsGetValue (threadLocalStorageHandle);
239 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
240  pThreadStack threadStack = (pThreadStack)pthread_getspecific(threadLocalStorageHandle);
241 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
242 
243  // check for use of reserved method IDs
244  if ( ((piJIT_Method_NIDS) EventSpecificData)->method_id <= 999 )
245  return 0;
246 
247  if (!threadStack)
248  {
249  /* Error: first report in this thread is method exit */
250  exit (1);
251  }
252 
253  ((piJIT_Method_NIDS) EventSpecificData)->stack_id = ++(threadStack->CurrentStack) + 1;
254 
255  if (((piJIT_Method_NIDS) EventSpecificData)->stack_id > threadStack->TopStack)
256  ((piJIT_Method_NIDS) EventSpecificData)->stack_id = (unsigned int)-1;
257  }
258 
259  if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED)
260  {
261  // check for use of reserved method IDs
262  if ( ((piJIT_Method_Load) EventSpecificData)->method_id <= 999 )
263  return 0;
264  }
265 
266  ReturnValue = (int)FUNC_NotifyEvent(event_type, EventSpecificData);
267 
268  return ReturnValue;
269 }
#define INIT_TOP_Stack
static TPNotify FUNC_NotifyEvent
struct _iJIT_Method_NIDS * piJIT_Method_NIDS
unsigned int TopStack
unsigned int CurrentStack

References ThreadStack::CurrentStack, executionMode, FUNC_NotifyEvent, iJIT_CALLGRAPH_ON, iJIT_DLL_is_missing, iJVM_EVENT_TYPE_ENTER_NIDS, iJVM_EVENT_TYPE_LEAVE_NIDS, iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, INIT_TOP_Stack, loadiJIT_Funcs(), threadLocalStorageHandle, and ThreadStack::TopStack.

Referenced by vTune::internal::VTUNEJITInterface::event_handler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ iJIT_RegisterCallbackEx()

void JITAPI iJIT_RegisterCallbackEx ( void *  userdata,
iJIT_ModeChangedEx  NewModeCallBackFuncEx 
)

Definition at line 271 of file jitprofiling.cc.

272 {
273  // is it already missing... or the load of functions from the DLL failed
275  {
276  NewModeCallBackFuncEx(userdata, iJIT_NO_NOTIFICATIONS); // then do not bother with notifications
277  /* Error: could not load JIT functions. */
278  return;
279  }
280  // nothing to do with the callback
281 }

References iJIT_DLL_is_missing, iJIT_NO_NOTIFICATIONS, and loadiJIT_Funcs().

+ Here is the call graph for this function: