Index: interpreter_exports.h =================================================================== --- interpreter_exports.h (revision 519904) +++ interpreter_exports.h (working copy) @@ -15,6 +15,14 @@ * limitations under the License. */ + +/** + * @file + * + * Export Interfaces provided by interpreter. + * + */ + #ifndef _INTERPRETER_EXPORTS_H_ #define _INTERPRETER_EXPORTS_H_ @@ -23,37 +31,271 @@ typedef struct FrameHandle FrameHandle; +/** + * @ingroup + * Interpreter table. + */ typedef struct { + +/** + * Fills the stack trace frame at the given depth for the current thread. + * + * @param[in] target_depth - the zero-based depth of the frame or inlined method, + * information about which will be stored at the given stack trace + * frame, stf + * @param[out] stf - the pointer to the StackTraceFrame structure that needs + * to be filled with the data on the frame or inlined method + * corresponding to the given depth + * + * @return TRUE on success, FALSE if the depth is greater than + * or equal to thecurrent thread's stack trace length. + */ bool (*interpreter_st_get_frame) (unsigned target_depth, struct StackTraceFrame* stf); + +/** + * Fills the stack trace frames for the specified number of frames of the specified thread. + * + * @param[in] thread - pointer to the thread + * @param[in] res_depth - the number of frames including inlined methods, + * information about which should be stored + * @param[out] stfs - the pointer to the array of stack trace frames + * created by this function and returned via this + * pointer. + * + * @note The caller is responsible for freeing the memory. + */ void (*interpreter_st_get_trace) (class VM_thread *thread, unsigned* res_depth, struct StackTraceFrame** stfs); + +/** + * Enumerate references associated with a thread. + * + * @param thread - pointer to the thread + * + */ void (*interpreter_enumerate_thread) (class VM_thread *thread); +/** + * Return last frame. + * + * @param thread - pointer to the thread + * + * @return - Pointer to last frame. + */ FrameHandle* (*interpreter_get_last_frame) (class VM_thread *thread); + +/** + * Return previous frame. + * + * @param frame - pointer to the frame + * + * @return - Pointer to previous frame. + */ FrameHandle* (*interpreter_get_prev_frame) (FrameHandle* frame); + +/** + * Return method of the frame. + * + * @param frame - pointer to the frame + * + * @return - Pointer to the method. + */ Method_Handle (*interpreter_get_frame_method) (FrameHandle* frame); + +/** + * Return pointer to bytecode. + * + * @param frame - pointer to the frame + * + * @return - Pointer to bytecode. + */ uint8* (*interpreter_get_frame_bytecode_ptr) (FrameHandle* frame); // 'end' is not inclusive + +/** + * Return TRUE if is frame in native frame. + * + * @param frame - pointer to the frame + * @param begin - pointer to register + * @param end - pointer to register + * + * @return - TRUE on success + */ bool (*is_frame_in_native_frame) (struct FrameHandle* frame, void* begin, void* end); + +/** + * Enumerate references associated with a thread. + * + * @param thread - pointer to the thread + * @param jvmtiEnv - pointer to the jvmti environment + * + */ void (*interpreter_ti_enumerate_thread) (jvmtiEnv*, class VM_thread *thread); #ifdef _IPF_ +/** + * Return stacked register address. + * + * @param bsp - pointer to register + * @param reg - register + * + * @return - stacked register address + */ uint64* (*interpreter_get_stacked_register_address) (uint64* bsp, unsigned reg); #endif +/** + * Return frame location. + * + * @param jvmtiEnv - pointer to jvmti environment + * @param thread - pointer to thread + * @param depth - pointer to depth + * @param _jmethodID - pointer to method + * @param jlocation - pointer to location + * + * @return JVMTI_ERROR_NONE - successfully added notification
+ * JVMTI_ERROR_NO_MORE_FRAMES - depth too large
+ */ jvmtiError (*interpreter_ti_getFrameLocation) ( jvmtiEnv*, class VM_thread*, int, struct _jmethodID * *, int64 *); + +/** + * Return value of 32 bit local variable. + * + * @param jvmtiEnv - pointer to jvmti environment + * @param thread - pointer to thread + * @param depth - pointer to depth + * @param slot - pointer to slot + * @param value_ptr - pointer to value + * + * @return JVMTI_ERROR_NONE - successfully added notification
+ * JVMTI_ERROR_NO_MORE_FRAMES - depth too large
+ * JVMTI_ERROR_OPAQUE_FRAME - no frame
+ * JVMTI_ERROR_INVALID_SLOT - bad slot
+ * JVMTI_ERROR_TYPE_MISMATCH - invalide variable type
+ */ jvmtiError (*interpreter_ti_getLocal32) ( jvmtiEnv*, class VM_thread*, int, int, int *); + +/** + * Return value of 64 bit local variable. + * + * @param jvmtiEnv - pointer to jvmti environment + * @param thread - pointer to thread + * @param depth - pointer to depth + * @param slot - pointer to slot + * @param value_ptr - pointer to value + * + * @return JVMTI_ERROR_NONE - successfully added notification
+ * JVMTI_ERROR_NO_MORE_FRAMES - depth too large
+ * JVMTI_ERROR_OPAQUE_FRAME - no frame
+ * JVMTI_ERROR_INVALID_SLOT - bad slot
+ * JVMTI_ERROR_TYPE_MISMATCH - invalide variable type
+ */ jvmtiError (*interpreter_ti_getLocal64) ( jvmtiEnv*, class VM_thread*, int, int, int64 *); + +/** + * Return value of Object type local variable. + * + * @param jvmtiEnv - pointer to jvmti environment + * @param thread - pointer to thread + * @param depth - pointer to depth + * @param slot - pointer to slot + * @param value_ptr - pointer to value + * + * @return JVMTI_ERROR_NONE - successfully added notification
+ * JVMTI_ERROR_NO_MORE_FRAMES - depth too large
+ * JVMTI_ERROR_OPAQUE_FRAME - no frame
+ * JVMTI_ERROR_INVALID_SLOT - bad slot
+ * JVMTI_ERROR_TYPE_MISMATCH - invalide variable type
+ */ jvmtiError (*interpreter_ti_getObject) ( jvmtiEnv*, class VM_thread*, int, int, struct _jobject * *); + +/** + * Return stack trace data. + * + * @param jvmtiEnv - pointer to jvmti environment + * @param thread - pointer to thread + * @param start_depth - pointer to depth + * @param max_frame_count - pointer to max_frame_count + * @param frame_buffer - pointer to frame_buffer + * @param count_ptr - pointer to count + * + * @return JVMTI_ERROR_NONE - successfully added notification
+ * JVMTI_ERROR_ILLEGAL_ARGUMENT - bad arguments
+ */ jvmtiError (*interpreter_ti_getStackTrace) (jvmtiEnv*, class VM_thread*, int, int, jvmtiFrameInfo*, int *); + +/** + * Return frame count. + * + * @param jvmtiEnv - pointer to jvmti environment + * @param thread - pointer to thread + * @param count_ptr[out] - pointer to count + * + * @return JVMTI_ERROR_NONE - successfully added notification
+ */ jvmtiError (*interpreter_ti_get_frame_count) ( jvmtiEnv*, class VM_thread*, int *); + +/** + * Set value of 32 bit local variable. + * + * @param jvmtiEnv - pointer to jvmti environment + * @param thread - pointer to thread + * @param depth - pointer to depth + * @param slot - pointer to slot + * @param value_ptr - pointer to value + * + * @return JVMTI_ERROR_NONE - successfully added notification
+ * JVMTI_ERROR_NO_MORE_FRAMES - depth too large
+ * JVMTI_ERROR_OPAQUE_FRAME - no frame
+ * JVMTI_ERROR_INVALID_SLOT - bad slot
+ * JVMTI_ERROR_TYPE_MISMATCH - invalide variable type
+ */ jvmtiError (*interpreter_ti_setLocal32) ( jvmtiEnv*, class VM_thread*, int, int, int); + +/** + * Set value of 64 bit local variable. + * + * @param jvmtiEnv - pointer to jvmti environment + * @param thread - pointer to thread + * @param depth - pointer to depth + * @param slot - pointer to slot + * @param value_ptr - pointer to value + * + * @return JVMTI_ERROR_NONE - successfully added notification
+ * JVMTI_ERROR_NO_MORE_FRAMES - depth too large
+ * JVMTI_ERROR_OPAQUE_FRAME - no frame
+ * JVMTI_ERROR_INVALID_SLOT - bad slot
+ * JVMTI_ERROR_TYPE_MISMATCH - invalide variable type
+ */ jvmtiError (*interpreter_ti_setLocal64) ( jvmtiEnv*, class VM_thread*, int, int, int64); + +/** + * Set value of Object type local variable. + * + * @param jvmtiEnv - pointer to jvmti environment + * @param thread - pointer to thread + * @param depth - pointer to depth + * @param slot - pointer to slot + * @param value_ptr - pointer to value + * + * @return JVMTI_ERROR_NONE - successfully added notification
+ * JVMTI_ERROR_NO_MORE_FRAMES - depth too large
+ * JVMTI_ERROR_OPAQUE_FRAME - no frame
+ * JVMTI_ERROR_INVALID_SLOT - bad slot
+ * JVMTI_ERROR_TYPE_MISMATCH - invalide variable type
+ */ jvmtiError (*interpreter_ti_setObject) ( jvmtiEnv*, class VM_thread*, int, int, struct _jobject *); + +/** + * Return interrupted method native bit. + * + * @param thread - pointer to thread + * + * @return - Interrupted method native bit + */ unsigned int (*interpreter_st_get_interrupted_method_native_bit) (class VM_thread *); - // Open interfaces part begins /** @@ -93,16 +335,40 @@ VM_thread *thread, int depth); +/** + * Pop frame. + * + * @param jvmtiEnv - pointer to jvmti environment + * @param thread - pointer to thread + * + * @return JVMTI_ERROR_NONE - successfully added notification
+ * JVMTI_ERROR_OPAQUE_FRAME - no frame
+ */ jvmtiError (*interpreter_ti_pop_frame) (jvmtiEnv*, VM_thread *thread); +/** + * Dump the stack. + * + * @param thread - pointer to thread + */ void (*stack_dump) (VM_thread*); } Interpreter; +/** + * Return interpreter table. + * + * @return - interpreter table + */ VMEXPORT Interpreter *interpreter_table(); #ifdef BUILDING_VM extern Interpreter interpreter; +/** + * Return TRUE if interpreter table. + * + * @return - TRUE on success + */ extern bool interpreter_enabled(); #endif