home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / j2sdk / files / linux / j2sdklin.bin / jdk1.3.1 / include-old / vmprofiler.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-05-06  |  4.7 KB  |  141 lines

  1. /*
  2.  * @(#)vmprofiler.h    1.30 00/02/02
  3.  *
  4.  * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the proprietary information of Sun Microsystems, Inc.  
  7.  * Use is subject to license terms.
  8.  * 
  9.  */
  10.  
  11. #ifndef _JAVASOFT_VMPROFILER_H_
  12. #define _JAVASOFT_VMPROFILER_H_
  13.  
  14. #include "jvmpi.h"
  15. #include "sys_api.h"
  16.  
  17. /* Support for JVMPI */
  18.  
  19. /* types */
  20. typedef struct {
  21.     ExecEnv *ee;                    /* ee whose current_method is compiled */
  22.     void *code_addr;        /* virtual address of the the method */
  23.     unsigned long code_size;        /* size of compiled method in memory */
  24.     unsigned long lineno_table_len; /* number of lineno table entries */
  25.     JVMPI_Lineno *lineno_table;     /* pointer to beginning of line table */
  26. } compiled_method_t;
  27.  
  28. /* variables */
  29. extern unsigned int jvmpi_event_flags;
  30.  
  31. /* functions called by other parts of the VM to support JVMPI */
  32. JHandle *jvmpi_obj_reverse_map(void *obj);
  33. void jvmpi_dump_add_trace(ExecEnv *ee);
  34. void jvmpi_dump_add_root(JHandle *h, int kind, void *info, void *extra_info);
  35. void jvmpi_dump_object(JHandle *h);
  36. void jvmpi_in_dump_heap(bool_t flag);
  37.  
  38. void *jvmpi_interface(void);
  39. void jvmpi_dump(void);
  40. jint jvmpi_jvm_init_done(void);
  41.  
  42. void jvmpi_new_globalref(ExecEnv *ee, jobject ref, JHandle *h);
  43. void jvmpi_delete_globalref(ExecEnv *ee, jobject ref);
  44. void jvmpi_new_weakref(ExecEnv *ee, jobject ref, JHandle *h);
  45. void jvmpi_delete_weakref(ExecEnv *ee, jobject ref);
  46.  
  47. void jvmpi_new_arena(void);
  48. void jvmpi_alloc_object(ExecEnv *ee, JHandle *h);
  49. void jvmpi_free_object(JHandle *h);
  50. void jvmpi_move_object(void *oldobj, void *newobj);
  51.  
  52. void jvmpi_load_class(ClassClass *cb);
  53. void jvmpi_load_class_hook(unsigned char **ptrP, unsigned char **end_ptrP,
  54.                void * (* malloc_f)(unsigned int));
  55. void jvmpi_free_class(ClassClass *cb);
  56. void jvmpi_superclass_link(ClassClass *cb, ClassClass *scb);
  57.  
  58. void jvmpi_thread_start(JHandle *t);
  59. void jvmpi_thread_end(JHandle *t);
  60.  
  61. void jvmpi_method_entry(ExecEnv *ee, JHandle *h);
  62. void jvmpi_method_exit(ExecEnv *ee);
  63.  
  64. void jvmpi_load_compiled_method(compiled_method_t *compiled_method_info);
  65. void jvmpi_unload_compiled_method(struct methodblock *mb);
  66.  
  67. ClassClass * jvmpi_get_object_info(JHandle *h, int *is_array, int *size);
  68. unsigned long jvmpi_get_heap_size(void);
  69.  
  70. void jvmpi_monitor_contended_enter(sys_thread_t *self, sys_mon_t *mid);
  71. void jvmpi_monitor_contended_entered(sys_thread_t *self, sys_mon_t *mid);
  72. void jvmpi_monitor_contended_exit(sys_thread_t *self, sys_mon_t *mid);
  73.  
  74. void jvmpi_monitor_wait(JHandle *obj, jlong millis);
  75. void jvmpi_monitor_waited(JHandle *obj);
  76.  
  77. void jvmpi_gc_start(void);
  78. void jvmpi_gc_finish(long used_objs, long used_obj_space, long total_obj_space);
  79.  
  80. void jvmpi_dump_context_lock(void);
  81. void jvmpi_dump_context_unlock(void);
  82.  
  83. void jvmpi_trace_instr(ExecEnv *ee, unsigned char *pc, unsigned char opcode);
  84. void jvmpi_trace_if(ExecEnv *ee, unsigned char *pc, int is_true);
  85. void jvmpi_trace_tableswitch(ExecEnv *ee, unsigned char *pc, int key, int low, int hi);
  86. void jvmpi_trace_lookupswitch(ExecEnv *ee,
  87.                               unsigned char *pc,
  88.                               int chosen_pair_index,
  89.                               int pairs_total);
  90.  
  91. typedef struct {
  92.     unsigned int flag;
  93.     jint (*enable_handler)(void *arg);
  94.     jint (*disable_handler)(void *arg);
  95. } jvmpi_event_info_t;
  96.  
  97. extern jvmpi_event_info_t jvmpi_event_info[];
  98.  
  99. /* macros */
  100. #define JVMPI_INVALID_CLASS ((ClassClass *)(-1))
  101.  
  102. #define JVMPI_EVENT_ENABLED    -2
  103. #define JVMPI_EVENT_DISABLED   0
  104.  
  105. #ifdef __linux__
  106. #define JVMPI_EVENT_IS_ENABLED(e) \
  107.   ((e) > 32 ? (jvmpi_event_info[e].flag == (unsigned int)JVMPI_EVENT_ENABLED) : \
  108.               (jvmpi_event_flags & (1 << e)))
  109. #else
  110. #define JVMPI_EVENT_IS_ENABLED(e) \
  111.   ((e) > 32 ? (jvmpi_event_info[e].flag == JVMPI_EVENT_ENABLED) : \
  112.               (jvmpi_event_flags & (1 << e)))
  113. #endif
  114.  
  115. /* constants */
  116. #define JVMPI_EVENT_PROFILING_OFF              0x00000000
  117. #define JVMPI_EVENT_PROFILING_ON               0x80000000
  118.  
  119. /* convenient constants for the assembly loop */ 
  120. #define JVMPI_EVENT_METHOD_ENTRY_ON \
  121.     ((1 << JVMPI_EVENT_METHOD_ENTRY) | (1 << JVMPI_EVENT_METHOD_ENTRY2))
  122. #define JVMPI_EVENT_METHOD_EXIT_ON      (1 << JVMPI_EVENT_METHOD_EXIT)
  123.  
  124. /* for JIT interface */
  125. #define JVMPI_EVENT_LOAD_COMPILED_METHOD_ON \
  126.     (1 << JVMPI_EVENT_LOAD_COMPILED_METHOD)
  127. #define JVMPI_EVENT_UNLOAD_COMPILED_METHOD_ON \
  128.     (1 << JVMPI_EVENT_UNLOAD_COMPILED_METHOD)
  129.  
  130. #define GC_ROOT_UNKNOWN       0xff
  131. #define GC_ROOT_JNI_GLOBAL    0x01
  132. #define GC_ROOT_JNI_LOCAL     0x02
  133. #define GC_ROOT_JAVA_FRAME    0x03
  134. #define GC_ROOT_NATIVE_STACK  0x04
  135. #define GC_ROOT_STICKY_CLASS  0x05
  136. #define GC_ROOT_THREAD_BLOCK  0x06
  137. #define GC_ROOT_MONITOR_USED  0x07
  138. #define GC_ROOT_THREAD_OBJ    0x08
  139.  
  140. #endif /* !_JAVASOFT_VMPROFILER_H_ */
  141.