[trunk] Remove copyrighted material from java-jni. Import patch from 1.5 over to trunk/JavaOpenJPEG

This commit is contained in:
Mathieu Malaterre 2012-03-02 09:20:13 +00:00
parent 564deec2c4
commit 9e52c330ae
11 changed files with 40 additions and 6387 deletions

View File

@ -1,33 +1,47 @@
#JavaOpenJPEG/CMakeLists.txt
# First thing define the common source:
SET(common_SRCS
../codec/convert.c
../codec/index.c
../common/opj_getopt.c
SET(openjpegjni_SRCS
JavaOpenJPEGDecoder.c
JavaOpenJPEG.c
)
# JNI binding:
find_package(JNI REQUIRED)
include_directories(${JNI_INCLUDE_DIRS})
# Headers file are located here:
INCLUDE_DIRECTORIES(
# required header file:
include_directories(
${OPENJPEG_SOURCE_DIR}/libopenjpeg
${LCMS_INCLUDE_DIR}
${PNG_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${TIFF_INCLUDE_DIR}
${OPENJPEG_SOURCE_DIR}/applications/common
${OPENJPEG_SOURCE_DIR}/applications/codec
)
# Loop over all executables:
FOREACH(exe j2k_to_image image_to_j2k)
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
TARGET_LINK_LIBRARIES(${exe} ${OPJ_PREFIX}openjpeg ${TIFF_LIBRARIES}
${PNG_LIBRARIES} ${ZLIB_LIBRARY} ${LCMS_LIB})
# On unix you need to link to the math library:
IF(UNIX)
TARGET_LINK_LIBRARIES(${exe} -lm)
ENDIF(UNIX)
# Install exe
INSTALL_TARGETS(/bin/ ${exe})
ENDFOREACH(exe)
add_library(openjpegjni MODULE
${openjpegjni_SRCS}
)
# build jar:
FIND_PACKAGE(Java 1.5 REQUIRED) # javac, jar
# build dep list:
file(GLOB java_srcs "java-sources/org/openJpeg/*.java")
# make sure target javac dir exists:
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes)
# Build java
ADD_CUSTOM_COMMAND(
OUTPUT ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
COMMAND ${Java_JAVAC_EXECUTABLE} -sourcepath "${CMAKE_CURRENT_SOURCE_DIR}/java-sources"
${java_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes
COMMAND ${Java_JAR_EXECUTABLE} cvf ${LIBRARY_OUTPUT_PATH}/openjpeg.jar org
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes
DEPENDS ${java_srcs}
COMMENT "javac *.java; jar cvf -> openjpeg.jar"
)
# name the target
ADD_CUSTOM_TARGET(OpenJPEGJavaJar ALL
DEPENDS ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
COMMENT "building openjpeg.jar"
)

View File

@ -380,7 +380,7 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres){
}
void cinema_parameters(opj_cparameters_t *parameters){
parameters->tile_size_on = false;
parameters->tile_size_on = OPJ_FALSE;
parameters->cp_tdx=1;
parameters->cp_tdy=1;
@ -663,7 +663,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
case 't': /* tiles */
{
sscanf(opj_optarg, "%d,%d", &parameters->cp_tdx, &parameters->cp_tdy);
parameters->tile_size_on = true;
parameters->tile_size_on = OPJ_TRUE;
}
break;
@ -1628,7 +1628,7 @@ opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj,
jbyte *jbBody;
jshort *jsBody;
jint *jiBody;
boolean isCopy;
jboolean isCopy;
// Image width, height and depth
fid = (*env)->GetFieldID(env, cls,"width", "I");
@ -1776,7 +1776,7 @@ opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj,
JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImageToJ2K(JNIEnv *env, jobject obj, jobjectArray javaParameters) {
int argc; /* To simulate the command line parameters (taken from the javaParameters variable) and be able to re-use the */
char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */
bool bSuccess;
opj_bool bSuccess;
opj_cparameters_t parameters; /* compression parameters */
img_fol_t img_fol;
opj_event_mgr_t event_mgr; /* event manager */

View File

@ -1,278 +0,0 @@
/*
* @(#)jawt.h 1.10 03/12/19
*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
#ifndef _JAVASOFT_JAWT_H_
#define _JAVASOFT_JAWT_H_
#include "jni.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* AWT native interface (new in JDK 1.3)
*
* The AWT native interface allows a native C or C++ application a means
* by which to access native structures in AWT. This is to facilitate moving
* legacy C and C++ applications to Java and to target the needs of the
* community who, at present, wish to do their own native rendering to canvases
* for performance reasons. Standard extensions such as Java3D also require a
* means to access the underlying native data structures of AWT.
*
* There may be future extensions to this API depending on demand.
*
* A VM does not have to implement this API in order to pass the JCK.
* It is recommended, however, that this API is implemented on VMs that support
* standard extensions, such as Java3D.
*
* Since this is a native API, any program which uses it cannot be considered
* 100% pure java.
*/
/*
* AWT Native Drawing Surface (JAWT_DrawingSurface).
*
* For each platform, there is a native drawing surface structure. This
* platform-specific structure can be found in jawt_md.h. It is recommended
* that additional platforms follow the same model. It is also recommended
* that VMs on Win32 and Solaris support the existing structures in jawt_md.h.
*
*******************
* EXAMPLE OF USAGE:
*******************
*
* In Win32, a programmer wishes to access the HWND of a canvas to perform
* native rendering into it. The programmer has declared the paint() method
* for their canvas subclass to be native:
*
*
* MyCanvas.java:
*
* import java.awt.*;
*
* public class MyCanvas extends Canvas {
*
* static {
* System.loadLibrary("mylib");
* }
*
* public native void paint(Graphics g);
* }
*
*
* myfile.c:
*
* #include "jawt_md.h"
* #include <assert.h>
*
* JNIEXPORT void JNICALL
* Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
* {
* JAWT awt;
* JAWT_DrawingSurface* ds;
* JAWT_DrawingSurfaceInfo* dsi;
* JAWT_Win32DrawingSurfaceInfo* dsi_win;
* jboolean result;
* jint lock;
*
* // Get the AWT
* awt.version = JAWT_VERSION_1_3;
* result = JAWT_GetAWT(env, &awt);
* assert(result != JNI_FALSE);
*
* // Get the drawing surface
* ds = awt.GetDrawingSurface(env, canvas);
* assert(ds != NULL);
*
* // Lock the drawing surface
* lock = ds->Lock(ds);
* assert((lock & JAWT_LOCK_ERROR) == 0);
*
* // Get the drawing surface info
* dsi = ds->GetDrawingSurfaceInfo(ds);
*
* // Get the platform-specific drawing info
* dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
*
* //////////////////////////////
* // !!! DO PAINTING HERE !!! //
* //////////////////////////////
*
* // Free the drawing surface info
* ds->FreeDrawingSurfaceInfo(dsi);
*
* // Unlock the drawing surface
* ds->Unlock(ds);
*
* // Free the drawing surface
* awt.FreeDrawingSurface(ds);
* }
*
*/
/*
* JAWT_Rectangle
* Structure for a native rectangle.
*/
typedef struct jawt_Rectangle {
jint x;
jint y;
jint width;
jint height;
} JAWT_Rectangle;
struct jawt_DrawingSurface;
/*
* JAWT_DrawingSurfaceInfo
* Structure for containing the underlying drawing information of a component.
*/
typedef struct jawt_DrawingSurfaceInfo {
/*
* Pointer to the platform-specific information. This can be safely
* cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a
* JAWT_X11DrawingSurfaceInfo on Solaris. See jawt_md.h for details.
*/
void* platformInfo;
/* Cached pointer to the underlying drawing surface */
struct jawt_DrawingSurface* ds;
/* Bounding rectangle of the drawing surface */
JAWT_Rectangle bounds;
/* Number of rectangles in the clip */
jint clipSize;
/* Clip rectangle array */
JAWT_Rectangle* clip;
} JAWT_DrawingSurfaceInfo;
#define JAWT_LOCK_ERROR 0x00000001
#define JAWT_LOCK_CLIP_CHANGED 0x00000002
#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004
#define JAWT_LOCK_SURFACE_CHANGED 0x00000008
/*
* JAWT_DrawingSurface
* Structure for containing the underlying drawing information of a component.
* All operations on a JAWT_DrawingSurface MUST be performed from the same
* thread as the call to GetDrawingSurface.
*/
typedef struct jawt_DrawingSurface {
/*
* Cached reference to the Java environment of the calling thread.
* If Lock(), Unlock(), GetDrawingSurfaceInfo() or
* FreeDrawingSurfaceInfo() are called from a different thread,
* this data member should be set before calling those functions.
*/
JNIEnv* env;
/* Cached reference to the target object */
jobject target;
/*
* Lock the surface of the target component for native rendering.
* When finished drawing, the surface must be unlocked with
* Unlock(). This function returns a bitmask with one or more of the
* following values:
*
* JAWT_LOCK_ERROR - When an error has occurred and the surface could not
* be locked.
*
* JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
*
* JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
*
* JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
*/
jint (JNICALL *Lock)
(struct jawt_DrawingSurface* ds);
/*
* Get the drawing surface info.
* The value returned may be cached, but the values may change if
* additional calls to Lock() or Unlock() are made.
* Lock() must be called before this can return a valid value.
* Returns NULL if an error has occurred.
* When finished with the returned value, FreeDrawingSurfaceInfo must be
* called.
*/
JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
(struct jawt_DrawingSurface* ds);
/*
* Free the drawing surface info.
*/
void (JNICALL *FreeDrawingSurfaceInfo)
(JAWT_DrawingSurfaceInfo* dsi);
/*
* Unlock the drawing surface of the target component for native rendering.
*/
void (JNICALL *Unlock)
(struct jawt_DrawingSurface* ds);
} JAWT_DrawingSurface;
/*
* JAWT
* Structure for containing native AWT functions.
*/
typedef struct jawt {
/*
* Version of this structure. This must always be set before
* calling JAWT_GetAWT()
*/
jint version;
/*
* Return a drawing surface from a target jobject. This value
* may be cached.
* Returns NULL if an error has occurred.
* Target must be a java.awt.Component (should be a Canvas
* or Window for native rendering).
* FreeDrawingSurface() must be called when finished with the
* returned JAWT_DrawingSurface.
*/
JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
(JNIEnv* env, jobject target);
/*
* Free the drawing surface allocated in GetDrawingSurface.
*/
void (JNICALL *FreeDrawingSurface)
(JAWT_DrawingSurface* ds);
/*
* Since 1.4
* Locks the entire AWT for synchronization purposes
*/
void (JNICALL *Lock)(JNIEnv* env);
/*
* Since 1.4
* Unlocks the entire AWT for synchronization purposes
*/
void (JNICALL *Unlock)(JNIEnv* env);
/*
* Since 1.4
* Returns a reference to a java.awt.Component from a native
* platform handle. On Windows, this corresponds to an HWND;
* on Solaris and Linux, this is a Drawable. For other platforms,
* see the appropriate machine-dependent header file for a description.
* The reference returned by this function is a local
* reference that is only valid in this environment.
* This function returns a NULL reference if no component could be
* found with matching platform information.
*/
jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
} JAWT;
/*
* Get the AWT native structure. This function returns JNI_FALSE if
* an error occurs.
*/
_JNI_IMPORT_OR_EXPORT_
jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
#define JAWT_VERSION_1_3 0x00010003
#define JAWT_VERSION_1_4 0x00010004
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* !_JAVASOFT_JAWT_H_ */

View File

@ -1,237 +0,0 @@
/*
* @(#)jdwpTransport.h 1.7 03/12/19
*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
/*
* Java Debug Wire Protocol Transport Service Provider Interface.
*/
#ifndef JDWPTRANSPORT_H
#define JDWPTRANSPORT_H
#include "jni.h"
enum {
JDWPTRANSPORT_VERSION_1_0 = 0x00010000
};
#ifdef __cplusplus
extern "C" {
#endif
struct jdwpTransportNativeInterface_;
struct _jdwpTransportEnv;
#ifdef __cplusplus
typedef _jdwpTransportEnv jdwpTransportEnv;
#else
typedef const struct jdwpTransportNativeInterface_ *jdwpTransportEnv;
#endif /* __cplusplus */
/*
* Errors. Universal errors with JVMTI/JVMDI equivalents keep the
* values the same.
*/
typedef enum {
JDWPTRANSPORT_ERROR_NONE = 0,
JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT = 103,
JDWPTRANSPORT_ERROR_OUT_OF_MEMORY = 110,
JDWPTRANSPORT_ERROR_INTERNAL = 113,
JDWPTRANSPORT_ERROR_ILLEGAL_STATE = 201,
JDWPTRANSPORT_ERROR_IO_ERROR = 202,
JDWPTRANSPORT_ERROR_TIMEOUT = 203,
JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE = 204
} jdwpTransportError;
/*
* Structure to define capabilities
*/
typedef struct {
unsigned int can_timeout_attach :1;
unsigned int can_timeout_accept :1;
unsigned int can_timeout_handshake :1;
unsigned int reserved3 :1;
unsigned int reserved4 :1;
unsigned int reserved5 :1;
unsigned int reserved6 :1;
unsigned int reserved7 :1;
unsigned int reserved8 :1;
unsigned int reserved9 :1;
unsigned int reserved10 :1;
unsigned int reserved11 :1;
unsigned int reserved12 :1;
unsigned int reserved13 :1;
unsigned int reserved14 :1;
unsigned int reserved15 :1;
} JDWPTransportCapabilities;
/*
* Structures to define packet layout.
*
* See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html
*/
enum {
JDWPTRANSPORT_FLAGS_NONE = 0x0,
JDWPTRANSPORT_FLAGS_REPLY = 0x80
};
typedef struct {
jint len;
jint id;
jbyte flags;
jbyte cmdSet;
jbyte cmd;
jbyte *data;
} jdwpCmdPacket;
typedef struct {
jint len;
jint id;
jbyte flags;
jshort errorCode;
jbyte *data;
} jdwpReplyPacket;
typedef struct {
union {
jdwpCmdPacket cmd;
jdwpReplyPacket reply;
} type;
} jdwpPacket;
/*
* JDWP functions called by the transport.
*/
typedef struct jdwpTransportCallback {
void *(*alloc)(jint numBytes); /* Call this for all allocations */
void (*free)(void *buffer); /* Call this for all deallocations */
} jdwpTransportCallback;
typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm,
jdwpTransportCallback *callback,
jint version,
jdwpTransportEnv** env);
/* Function Interface */
struct jdwpTransportNativeInterface_ {
/* 1 : RESERVED */
void *reserved1;
/* 2 : Get Capabilities */
jdwpTransportError (JNICALL *GetCapabilities)(jdwpTransportEnv* env,
JDWPTransportCapabilities *capabilities_ptr);
/* 3 : Attach */
jdwpTransportError (JNICALL *Attach)(jdwpTransportEnv* env,
const char* address,
jlong attach_timeout,
jlong handshake_timeout);
/* 4: StartListening */
jdwpTransportError (JNICALL *StartListening)(jdwpTransportEnv* env,
const char* address,
char** actual_address);
/* 5: StopListening */
jdwpTransportError (JNICALL *StopListening)(jdwpTransportEnv* env);
/* 6: Accept */
jdwpTransportError (JNICALL *Accept)(jdwpTransportEnv* env,
jlong accept_timeout,
jlong handshake_timeout);
/* 7: IsOpen */
jboolean (JNICALL *IsOpen)(jdwpTransportEnv* env);
/* 8: Close */
jdwpTransportError (JNICALL *Close)(jdwpTransportEnv* env);
/* 9: ReadPacket */
jdwpTransportError (JNICALL *ReadPacket)(jdwpTransportEnv* env,
jdwpPacket *pkt);
/* 10: Write Packet */
jdwpTransportError (JNICALL *WritePacket)(jdwpTransportEnv* env,
const jdwpPacket* pkt);
/* 11: GetLastError */
jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env,
char** error);
};
/*
* Use inlined functions so that C++ code can use syntax such as
* env->Attach("mymachine:5000", 10*1000, 0);
*
* rather than using C's :-
*
* (*env)->Attach(env, "mymachine:5000", 10*1000, 0);
*/
struct _jdwpTransportEnv {
const struct jdwpTransportNativeInterface_ *functions;
#ifdef __cplusplus
jdwpTransportError GetCapabilities(JDWPTransportCapabilities *capabilities_ptr) {
return functions->GetCapabilities(this, capabilities_ptr);
}
jdwpTransportError Attach(const char* address, jlong attach_timeout,
jlong handshake_timeout) {
return functions->Attach(this, address, attach_timeout, handshake_timeout);
}
jdwpTransportError StartListening(const char* address,
char** actual_address) {
return functions->StartListening(this, address, actual_address);
}
jdwpTransportError StopListening(void) {
return functions->StopListening(this);
}
jdwpTransportError Accept(jlong accept_timeout, jlong handshake_timeout) {
return functions->Accept(this, accept_timeout, handshake_timeout);
}
jboolean IsOpen(void) {
return functions->IsOpen(this);
}
jdwpTransportError Close(void) {
return functions->Close(this);
}
jdwpTransportError ReadPacket(jdwpPacket *pkt) {
return functions->ReadPacket(this, pkt);
}
jdwpTransportError WritePacket(const jdwpPacket* pkt) {
return functions->WritePacket(this, pkt);
}
jdwpTransportError GetLastError(char** error) {
return functions->GetLastError(this, error);
}
#endif /* __cplusplus */
};
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* JDWPTRANSPORT_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,642 +0,0 @@
/*
* @(#)jvmpi.h 1.28 03/12/19
*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
#ifndef _JAVASOFT_JVMPI_H_
#define _JAVASOFT_JVMPI_H_
#include "jni.h"
#define JVMPI_VERSION_1 ((jint)0x10000001) /* implied 0 for minor version */
#define JVMPI_VERSION_1_1 ((jint)0x10000002)
#define JVMPI_VERSION_1_2 ((jint)0x10000003)
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*jvmpi_void_function_of_void)(void *);
#ifdef __cplusplus
}
#endif
/****************************************************************
* Profiler interface data structures.
****************************************************************/
/* identifier types. */
struct _jobjectID;
typedef struct _jobjectID * jobjectID; /* type of object ids */
/* raw monitors */
struct _JVMPI_RawMonitor;
typedef struct _JVMPI_RawMonitor * JVMPI_RawMonitor;
/* call frame */
typedef struct {
jint lineno; /* line number in the source file */
jmethodID method_id; /* method executed in this frame */
} JVMPI_CallFrame;
/* call trace */
typedef struct {
JNIEnv *env_id; /* Env where trace was recorded */
jint num_frames; /* number of frames in this trace */
JVMPI_CallFrame *frames; /* frames */
} JVMPI_CallTrace;
/* method */
typedef struct {
char *method_name; /* name of method */
char *method_signature; /* signature of method */
jint start_lineno; /* -1 if native, abstract .. */
jint end_lineno; /* -1 if native, abstract .. */
jmethodID method_id; /* id assigned to this method */
} JVMPI_Method;
/* Field */
typedef struct {
char *field_name; /* name of field */
char *field_signature; /* signature of field */
} JVMPI_Field;
/* line number info for a compiled method */
typedef struct {
jint offset; /* offset from beginning of method */
jint lineno; /* lineno from beginning of src file */
} JVMPI_Lineno;
/* event */
typedef struct {
jint event_type; /* event_type */
JNIEnv *env_id; /* env where this event occured */
union {
struct {
const char *class_name; /* class name */
char *source_name; /* name of source file */
jint num_interfaces; /* number of interfaces implemented */
jint num_methods; /* number of methods in the class */
JVMPI_Method *methods; /* methods */
jint num_static_fields; /* number of static fields */
JVMPI_Field *statics; /* static fields */
jint num_instance_fields; /* number of instance fields */
JVMPI_Field *instances; /* instance fields */
jobjectID class_id; /* id of the class object */
} class_load;
struct {
jobjectID class_id; /* id of the class object */
} class_unload;
struct {
unsigned char *class_data; /* content of class file */
jint class_data_len; /* class file length */
unsigned char *new_class_data; /* instrumented class file */
jint new_class_data_len; /* new class file length */
void * (*malloc_f)(unsigned int); /* memory allocation function */
} class_load_hook;
struct {
jint arena_id;
jobjectID class_id; /* id of object class */
jint is_array; /* JVMPI_NORMAL_OBJECT, ... */
jint size; /* size in number of bytes */
jobjectID obj_id; /* id assigned to this object */
} obj_alloc;
struct {
jobjectID obj_id; /* id of the object */
} obj_free;
struct {
jint arena_id; /* cur arena id */
jobjectID obj_id; /* cur object id */
jint new_arena_id; /* new arena id */
jobjectID new_obj_id; /* new object id */
} obj_move;
struct {
jint arena_id; /* id of arena */
const char *arena_name; /* name of arena */
} new_arena;
struct {
jint arena_id; /* id of arena */
} delete_arena;
struct {
char *thread_name; /* name of thread */
char *group_name; /* name of group */
char *parent_name; /* name of parent */
jobjectID thread_id; /* id of the thread object */
JNIEnv *thread_env_id;
} thread_start;
struct {
int dump_level; /* level of the heap dump info */
char *begin; /* where all the root records begin,
please see the heap dump buffer
format described below */
char *end; /* where the object records end. */
jint num_traces; /* number of thread traces,
0 if dump level = JVMPI_DUMP_LEVEL_0 */
JVMPI_CallTrace *traces; /* thread traces collected during
heap dump */
} heap_dump;
struct {
jobjectID obj_id; /* object id */
jobject ref_id; /* id assigned to the globalref */
} jni_globalref_alloc;
struct {
jobject ref_id; /* id of the global ref */
} jni_globalref_free;
struct {
jmethodID method_id; /* method */
} method;
struct {
jmethodID method_id; /* id of method */
jobjectID obj_id; /* id of target object */
} method_entry2;
struct {
jmethodID method_id; /* id of compiled method */
void *code_addr; /* code start addr. in memory */
jint code_size; /* code size */
jint lineno_table_size; /* size of lineno table */
JVMPI_Lineno *lineno_table; /* lineno info */
} compiled_method_load;
struct {
jmethodID method_id; /* id of unloaded compiled method */
} compiled_method_unload;
struct {
jmethodID method_id; /* id of the method the instruction belongs to */
jint offset; /* instruction offset in the method's bytecode */
union {
struct {
jboolean is_true; /* whether true or false branch is taken */
} if_info;
struct {
jint key; /* top stack value used as an index */
jint low; /* min value of the index */
jint hi; /* max value of the index */
} tableswitch_info;
struct {
jint chosen_pair_index; /* actually chosen pair index (0-based)
* if chosen_pair_index == pairs_total then
* the 'default' branch is taken
*/
jint pairs_total; /* total number of lookupswitch pairs */
} lookupswitch_info;
} u;
} instruction;
struct {
char *begin; /* beginning of dump buffer,
see below for format */
char *end; /* end of dump buffer */
jint num_traces; /* number of traces */
JVMPI_CallTrace *traces; /* traces of all threads */
jint *threads_status; /* status of all threads */
} monitor_dump;
struct {
const char *name; /* name of raw monitor */
JVMPI_RawMonitor id; /* id */
} raw_monitor;
struct {
jobjectID object; /* Java object */
} monitor;
struct {
jobjectID object; /* Java object */
jlong timeout; /* timeout period */
} monitor_wait;
struct {
jlong used_objects;
jlong used_object_space;
jlong total_object_space;
} gc_info;
struct {
jint data_len;
char *data;
} object_dump;
} u;
} JVMPI_Event;
/* interface functions */
typedef struct {
jint version; /* JVMPI version */
/* ------interface implemented by the profiler------ */
/**
* Function called by the JVM to notify an event.
*/
void (*NotifyEvent)(JVMPI_Event *event);
/* ------interface implemented by the JVM------ */
/**
* Function called by the profiler to enable/disable/send notification
* for a particular event type.
*
* event_type - event_type
* arg - event specific arg
*
* return JVMPI_NOT_AVAILABLE, JVMPI_SUCCESS or JVMPI_FAIL
*/
jint (*EnableEvent)(jint event_type, void *arg);
jint (*DisableEvent)(jint event_type, void *arg);
jint (*RequestEvent)(jint event_type, void *arg);
/**
* Function called by the profiler to get a stack
* trace from the JVM.
*
* trace - trace data structure to be filled
* depth - maximum depth of the trace.
*/
void (*GetCallTrace)(JVMPI_CallTrace *trace, jint depth);
/**
* Function called by profiler when it wants to exit/stop.
*/
void (*ProfilerExit)(jint);
/**
* Utility functions provided by the JVM.
*/
JVMPI_RawMonitor (*RawMonitorCreate)(char *lock_name);
void (*RawMonitorEnter)(JVMPI_RawMonitor lock_id);
void (*RawMonitorExit)(JVMPI_RawMonitor lock_id);
void (*RawMonitorWait)(JVMPI_RawMonitor lock_id, jlong ms);
void (*RawMonitorNotifyAll)(JVMPI_RawMonitor lock_id);
void (*RawMonitorDestroy)(JVMPI_RawMonitor lock_id);
/**
* Function called by the profiler to get the current thread's CPU time.
*
* return time in nanoseconds;
*/
jlong (*GetCurrentThreadCpuTime)(void);
void (*SuspendThread)(JNIEnv *env);
void (*ResumeThread)(JNIEnv *env);
jint (*GetThreadStatus)(JNIEnv *env);
jboolean (*ThreadHasRun)(JNIEnv *env);
/* This function can be called safely only after JVMPI_EVENT_VM_INIT_DONE
notification by the JVM. */
jint (*CreateSystemThread)(char *name, jint priority, void (*f)(void *));
/* thread local storage access functions to avoid locking in time
critical functions */
void (*SetThreadLocalStorage)(JNIEnv *env_id, void *ptr);
void * (*GetThreadLocalStorage)(JNIEnv *env_id);
/* control GC */
void (*DisableGC)(void);
void (*EnableGC)(void);
void (*RunGC)(void);
jobjectID (*GetThreadObject)(JNIEnv *env);
jobjectID (*GetMethodClass)(jmethodID mid);
/* JNI <-> jobject conversions */
jobject (*jobjectID2jobject)(jobjectID jid);
jobjectID (*jobject2jobjectID)(jobject jobj);
void (*SuspendThreadList)
(jint reqCount, JNIEnv **reqList, jint *results);
void (*ResumeThreadList)
(jint reqCount, JNIEnv **reqList, jint *results);
} JVMPI_Interface;
/* type of argument passed to RequestEvent for heap dumps */
typedef struct {
jint heap_dump_level;
} JVMPI_HeapDumpArg;
/**********************************************************************
* Constants and formats used in JVM Profiler Interface.
**********************************************************************/
/*
* Event type constants.
*/
#define JVMPI_EVENT_METHOD_ENTRY ((jint)1)
#define JVMPI_EVENT_METHOD_ENTRY2 ((jint)2)
#define JVMPI_EVENT_METHOD_EXIT ((jint)3)
#define JVMPI_EVENT_OBJECT_ALLOC ((jint)4)
#define JVMPI_EVENT_OBJECT_FREE ((jint)5)
#define JVMPI_EVENT_OBJECT_MOVE ((jint)6)
#define JVMPI_EVENT_COMPILED_METHOD_LOAD ((jint)7)
#define JVMPI_EVENT_COMPILED_METHOD_UNLOAD ((jint)8)
#define JVMPI_EVENT_INSTRUCTION_START ((jint)9)
#define JVMPI_EVENT_THREAD_START ((jint)33)
#define JVMPI_EVENT_THREAD_END ((jint)34)
#define JVMPI_EVENT_CLASS_LOAD_HOOK ((jint)35)
#define JVMPI_EVENT_HEAP_DUMP ((jint)37)
#define JVMPI_EVENT_JNI_GLOBALREF_ALLOC ((jint)38)
#define JVMPI_EVENT_JNI_GLOBALREF_FREE ((jint)39)
#define JVMPI_EVENT_JNI_WEAK_GLOBALREF_ALLOC ((jint)40)
#define JVMPI_EVENT_JNI_WEAK_GLOBALREF_FREE ((jint)41)
#define JVMPI_EVENT_CLASS_LOAD ((jint)42)
#define JVMPI_EVENT_CLASS_UNLOAD ((jint)43)
#define JVMPI_EVENT_DATA_DUMP_REQUEST ((jint)44)
#define JVMPI_EVENT_DATA_RESET_REQUEST ((jint)45)
#define JVMPI_EVENT_JVM_INIT_DONE ((jint)46)
#define JVMPI_EVENT_JVM_SHUT_DOWN ((jint)47)
#define JVMPI_EVENT_ARENA_NEW ((jint)48)
#define JVMPI_EVENT_ARENA_DELETE ((jint)49)
#define JVMPI_EVENT_OBJECT_DUMP ((jint)50)
#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTER ((jint)51)
#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTERED ((jint)52)
#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_EXIT ((jint)53)
#define JVMPI_EVENT_MONITOR_CONTENDED_ENTER ((jint)54)
#define JVMPI_EVENT_MONITOR_CONTENDED_ENTERED ((jint)55)
#define JVMPI_EVENT_MONITOR_CONTENDED_EXIT ((jint)56)
#define JVMPI_EVENT_MONITOR_WAIT ((jint)57)
#define JVMPI_EVENT_MONITOR_WAITED ((jint)58)
#define JVMPI_EVENT_MONITOR_DUMP ((jint)59)
#define JVMPI_EVENT_GC_START ((jint)60)
#define JVMPI_EVENT_GC_FINISH ((jint)61)
#define JVMPI_MAX_EVENT_TYPE_VAL ((jint)61)
/* old definitions, to be removed */
#define JVMPI_EVENT_LOAD_COMPILED_METHOD ((jint)7)
#define JVMPI_EVENT_UNLOAD_COMPILED_METHOD ((jint)8)
#define JVMPI_EVENT_NEW_ARENA ((jint)48)
#define JVMPI_EVENT_DELETE_ARENA ((jint)49)
#define JVMPI_EVENT_DUMP_DATA_REQUEST ((jint)44)
#define JVMPI_EVENT_RESET_DATA_REQUEST ((jint)45)
#define JVMPI_EVENT_OBJ_ALLOC ((jint)4)
#define JVMPI_EVENT_OBJ_FREE ((jint)5)
#define JVMPI_EVENT_OBJ_MOVE ((jint)6)
#define JVMPI_REQUESTED_EVENT ((jint)0x10000000)
/*
* enabling/disabling event notification.
*/
/* results */
#define JVMPI_SUCCESS ((jint)0)
#define JVMPI_NOT_AVAILABLE ((jint)1)
#define JVMPI_FAIL ((jint)-1)
/*
* Thread status
*/
enum {
JVMPI_THREAD_RUNNABLE = 1,
JVMPI_THREAD_MONITOR_WAIT,
JVMPI_THREAD_CONDVAR_WAIT
};
#define JVMPI_THREAD_SUSPENDED 0x8000
#define JVMPI_THREAD_INTERRUPTED 0x4000
/*
* Thread priority
*/
#define JVMPI_MINIMUM_PRIORITY 1
#define JVMPI_MAXIMUM_PRIORITY 10
#define JVMPI_NORMAL_PRIORITY 5
/*
* Object type constants.
*/
#define JVMPI_NORMAL_OBJECT ((jint)0)
#define JVMPI_CLASS ((jint)2)
#define JVMPI_BOOLEAN ((jint)4)
#define JVMPI_CHAR ((jint)5)
#define JVMPI_FLOAT ((jint)6)
#define JVMPI_DOUBLE ((jint)7)
#define JVMPI_BYTE ((jint)8)
#define JVMPI_SHORT ((jint)9)
#define JVMPI_INT ((jint)10)
#define JVMPI_LONG ((jint)11)
/*
* Monitor dump constants.
*/
#define JVMPI_MONITOR_JAVA 0x01
#define JVMPI_MONITOR_RAW 0x02
/*
* Heap dump constants.
*/
#define JVMPI_GC_ROOT_UNKNOWN 0xff
#define JVMPI_GC_ROOT_JNI_GLOBAL 0x01
#define JVMPI_GC_ROOT_JNI_LOCAL 0x02
#define JVMPI_GC_ROOT_JAVA_FRAME 0x03
#define JVMPI_GC_ROOT_NATIVE_STACK 0x04
#define JVMPI_GC_ROOT_STICKY_CLASS 0x05
#define JVMPI_GC_ROOT_THREAD_BLOCK 0x06
#define JVMPI_GC_ROOT_MONITOR_USED 0x07
#define JVMPI_GC_ROOT_THREAD_OBJ 0x08
#define JVMPI_GC_CLASS_DUMP 0x20
#define JVMPI_GC_INSTANCE_DUMP 0x21
#define JVMPI_GC_OBJ_ARRAY_DUMP 0x22
#define JVMPI_GC_PRIM_ARRAY_DUMP 0x23
/*
* Dump levels
*/
#define JVMPI_DUMP_LEVEL_0 ((jint)0)
#define JVMPI_DUMP_LEVEL_1 ((jint)1)
#define JVMPI_DUMP_LEVEL_2 ((jint)2)
/* Types used in dumps -
*
* u1: 1 byte
* u2: 2 bytes
* u4: 4 bytes
* u8: 8 bytes
*
* ty: u1 where:
* JVMPI_CLASS: object
* JVMPI_BOOLEAN: boolean
* JVMPI_CHAR: char
* JVMPI_FLOAT: float
* JVMPI_DOUBLE: double
* JVMPI_BYTE: byte
* JVMPI_SHORT: short
* JVMPI_INT: int
* JVMPI_LONG: long
*
* vl: values, exact type depends on the type of the value:
* JVMPI_BOOLEAN & JVMPI_BYTE: u1
* JVMPI_SHORT & JVMPI_CHAR: u2
* JVMPI_INT & JVMPI_FLOAT: u4
* JVMPI_LONG & JVMPI_DOUBLE: u8
* JVMPI_CLASS: jobjectID
*/
/* Format of the monitor dump buffer:
*
* u1 monitor type
*
* JVMPI_MONITOR_JAVA Java monitor
*
* jobjectID object
* JNIEnv * owner thread
* u4 entry count
* u4 # of threads waiting to enter
* [JNIEnv *]* threads waiting to enter
* u4 # of threads waiting to be notified
* [JNIEnv *]* threads waiting to be notified
*
* JVMPI_MONITOR_RAW raw monitor
*
* char * name
* JVMPI_RawMonitor raw monitor
* JNIEnv * owner thread
* u4 entry count
* u4 # of threads waiting to enter
* [JNIEnv *]* threads waiting to enter
* u4 # of threads waiting to be notified
* [JNIEnv *]* threads waiting to be notified
*/
/* Format of the heap dump buffer depends on the dump level
* specified in the JVMPI_HeapDumpArg passed to RequestEvent as arg.
* The default is JVMPI_DUMP_LEVEL_2.
*
* JVMPI_DUMP_LEVEL_0:
*
* u1 object type (JVMPI_CLASS ...)
* jobjectID object
*
* JVMPI_DUMP_LEVEL_1 and JVMPI_DUMP_LEVEL_2 use the following format:
* In the case of JVMPI_DUMP_LEVEL_1 the values of primitive fields in object
* instance dumps , the values of primitive statics in class dumps and the
* values of primitive arrays are excluded. JVMPI_DUMP_LEVEL_2 includes the
* primitive values.
*
* u1 record type
*
* JVMPI_GC_ROOT_UNKNOWN unknown root
*
* jobjectID object
*
* JVMPI_GC_ROOT_JNI_GLOBAL JNI global ref root
*
* jobjectID object
* jobject JNI global reference
*
* JVMPI_GC_ROOT_JNI_LOCAL JNI local ref
*
* jobjectID object
* JNIEnv * thread
* u4 frame # in stack trace (-1 for empty)
*
* JVMPI_GC_ROOT_JAVA_FRAME Java stack frame
*
* jobjectID object
* JNIEnv * thread
* u4 frame # in stack trace (-1 for empty)
*
* JVMPI_GC_ROOT_NATIVE_STACK Native stack
*
* jobjectID object
* JNIEnv * thread
*
* JVMPI_GC_ROOT_STICKY_CLASS System class
*
* jobjectID class object
*
* JVMPI_GC_ROOT_THREAD_BLOCK Reference from thread block
*
* jobjectID thread object
* JNIEnv * thread
*
* JVMPI_GC_ROOT_MONITOR_USED Busy monitor
*
* jobjectID object
*
* JVMPI_GC_CLASS_DUMP dump of a class object
*
* jobjectID class
* jobjectID super
* jobjectID class loader
* jobjectID signers
* jobjectID protection domain
* jobjectID class name
* void * reserved
*
* u4 instance size (in bytes)
*
* [jobjectID]* interfaces
*
* u2 size of constant pool
* [u2, constant pool index,
* ty, type,
* vl]* value
*
* [vl]* static field values
*
* JVMPI_GC_INSTANCE_DUMP dump of a normal object
*
* jobjectID object
* jobjectID class
* u4 number of bytes that follow
* [vl]* instance field values (class, followed
* by super, super's super ...)
*
* JVMPI_GC_OBJ_ARRAY_DUMP dump of an object array
*
* jobjectID array object
* u4 number of elements
* jobjectID element class
* [jobjectID]* elements
*
* JVMPI_GC_PRIM_ARRAY_DUMP dump of a primitive array
*
* jobjectID array object
* u4 number of elements
* ty element type
* [vl]* elements
*
*/
/* Format of the dump received in JVMPI_EVENT_OBJECT_DUMP:
* All the records have JVMPI_DUMP_LEVEL_2 information.
*
* u1 record type
*
* followed by a:
*
* JVMPI_GC_CLASS_DUMP,
* JVMPI_GC_INSTANCE_DUMP,
* JVMPI_GC_OBJ_ARRAY_DUMP, or
* JVMPI_GC_PRIM_ARRAY_DUMP record.
*/
#endif /* !_JAVASOFT_JVMPI_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +0,0 @@
/*
* @(#)jawt_md.h 1.7 03/12/19
*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
#ifndef _JAVASOFT_JAWT_MD_H_
#define _JAVASOFT_JAWT_MD_H_
#include <windows.h>
#include "jawt.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Win32-specific declarations for AWT native interface.
* See notes in jawt.h for an example of use.
*/
typedef struct jawt_Win32DrawingSurfaceInfo {
/* Native window, DDB, or DIB handle */
union {
HWND hwnd;
HBITMAP hbitmap;
void* pbits;
};
/*
* This HDC should always be used instead of the HDC returned from
* BeginPaint() or any calls to GetDC().
*/
HDC hdc;
HPALETTE hpalette;
} JAWT_Win32DrawingSurfaceInfo;
#ifdef __cplusplus
}
#endif
#endif /* !_JAVASOFT_JAWT_MD_H_ */

View File

@ -1,19 +0,0 @@
/*
* @(#)jni_md.h 1.14 03/12/19
*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
#ifndef _JAVASOFT_JNI_MD_H_
#define _JAVASOFT_JNI_MD_H_
#define JNIEXPORT __declspec(dllexport)
#define JNIIMPORT __declspec(dllimport)
#define JNICALL __stdcall
typedef long jint;
typedef __int64 jlong;
typedef signed char jbyte;
#endif /* !_JAVASOFT_JNI_MD_H_ */