Author: gshimansky
Date: Fri Oct 19 04:09:47 2007
New Revision: 586379
URL: http://svn.apache.org/viewvc?rev=586379&view=rev
Log:
Improved JVMTI for handling invokevirtual and invokeinterface on
x86_64 architecture.
Capabilities for breakpoint and single step are turned on.
Modified:
harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_break_intf.h
harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h
harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp
Modified:
harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_break_intf.h
URL:
http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_break_intf.h?rev=586379&r1=586378&r2=586379&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_break_intf.h
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_break_intf.h
Fri Oct 19 04:09:47 2007
@@ -78,7 +78,7 @@
};
// Pointer to interface callback function
-typedef bool (*BPInterfaceCallBack)(TIEnv *env, VMBreakPoint* bp,
POINTER_SIZE_INT data);
+typedef bool (*BPInterfaceCallBack)(TIEnv *env, const VMBreakPoint*
bp, const POINTER_SIZE_INT data);
typedef bool (*BPInterfaceProcedure) (VMBreakPoint *bp);
class VMBreakPoints
Modified:
harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h
URL:
http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h?rev=586379&r1=586378&r2=586379&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h
Fri Oct 19 04:09:47 2007
@@ -423,6 +423,6 @@
unsigned location, jvmti_StepLocation **next_step, unsigned *count);
// Callback function for JVMTI breakpoint processing
-bool jvmti_process_breakpoint_event(TIEnv *env, VMBreakPoint* bp,
POINTER_SIZE_INT data);
+bool jvmti_process_breakpoint_event(TIEnv *env, const VMBreakPoint*
bp, const POINTER_SIZE_INT data);
#endif /* _JVMTI_INTERNAL_H_ */
Modified:
harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp
URL:
http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp?rev=586379&r1=586378&r2=586379&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp
Fri Oct 19 04:09:47 2007
@@ -39,7 +39,7 @@
// Callback function for JVMTI breakpoint processing
-bool jvmti_process_breakpoint_event(TIEnv *env, VMBreakPoint* bp,
POINTER_SIZE_INT UNREF data)
+bool jvmti_process_breakpoint_event(TIEnv *env, const VMBreakPoint*
bp, const POINTER_SIZE_INT UNREF data)
{
assert(bp);
Modified:
harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp
URL:
http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp?rev=586379&r1=586378&r2=586379&view=diff
==============================================================================
---
harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp
(original)
+++
harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp
Fri Oct 19 04:09:47 2007
@@ -87,10 +87,10 @@
1, // can_get_source_debug_extension
1, // can_access_local_variables
0, // can_maintain_original_method_order
- 0, // can_generate_single_step_events
+ 1, // can_generate_single_step_events
1, // can_generate_exception_events
1, // can_generate_frame_pop_events
- 0, // can_generate_breakpoint_events
+ 1, // can_generate_breakpoint_events
1, // can_suspend
0, // can_redefine_any_class
1, // can_get_current_thread_cpu_time
Modified:
harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp
URL:
http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp?rev=586379&r1=586378&r2=586379&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp
Fri Oct 19 04:09:47 2007
@@ -494,8 +494,8 @@
}
}
-static void jvmti_start_single_step_in_virtual_method(DebugUtilsTI
*ti, VMBreakPoint* bp,
-
POINTER_SIZE_INT data)
+static void jvmti_start_single_step_in_virtual_method(DebugUtilsTI
*ti, const VMBreakPoint* bp,
+ const POINTER_SIZE_INT data, const unsigned char bytecode)
{
#if (defined _IA32_) || (defined _EM64T_)
VM_thread *vm_thread = p_TLS_vmthread;
@@ -517,11 +517,11 @@
const InstructionDisassembler::Opnd& op = disasm->get_opnd(0);
Method *method;
- if (op.kind == InstructionDisassembler::Kind_Mem)
+ if (bytecode == OPCODE_INVOKEVIRTUAL)
{
// Invokevirtual uses indirect call from VTable. The base
// address is in the register, offset is in displacement *
- // scale. This method is much faster than
+ // scale.
VTable* vtable = (VTable*)disasm->get_reg_value(op.base, ®s);
assert(vtable);
// For x86 based architectures offset cannot be longer than 32
@@ -530,7 +530,7 @@
op.scale + op.disp);
method = class_get_method_from_vt_offset(vtable, offset);
}
- else if (op.kind == InstructionDisassembler::Kind_Reg)
+ else if (bytecode == OPCODE_INVOKEINTERFACE)
{
// This is invokeinterface bytecode which uses register
// call so we need to search through all methods for this
@@ -577,7 +577,7 @@
// Callback function for JVMTI single step processing
static bool jvmti_process_jit_single_step_event(TIEnv* UNREF
unused_env,
- VMBreakPoint* bp,
POINTER_SIZE_INT data)
+ const VMBreakPoint* bp, const POINTER_SIZE_INT data)
{
assert(bp);
@@ -610,7 +610,10 @@
if ((bool)data)
{
- jvmti_start_single_step_in_virtual_method(ti, bp, data);
+ const unsigned char *bytecode = reinterpret_cast<Method
*>(method)->get_byte_code_addr();
+ const unsigned char bc = bytecode[location];
+ assert(bc == OPCODE_INVOKEINTERFACE || bc ==
OPCODE_INVOKEVIRTUAL);
+ jvmti_start_single_step_in_virtual_method(ti, bp, data, bc);
return true;
}