home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Java / Java.zip / jaseh131.zip / jvmpi.h < prev    next >
C/C++ Source or Header  |  2002-08-31  |  31KB  |  756 lines

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