home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / jreheadf.zip / jvmpi.h < prev    next >
Text File  |  2002-09-19  |  31KB  |  755 lines

  1. /*
  2.  * @(#)src/contract/jvm/sov/jvmpi.h, profile, xs131, 20020822 1.21.2.2
  3.  * ===========================================================================
  4.  * Licensed Materials - Property of IBM
  5.  *
  6.  * IBM Java(tm)2 SDK, Standard Edition, v 1.3.1
  7.  * (C) Copyright IBM Corp. 1998, 2001. All Rights Reserved
  8.  * US Government Users Restricted Rights - Use, duplication or disclosure
  9.  * restricted by GSA ADP Schedule Contract with IBM Corp.
  10.  * ===========================================================================
  11.  */
  12.  
  13. /*
  14.  *
  15.  * ===========================================================================
  16.  *
  17.  * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  18.  * ===========================================================================
  19.  * Change activity:
  20.  *
  21.  * Reason  Date   Origin  Description
  22.  * ------  ----   ------  ----------------------------------------------------
  23.  * 004142  081199 hdcrk:  Add profiler enabled event identifier
  24.  * 005637  011100 hdece:  Add JVMPI_EVENT_INSTRUCTION_START
  25.  * 004458  012500 hdjbm   Part II of JVMPI -> JIT implementation
  26.  * 008444  031400 hdece:  Ensure OK for C++
  27.  * 009193  042700 mikew   Update version#, 'jobject/ID' interface fn.s,
  28.  *                        sync 'instruction' struct with Sun's 'jvmpi.h'
  29.  * 009486  150500 hdmkv:  64bit: 64-bit enablement
  30.  * 010717  100800 hdngmr  Add XJNICALL to JVMPI interface functions
  31.  * 023209  300800 hdngmr  Add XJNICALL to function pointer given to
  32.  *                         CreateSystemThread.
  33.  * 031526  170401 hdtep   Migrate Sun's 1.3.1 changes
  34.  * 028742  250601 tdpgg   New events to reflect types of generated code
  35.  * 035833  231001 prakashr Incompatible event IDs across releases
  36.  *
  37.  * ===========================================================================
  38.  */
  39.  
  40. #ifndef _JAVASOFT_JVMPI_H_
  41. #define _JAVASOFT_JVMPI_H_
  42.  
  43. #include "jni.h"
  44.  
  45. #define JVMPI_VERSION_1         ((jint)0x10000001)
  46. #define JVMPI_VERSION_1_1       ((jint)0x10000002)      /* current version */ /*ibm@9193*/
  47.  
  48. /* ibm@8444 */
  49. #ifdef __cplusplus
  50. extern "C" {
  51. #endif
  52.  
  53. typedef void (*jvmpi_void_function_of_void)(void *);    /*ibm@31526*/
  54.  
  55. /****************************************************************
  56.  * Profiler interface data structures.
  57.  ****************************************************************/
  58. /* identifier types. */
  59. struct _jobjectID;
  60. typedef struct _jobjectID * jobjectID;       /* type of object ids */
  61.  
  62. /* raw monitors */
  63. struct _JVMPI_RawMonitor;
  64. typedef struct _JVMPI_RawMonitor * JVMPI_RawMonitor;
  65.  
  66. /* call frame */
  67. typedef struct {
  68.     jint lineno;                      /* line number in the source file */
  69.     jmethodID method_id;              /* method executed in this frame */
  70. } JVMPI_CallFrame;
  71.  
  72. /* call trace */
  73. typedef struct {
  74.     JNIEnv *env_id;                   /* Env where trace was recorded */
  75.     jint num_frames;                  /* number of frames in this trace */
  76.     JVMPI_CallFrame *frames;          /* frames */
  77. } JVMPI_CallTrace;
  78.  
  79. /* method */
  80. typedef struct {
  81.     char *method_name;                /* name of method */
  82.     char *method_signature;           /* signature of method */
  83.     jint start_lineno;                /* -1 if native, abstract .. */
  84.     jint end_lineno;                  /* -1 if native, abstract .. */
  85.     jmethodID method_id;              /* id assigned to this method */
  86. } JVMPI_Method;
  87.  
  88. /* Field */
  89. typedef struct {
  90.     char *field_name;                 /* name of field */
  91.     char *field_signature;            /* signature of field */
  92. } JVMPI_Field;
  93.  
  94. /* line number info for a compiled method */
  95. typedef struct {
  96.     jint offset;                      /* offset from beginning of method */
  97.     jint lineno;                      /* lineno from beginning of src file */
  98. } JVMPI_Lineno;
  99.  
  100. /* event */
  101. typedef struct {
  102.     jint event_type;                  /* event_type */
  103.     JNIEnv *env_id;                   /* env where this event occured */
  104.  
  105.     union {
  106.         struct {
  107.             const char *class_name;   /* class name */             /*ibm@31526*/
  108.             char *source_name;        /* name of source file */
  109.             jint num_interfaces;      /* number of interfaces implemented */
  110.             jint num_methods;         /* number of methods in the class */
  111.             JVMPI_Method *methods;    /* methods */
  112.             jint num_static_fields;   /* number of static fields */
  113.             JVMPI_Field *statics;     /* static fields */
  114.             jint num_instance_fields; /* number of instance fields */
  115.             JVMPI_Field *instances;   /* instance fields */
  116.             jobjectID class_id;       /* id of the class object */
  117.         } class_load;
  118.  
  119.         struct {
  120.             jobjectID class_id;       /* id of the class object */
  121.         } class_unload;
  122.  
  123.         struct {
  124.             unsigned char *class_data;        /* content of class file */
  125.             jint class_data_len;              /* class file length */
  126.             unsigned char *new_class_data;    /* instrumented class file */
  127.             jint new_class_data_len;          /* new class file length */
  128.             void * (*malloc_f)(size_t);       /* memory allocation function *//*ibm.120*/
  129.         } class_load_hook;
  130.  
  131.         struct {
  132.             jint arena_id;
  133.             jobjectID class_id;       /* id of object class */
  134.             jint is_array;            /* JVMPI_NORMAL_OBJECT, ... */
  135.             jsize size;               /* size in number of bytes */ /*ibm@9486*/
  136.             jobjectID obj_id;         /* id assigned to this object */
  137.         } obj_alloc;
  138.  
  139.         struct {
  140.             jobjectID obj_id;         /* id of the object */
  141.         } obj_free;
  142.  
  143.         struct {
  144.             jint arena_id;            /* cur arena id */
  145.             jobjectID obj_id;         /* cur object id */
  146.             jint new_arena_id;        /* new arena id */
  147.             jobjectID new_obj_id;     /* new object id */
  148.         } obj_move;
  149.  
  150.         struct {
  151.             jint arena_id;            /* id of arena */
  152.             const char *arena_name;   /* name of arena */    /*ibm@31526*/
  153.         } new_arena;
  154.  
  155.         struct {
  156.             jint arena_id;            /* id of arena */
  157.         } delete_arena;
  158.  
  159.         struct {
  160.             char *thread_name;        /* name of thread */
  161.             char *group_name;         /* name of group */
  162.             char *parent_name;        /* name of parent */
  163.             jobjectID thread_id;      /* id of the thread object */
  164.             JNIEnv *thread_env_id;
  165.         } thread_start;
  166.  
  167.         struct {
  168.             int dump_level;           /* level of the heap dump info */
  169.             char *begin;              /* where all the root records begin,
  170.                                          please see the heap dump buffer
  171.                                          format described below */
  172.             char *end;                /* where the object records end. */
  173.             jint num_traces;          /* number of thread traces,
  174.                                          0 if dump level = JVMPI_DUMP_LEVEL_0 */
  175.             JVMPI_CallTrace *traces;  /* thread traces collected during
  176.                                          heap dump */
  177.         } heap_dump;
  178.  
  179.         struct {
  180.             jobjectID obj_id;         /* object id */
  181.             jobject ref_id;           /* id assigned to the globalref */
  182.         } jni_globalref_alloc;
  183.  
  184.         struct {
  185.             jobject ref_id;           /* id of the global ref */
  186.         } jni_globalref_free;
  187.  
  188.         struct {
  189.             jmethodID method_id;      /* method */
  190.         } method;
  191.  
  192.         struct {
  193.             jmethodID method_id;      /* id of method */
  194.             jobjectID obj_id;         /* id of target object */
  195.         } method_entry2;
  196.  
  197.         struct {
  198.             jmethodID method_id;        /* id of compiled method */
  199.             void *code_addr;            /* code start addr. in memory */
  200.             jint code_size;             /* code size */
  201.             jint lineno_table_size;     /* size of lineno table */
  202.             JVMPI_Lineno *lineno_table; /* lineno info */
  203.         } compiled_method_load;
  204.  
  205.         struct {
  206.             jmethodID method_id;        /* id of unloaded compiled method */
  207.         } compiled_method_unload;
  208.  
  209.         struct {
  210.             char *begin;                /* beginning of dump buffer,
  211.                                            see below for format */
  212.             char *end;                  /* end of dump buffer */
  213.             jint num_traces;            /* number of traces */
  214.             JVMPI_CallTrace *traces;    /* traces of all threads */
  215.             jint *threads_status;       /* status of all threads */
  216.         } monitor_dump;
  217.  
  218.         struct {
  219.             const char *name;           /* name of raw monitor */   /*ibm@31526*/
  220.             JVMPI_RawMonitor id;        /* id */
  221.         } raw_monitor;
  222.  
  223.         struct {
  224.             jobjectID object;           /* Java object */
  225.         } monitor;
  226.  
  227.         struct {
  228.             jobjectID object;           /* Java object */
  229.             jlong timeout;              /* timeout period */
  230.         } monitor_wait;
  231.  
  232.         struct {
  233.             jlong used_objects;
  234.             jlong used_object_space;
  235.             jlong total_object_space;
  236.         } gc_info;
  237.  
  238.         struct {
  239.             jsize data_len;                                         /*ibm@9486*/
  240.             char *data;
  241.         } object_dump;
  242.  
  243.         struct {                        /*ibm@5637*/
  244.             jmethodID method_id; /* id of the method the instruction belongs to */
  245.             jint offset;         /* instruction offset in the method's bytecode */
  246.             union {
  247.             struct {
  248.                 jboolean is_true; /* whether true or false branch is taken  */
  249.             } if_info;
  250.             struct {
  251.                 jint key; /* top stack value used as an index */
  252.                 jint low; /* min value of the index           */
  253.                 jint hi;  /* max value of the index           */
  254.             } tableswitch_info;
  255.             struct {
  256.                 jint chosen_pair_index; /* actually chosen pair index (0-based)
  257.                                                  * if chosen_pair_index == pairs_total then
  258.                                                  * the 'default' branch is taken
  259.                                                  */
  260.                 jint pairs_total;       /* total number of lookupswitch pairs */
  261.             } lookupswitch_info;
  262.             } u;
  263.         } instruction;                  /*ibm@5637*/
  264.  
  265.         struct {
  266.             jmethodID method_id;      /* id of method */
  267.             jobjectID obj_id;         /* id of target object */
  268.             jint flags;               /* control flags */
  269.             jint reserv1;
  270.             jint reserv2;
  271.             jint reserv3;
  272.             jint reserv4;
  273.             jint reserv5;
  274.             jint reserv6;
  275.             jint reserv7;
  276.             jint reserv8;
  277.         } generic_event;              /* ibm@4458 */
  278.  
  279.         struct {
  280.             jmethodID method_id;      /* id of compiled method  or zero */
  281.             jobjectID obj_id;         /* id of target object or zero */
  282.             jsize flags;              /* control flags -- set to zero */
  283.             char *code_name;          /* name used for generated code such as mmi code on  AIX or zero */
  284.             jint edesc;               /* event description: 1- name format */
  285.             jint ld_ind;              /* load indicator: 1=load, 2=unload */
  286.             void *code_addr;          /* code start addr. in memory */
  287.             jint code_size;           /* code size  */
  288.             jint lineno_table_size;   /* size of lineno table or zero */
  289.             JVMPI_Lineno *lineno_table; /* lineno info or zero */
  290.         } generic_compiled_method_load; /* ibm@28742 */
  291.  
  292.     } u;
  293. } JVMPI_Event;
  294.  
  295. /* interface functions */
  296. typedef struct {
  297.     jint version;   /* JVMPI version */
  298.  
  299.     /* ------interface implemented by the profiler------ */
  300.  
  301.     /**
  302.      * Function called by the JVM to notify an event.
  303.      */
  304.     void (XJNICALL *NotifyEvent)(JVMPI_Event *event);             /*ibm@10717*/
  305.  
  306.     /* ------interface implemented by the JVM------ */
  307.  
  308.     /**
  309.      * Function called by the profiler to enable/disable/send notification
  310.      * for a particular event type.
  311.      *
  312.      * event_type - event_type
  313.      * arg - event specific arg
  314.      *
  315.      * return JVMPI_NOT_AVAILABLE, JVMPI_SUCCESS or JVMPI_FAIL
  316.      */
  317.     jint (XJNICALL *EnableEvent)(jint event_type, void *arg);     /*ibm@10717*/
  318.     jint (XJNICALL *DisableEvent)(jint event_type, void *arg);    /*ibm@10717*/
  319.     jint (XJNICALL *RequestEvent)(jint event_type, void *arg);    /*ibm@10717*/
  320.  
  321.     /**
  322.      * Function called by the profiler to get a stack
  323.      * trace from the JVM.
  324.      *
  325.      * trace - trace data structure to be filled
  326.      * depth - maximum depth of the trace.
  327.      */
  328.     void (XJNICALL *GetCallTrace)(JVMPI_CallTrace *trace, jint depth); /*ibm@10717*/
  329.  
  330.     /**
  331.      * Function called by profiler when it wants to exit/stop.
  332.      */
  333.     void (XJNICALL *ProfilerExit)(jint);                          /*ibm@10717*/
  334.  
  335.     /**
  336.      * Utility functions provided by the JVM.
  337.      */
  338.     JVMPI_RawMonitor (XJNICALL *RawMonitorCreate)(char *lock_name); /*ibm@10717*/
  339.     void (XJNICALL *RawMonitorEnter)(JVMPI_RawMonitor lock_id);   /*ibm@10717*/
  340.     void (XJNICALL *RawMonitorExit)(JVMPI_RawMonitor lock_id);    /*ibm@10717*/
  341.     void (XJNICALL *RawMonitorWait)(JVMPI_RawMonitor lock_id, jlong ms); /*ibm@10717*/
  342.     void (XJNICALL *RawMonitorNotifyAll)(JVMPI_RawMonitor lock_id); /*ibm@10717*/
  343.     void (XJNICALL *RawMonitorDestroy)(JVMPI_RawMonitor lock_id); /*ibm@10717*/
  344.  
  345.     /**
  346.      * Function called by the profiler to get the current thread's CPU time.
  347.      *
  348.      * return time in nanoseconds;
  349.      */
  350.     jlong (XJNICALL *GetCurrentThreadCpuTime)(void);              /*ibm@10717*/
  351.  
  352.     void (XJNICALL *SuspendThread)(JNIEnv *env);                  /*ibm@10717*/
  353.     void (XJNICALL *ResumeThread)(JNIEnv *env);                   /*ibm@10717*/
  354.     jint (XJNICALL *GetThreadStatus)(JNIEnv *env);                /*ibm@10717*/
  355.     jboolean (XJNICALL *ThreadHasRun)(JNIEnv *env);               /*ibm@10717*/
  356.  
  357.     /* This function can be called safely only after JVMPI_EVENT_VM_INIT_DONE
  358.        notification by the JVM. */
  359.     jint (XJNICALL *CreateSystemThread)(char *name, jint priority, void (XJNICALL *f)(void *)); /*ibm@10717 ibm@23209*/
  360.  
  361.     /* thread local storage access functions to avoid locking in time
  362.        critical functions */
  363.     void (XJNICALL *SetThreadLocalStorage)(JNIEnv *env_id, void *ptr); /*ibm@10717*/
  364.     void * (XJNICALL *GetThreadLocalStorage)(JNIEnv *env_id);     /*ibm@10717*/
  365.  
  366.     /* control GC */
  367.     void (XJNICALL *DisableGC)(void);                             /*ibm@10717*/
  368.     void (XJNICALL *EnableGC)(void);                              /*ibm@10717*/
  369.     void (XJNICALL *RunGC)(void);                                 /*ibm@10717*/
  370.  
  371.     jobjectID (XJNICALL *GetThreadObject)(JNIEnv *env);           /*ibm@10717*/
  372.     jobjectID (XJNICALL *GetMethodClass)(jmethodID mid);          /*ibm@10717*/
  373.  
  374.     /* JNI <-> jobject conversions */
  375.     jobject   (XJNICALL *jobjectID2jobject)(jobjectID jid);  /*ibm@9193 10717*/
  376.     jobjectID (XJNICALL *jobject2jobjectID)(jobject jobj);   /*ibm@9193 10717*/
  377.  
  378. } JVMPI_Interface;
  379.  
  380. /* type of argument passed to RequestEvent for heap dumps */
  381. typedef struct {
  382.     jint heap_dump_level;
  383. } JVMPI_HeapDumpArg;
  384.  
  385. /**********************************************************************
  386.  * Constants and formats used in JVM Profiler Interface.
  387.  **********************************************************************/
  388. /*
  389.  * Event type constants.
  390.  */
  391.  
  392. #define JVMPI_EVENT_METHOD_ENTRY            ((jint)1)
  393. #define JVMPI_EVENT_METHOD_ENTRY2           ((jint)2)
  394. #define JVMPI_EVENT_METHOD_EXIT             ((jint)3)
  395.  
  396. #define JVMPI_EVENT_OBJECT_ALLOC            ((jint)4)
  397. #define JVMPI_EVENT_OBJECT_FREE             ((jint)5)
  398. #define JVMPI_EVENT_OBJECT_MOVE             ((jint)6)
  399.  
  400. #define JVMPI_EVENT_COMPILED_METHOD_LOAD    ((jint)7)
  401. #define JVMPI_EVENT_COMPILED_METHOD_UNLOAD  ((jint)8)
  402.  
  403. #define JVMPI_EVENT_INSTRUCTION_START       ((jint)9)       /*ibm@5637*/
  404.  
  405. #define JVMPI_EVENT_THREAD_START           ((jint)33)
  406. #define JVMPI_EVENT_THREAD_END             ((jint)34)
  407.  
  408. #define JVMPI_EVENT_CLASS_LOAD_HOOK        ((jint)35)
  409.  
  410. #define JVMPI_EVENT_HEAP_DUMP                     ((jint)37)
  411. #define JVMPI_EVENT_JNI_GLOBALREF_ALLOC           ((jint)38)
  412. #define JVMPI_EVENT_JNI_GLOBALREF_FREE            ((jint)39)
  413. #define JVMPI_EVENT_JNI_WEAK_GLOBALREF_ALLOC      ((jint)40)
  414. #define JVMPI_EVENT_JNI_WEAK_GLOBALREF_FREE       ((jint)41)
  415. #define JVMPI_EVENT_CLASS_LOAD                    ((jint)42)
  416. #define JVMPI_EVENT_CLASS_UNLOAD                  ((jint)43)
  417. #define JVMPI_EVENT_DATA_DUMP_REQUEST             ((jint)44)
  418. #define JVMPI_EVENT_DATA_RESET_REQUEST            ((jint)45)
  419.  
  420. #define JVMPI_EVENT_JVM_INIT_DONE          ((jint)46)
  421. #define JVMPI_EVENT_JVM_SHUT_DOWN          ((jint)47)
  422.  
  423. #define JVMPI_EVENT_ARENA_NEW              ((jint)48)
  424. #define JVMPI_EVENT_ARENA_DELETE           ((jint)49)
  425.  
  426. #define JVMPI_EVENT_OBJECT_DUMP            ((jint)50)
  427.  
  428. #define JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTER   ((jint)51)
  429. #define JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTERED ((jint)52)
  430. #define JVMPI_EVENT_RAW_MONITOR_CONTENDED_EXIT    ((jint)53)
  431. #define JVMPI_EVENT_MONITOR_CONTENDED_ENTER       ((jint)54)
  432. #define JVMPI_EVENT_MONITOR_CONTENDED_ENTERED     ((jint)55)
  433. #define JVMPI_EVENT_MONITOR_CONTENDED_EXIT        ((jint)56)
  434. #define JVMPI_EVENT_MONITOR_WAIT                  ((jint)57)
  435. #define JVMPI_EVENT_MONITOR_WAITED                ((jint)58)
  436. #define JVMPI_EVENT_MONITOR_DUMP                  ((jint)59)
  437.  
  438. #define JVMPI_EVENT_GC_START                      ((jint)60)
  439. #define JVMPI_EVENT_GC_FINISH                     ((jint)61)
  440.  
  441. #define JVMPI_MAX_EVENT_TYPE_VAL                  ((jint)61)
  442.  
  443. /* old definitions, to be removed */
  444. #define JVMPI_EVENT_LOAD_COMPILED_METHOD          ((jint)7)
  445. #define JVMPI_EVENT_UNLOAD_COMPILED_METHOD        ((jint)8)
  446. #define JVMPI_EVENT_NEW_ARENA                     ((jint)48)
  447. #define JVMPI_EVENT_DELETE_ARENA                  ((jint)49)
  448. #define JVMPI_EVENT_DUMP_DATA_REQUEST             ((jint)44)
  449. #define JVMPI_EVENT_RESET_DATA_REQUEST            ((jint)45)
  450. #define JVMPI_EVENT_OBJ_ALLOC                     ((jint)4)
  451. #define JVMPI_EVENT_OBJ_FREE                      ((jint)5)
  452. #define JVMPI_EVENT_OBJ_MOVE                      ((jint)6)
  453.  
  454. #define JVMPI_REQUESTED_EVENT                     ((jint)0x10000000)
  455.  
  456. /*
  457.  * IBM definitions for JIT profiling
  458.  */
  459.  
  460. #define JVMPI_EVENT_PROFILER_ENABLED              ((jint)31)        /*ibm@4142*/
  461.  
  462. #define JVMPI_EVENT_DISABLE_COMPATIBILITY         ((jint )2000)         /*ibm@1424*/
  463. #define JVMPI_EVENT_GEN_COMPILED_METHOD           ((jint )2001)         /*ibm@1424*/
  464. #define JVMPI_EVENT_GEN_INLINE_METHOD             ((jint )2002)         /*ibm@1424*/
  465. #define JVMPI_EVENT_GEN_BUILTIN_METHOD            ((jint )2003)         /*ibm@1424*/
  466. #define JVMPI_EVENT_COMPILED_METHOD_ENTRY         ((jint )2004)         /*ibm@1424*/
  467. #define JVMPI_EVENT_COMPILED_METHOD_ENTRY2        ((jint )2005)         /*ibm@1424*/
  468. #define JVMPI_EVENT_COMPILED_METHOD_EXIT          ((jint )2006)         /*ibm@1424*/
  469. #define JVMPI_EVENT_INLINE_METHOD_ENTRY           ((jint )2007)         /*ibm@1424*/
  470. #define JVMPI_EVENT_INLINE_METHOD_ENTRY2          ((jint )2008)         /*ibm@1424*/
  471. #define JVMPI_EVENT_BUILTIN_METHOD_ENTRY          ((jint )2009)         /*ibm@1424*/
  472. #define JVMPI_EVENT_BUILTIN_METHOD_ENTRY2         ((jint )2010)         /*ibm@1424*/
  473. #define JVMPI_EVENT_NATIVE_METHOD_ENTRY           ((jint )2011)         /*ibm@1424*/
  474. #define JVMPI_EVENT_NATIVE_METHOD_ENTRY2          ((jint )2012)         /*ibm@1424*/
  475. #define JVMPI_EVENT_COMPILING_START               ((jint )2013)         /*ibm@1424*/
  476. #define JVMPI_EVENT_COMPILING_END                 ((jint )2014)         /*ibm@1424*/
  477. #define JVMPI_EVENT_COMPILER_GC_START             ((jint )2015)         /*ibm@1424*/
  478. #define JVMPI_EVENT_COMPILER_GC_END               ((jint )2016)         /*ibm@1424*/
  479. #define JVMPI_EVENT_OBJ_ALLOC_FAILURE             ((jint )2017)         /*ibm@28742*//*ibm@35833*/
  480. #define JVMPI_EVENT_COMPILED_METHOD_LOAD2         ((jint )2018)         /*ibm@28742*//*ibm@35833*/
  481. #define JVMPI_EVENT_DUMMY3                        ((jint )2019)         /*ibm@4458*/
  482. #define JVMPI_EVENT_DUMMY4                        ((jint )2020)         /*ibm@4458*/
  483. #define JVMPI_EVENT_DUMMY5                        ((jint )2021)         /*ibm@4458*/
  484. #define JVMPI_EVENT_DUMMY6                        ((jint )2022)         /*ibm@4458*/
  485. #define JVMPI_EVENT_DUMMY7                        ((jint )2023)         /*ibm@4458*/
  486. #define JVMPI_EVENT_DUMMY8                        ((jint )2024)         /*ibm@4458*/
  487.  
  488. #define JVMPI_IBM_EVENT_START                     JVMPI_EVENT_DISABLE_COMPATIBILITY                     /*ibm@1424*/
  489. #define JVMPI_IBM_EVENT_END                       JVMPI_EVENT_DUMMY8                                    /*ibm@4458*/
  490. #define JVMPI_IBM_EVENTS                          JVMPI_IBM_EVENT_END-JVMPI_IBM_EVENT_START+1           /*ibm@1424*/
  491.  
  492. #define JVMPI_GENERIC_FLAG_DISABLE_GC   ((jint)1)       /*ibm@4458*/
  493. #define JVMPI_GENERIC_FLAG_CHECK_EVENT  ((jint)2)       /*ibm@4458*/
  494.  
  495. /*
  496.  * IBM definitions for JIT profiling
  497.  */
  498.  
  499.  
  500. /*
  501.  * enabling/disabling event notification.
  502.  */
  503. /* results */
  504. #define JVMPI_SUCCESS                    ((jint)0)
  505. #define JVMPI_NOT_AVAILABLE              ((jint)1)
  506. #define JVMPI_FAIL                       ((jint)-1)
  507.  
  508. /*
  509.  * Compiled method load2 indicators               ibm@28742
  510.  */
  511. #define JVMPI_LOAD                      1      /* ibm@28742 */
  512. #define JVMPI_UNLOAD                    2      /* ibm@28742 */
  513.  
  514. /*
  515.  * Compiled method load2 description              ibm@28742
  516.  */
  517. #define JVMPI_NAME_FORMAT               1      /* ibm@28742 */
  518.  
  519. /*
  520.  * Thread status
  521.  */
  522. enum {
  523.     JVMPI_THREAD_RUNNABLE = 1,
  524.     JVMPI_THREAD_MONITOR_WAIT,
  525.     JVMPI_THREAD_CONDVAR_WAIT
  526. };
  527.  
  528. #define JVMPI_THREAD_SUSPENDED        0x8000
  529. #define JVMPI_THREAD_INTERRUPTED      0x4000
  530.  
  531. /*
  532.  * Thread priority
  533.  */
  534. #define JVMPI_MINIMUM_PRIORITY      1
  535. #define JVMPI_MAXIMUM_PRIORITY      10
  536. #define JVMPI_NORMAL_PRIORITY       5
  537.  
  538. /*
  539.  * Object type constants.
  540.  */
  541. #define JVMPI_NORMAL_OBJECT              ((jint)0)
  542. #define JVMPI_CLASS                      ((jint)2)
  543. #define JVMPI_BOOLEAN                    ((jint)4)
  544. #define JVMPI_CHAR                       ((jint)5)
  545. #define JVMPI_FLOAT                      ((jint)6)
  546. #define JVMPI_DOUBLE                     ((jint)7)
  547. #define JVMPI_BYTE                       ((jint)8)
  548. #define JVMPI_SHORT                      ((jint)9)
  549. #define JVMPI_INT                        ((jint)10)
  550. #define JVMPI_LONG                       ((jint)11)
  551.  
  552. /*
  553.  * Monitor dump constants.
  554.  */
  555.  
  556. #define JVMPI_MONITOR_JAVA          0x01
  557. #define JVMPI_MONITOR_RAW           0x02
  558.  
  559. /*
  560.  * Heap dump constants.
  561.  */
  562. #define JVMPI_GC_ROOT_UNKNOWN       0xff
  563. #define JVMPI_GC_ROOT_JNI_GLOBAL    0x01
  564. #define JVMPI_GC_ROOT_JNI_LOCAL     0x02
  565. #define JVMPI_GC_ROOT_JAVA_FRAME    0x03
  566. #define JVMPI_GC_ROOT_NATIVE_STACK  0x04
  567. #define JVMPI_GC_ROOT_STICKY_CLASS  0x05
  568. #define JVMPI_GC_ROOT_THREAD_BLOCK  0x06
  569. #define JVMPI_GC_ROOT_MONITOR_USED  0x07
  570. #define JVMPI_GC_ROOT_THREAD_OBJ    0x08
  571.  
  572. #define JVMPI_GC_CLASS_DUMP         0x20
  573. #define JVMPI_GC_INSTANCE_DUMP      0x21
  574. #define JVMPI_GC_OBJ_ARRAY_DUMP     0x22
  575. #define JVMPI_GC_PRIM_ARRAY_DUMP    0x23
  576.  
  577. /*
  578.  * Dump levels
  579.  */
  580. #define JVMPI_DUMP_LEVEL_0    ((jint)0)
  581. #define JVMPI_DUMP_LEVEL_1    ((jint)1)
  582. #define JVMPI_DUMP_LEVEL_2    ((jint)2)
  583.  
  584. /* Types used in dumps -
  585.  *
  586.  * u1: 1 byte
  587.  * u2: 2 bytes
  588.  * u4: 4 bytes
  589.  * u8: 8 bytes
  590.  *
  591.  * ty: u1 where:
  592.  *     JVMPI_CLASS:   object
  593.  *     JVMPI_BOOLEAN: boolean
  594.  *     JVMPI_CHAR:    char
  595.  *     JVMPI_FLOAT:   float
  596.  *     JVMPI_DOUBLE:  double
  597.  *     JVMPI_BYTE:    byte
  598.  *     JVMPI_SHORT:   short
  599.  *     JVMPI_INT:     int
  600.  *     JVMPI_LONG:    long
  601.  *
  602.  * vl: values, exact type depends on the type of the value:
  603.  *     JVMPI_BOOLEAN & JVMPI_BYTE:   u1
  604.  *     JVMPI_SHORT & JVMPI_CHAR:     u2
  605.  *     JVMPI_INT & JVMPI_FLOAT:      u4
  606.  *     JVMPI_LONG & JVMPI_DOUBLE:    u8
  607.  *     JVMPI_CLASS:                  jobjectID
  608.  */
  609.  
  610. /* Format of the monitor dump buffer:
  611.  *
  612.  *               u1                          monitor type
  613.  *
  614.  *               JVMPI_MONITOR_JAVA          Java monitor
  615.  *
  616.  *                          jobjectID        object
  617.  *                          JNIEnv *         owner thread
  618.  *                          u4               entry count
  619.  *                          u4               # of threads waiting to enter
  620.  *                          [JNIEnv *]*      threads waiting to enter
  621.  *                          u4               # of threads waiting to be notified
  622.  *                          [JNIEnv *]*      threads waiting to be notified
  623.  *
  624.  *               JVMPI_MONITOR_RAW           raw monitor
  625.  *
  626.  *                          char *           name
  627.  *                          JVMPI_RawMonitor raw monitor
  628.  *                          JNIEnv *         owner thread
  629.  *                          u4               entry count
  630.  *                          u4               # of threads waiting to enter
  631.  *                          [JNIEnv *]*      threads waiting to enter
  632.  *                          u4               # of threads waiting to be notified
  633.  *                          [JNIEnv *]*      threads waiting to be notified
  634.  */
  635.  
  636. /* Format of the heap dump buffer depends on the dump level
  637.  * specified in the JVMPI_HeapDumpArg passed to RequestEvent as arg.
  638.  * The default is JVMPI_DUMP_LEVEL_2.
  639.  *
  640.  * JVMPI_DUMP_LEVEL_0:
  641.  *
  642.  *               u1                          object type (JVMPI_CLASS ...)
  643.  *               jobjectID                   object
  644.  *
  645.  * JVMPI_DUMP_LEVEL_1 and JVMPI_DUMP_LEVEL_2 use the following format:
  646.  * In the case of JVMPI_DUMP_LEVEL_1 the values of primitive fields in object
  647.  * instance dumps , the values of primitive statics in class dumps and the
  648.  * values of primitive arrays are excluded.  JVMPI_DUMP_LEVEL_2 includes the
  649.  * primitive values.
  650.  *
  651.  *               u1                          record type
  652.  *
  653.  *               JVMPI_GC_ROOT_UNKNOWN       unknown root
  654.  *
  655.  *                          jobjectID        object
  656.  *
  657.  *               JVMPI_GC_ROOT_JNI_GLOBAL    JNI global ref root
  658.  *
  659.  *                          jobjectID        object
  660.  *                          jobject          JNI global reference
  661.  *
  662.  *               JVMPI_GC_ROOT_JNI_LOCAL     JNI local ref
  663.  *
  664.  *                          jobjectID        object
  665.  *                          JNIEnv *         thread
  666.  *                          u4               frame # in stack trace (-1 for empty)
  667.  *
  668.  *               JVMPI_GC_ROOT_JAVA_FRAME    Java stack frame
  669.  *
  670.  *                          jobjectID        object
  671.  *                          JNIEnv *         thread
  672.  *                          u4               frame # in stack trace (-1 for empty)
  673.  *
  674.  *               JVMPI_GC_ROOT_NATIVE_STACK  Native stack
  675.  *
  676.  *                          jobjectID        object
  677.  *                          JNIEnv *         thread
  678.  *
  679.  *               JVMPI_GC_ROOT_STICKY_CLASS  System class
  680.  *
  681.  *                          jobjectID        class object
  682.  *
  683.  *               JVMPI_GC_ROOT_THREAD_BLOCK  Reference from thread block
  684.  *
  685.  *                          jobjectID        thread object
  686.  *                          JNIEnv *         thread
  687.  *
  688.  *               JVMPI_GC_ROOT_MONITOR_USED  Busy monitor
  689.  *
  690.  *                          jobjectID        object
  691.  *
  692.  *               JVMPI_GC_CLASS_DUMP         dump of a class object
  693.  *
  694.  *                          jobjectID        class
  695.  *                          jobjectID        super
  696.  *                          jobjectID        class loader
  697.  *                          jobjectID        signers
  698.  *                          jobjectID        protection domain
  699.  *                          jobjectID        class name
  700.  *                          void *           reserved
  701.  *
  702.  *                          u4               instance size (in bytes)
  703.  *
  704.  *                          [jobjectID]*     interfaces
  705.  *
  706.  *                          u2               size of constant pool
  707.  *                          [u2,             constant pool index,
  708.  *                           ty,             type,
  709.  *                           vl]*            value
  710.  *
  711.  *                          [vl]*            static field values
  712.  *
  713.  *               JVMPI_GC_INSTANCE_DUMP      dump of a normal object
  714.  *
  715.  *                          jobjectID        object
  716.  *                          jobjectID        class
  717.  *                          u4               number of bytes that follow
  718.  *                          [vl]*            instance field values (class, followed
  719.  *                                           by super, super's super ...)
  720.  *
  721.  *               JVMPI_GC_OBJ_ARRAY_DUMP     dump of an object array
  722.  *
  723.  *                          jobjectID        array object
  724.  *                          u4               number of elements
  725.  *                          jobjectID        element class
  726.  *                          [jobjectID]*     elements
  727.  *
  728.  *               JVMPI_GC_PRIM_ARRAY_DUMP    dump of a primitive array
  729.  *
  730.  *                          jobjectID        array object
  731.  *                          u4               number of elements
  732.  *                          ty               element type
  733.  *                          [vl]*            elements
  734.  *
  735.  */
  736.  
  737. /* Format of the dump received in JVMPI_EVENT_OBJECT_DUMP:
  738.  * All the records have JVMPI_DUMP_LEVEL_2 information.
  739.  *
  740.  *               u1                          record type
  741.  *
  742.  *                     followed by a:
  743.  *
  744.  *                          JVMPI_GC_CLASS_DUMP,
  745.  *                          JVMPI_GC_INSTANCE_DUMP,
  746.  *                          JVMPI_GC_OBJ_ARRAY_DUMP, or
  747.  *                          JVMPI_GC_PRIM_ARRAY_DUMP record.
  748.  */
  749.  
  750.  
  751. #ifdef __cplusplus
  752. } /* ibm@8444 extern C */
  753. #endif /*__cplusplus */
  754. #endif /* !_JAVASOFT_JVMPI_H_ */
  755.