You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2007/10/05 17:17:28 UTC

svn commit: r582311 - in /harmony/enhanced/drlvm/trunk/vm/vmcore: include/jvmti_break_intf.h include/jvmti_internal.h src/jvmti/jvmti_break.cpp src/jvmti/jvmti_break_intf.cpp src/jvmti/jvmti_step.cpp

Author: gshimansky
Date: Fri Oct  5 08:17:21 2007
New Revision: 582311

URL: http://svn.apache.org/viewvc?rev=582311&view=rev
Log:
Applied patch for HARMONY-4790
[drlvm][jvmti] EventTest014 JDWP stress test intermittently fails with assertion violations


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_break_intf.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=582311&r1=582310&r2=582311&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  5 08:17:21 2007
@@ -64,7 +64,7 @@
 struct VMBreakPointRef
 {
     VMBreakPoint*    bp;
-    void*            data;
+    POINTER_SIZE_INT data;
     VMBreakPointRef* next;
 };
 
@@ -78,7 +78,7 @@
 };
 
 // Pointer to interface callback function
-typedef bool (*BPInterfaceCallBack)(TIEnv *env, VMBreakPoint* bp, void *data);
+typedef bool (*BPInterfaceCallBack)(TIEnv *env, VMBreakPoint* bp, POINTER_SIZE_INT data);
 typedef bool (*BPInterfaceProcedure) (VMBreakPoint *bp);
 
 class VMBreakPoints
@@ -176,11 +176,11 @@
 
     // 'data' must be allocated with JVMTI Allocate (or internal _allocate)
     // Users must not deallocate 'data', it will be deallocated by 'remove'
-    VMBreakPointRef* add_reference(jmethodID method, jlocation location, void* data);
+    VMBreakPointRef* add_reference(jmethodID method, jlocation location, POINTER_SIZE_INT data);
     // To specify address explicitly
     VMBreakPointRef* add_reference(jmethodID method, jlocation location,
-                    NativeCodePtr addr, void* data);
-    VMBreakPointRef* add_reference(NativeCodePtr addr, void* data);
+                    NativeCodePtr addr, POINTER_SIZE_INT data);
+    VMBreakPointRef* add_reference(NativeCodePtr addr, POINTER_SIZE_INT data);
 
     bool remove_reference(VMBreakPointRef* ref);
     void remove_all_reference()
@@ -203,7 +203,7 @@
     TIEnv* get_env() { return m_env; }
 
 private:
-    inline VMBreakPointRef* add_reference_internal(VMBreakPoint *bp, void *data);
+    inline VMBreakPointRef* add_reference_internal(VMBreakPoint *bp, POINTER_SIZE_INT data);
 
 protected:
     VMBreakInterface*   m_next;

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=582311&r1=582310&r2=582311&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  5 08:17:21 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, void* data);
+bool jvmti_process_breakpoint_event(TIEnv *env, VMBreakPoint* bp, 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=582311&r1=582310&r2=582311&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  5 08:17:21 2007
@@ -39,7 +39,7 @@
 
 
 // Callback function for JVMTI breakpoint processing
-bool jvmti_process_breakpoint_event(TIEnv *env, VMBreakPoint* bp, void* UNREF data)
+bool jvmti_process_breakpoint_event(TIEnv *env, VMBreakPoint* bp, POINTER_SIZE_INT UNREF data)
 {
     assert(bp);
 
@@ -197,7 +197,7 @@
     if (NULL != bp)
         return JVMTI_ERROR_DUPLICATE;
 
-    if (!brpt_intf->add_reference(method, location, NULL))
+    if (!brpt_intf->add_reference(method, location, (POINTER_SIZE_INT)false))
         return JVMTI_ERROR_INTERNAL;
 
     TRACE2("jvmti.break", "SetBreakpoint is successful");

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp?rev=582311&r1=582310&r2=582311&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp Fri Oct  5 08:17:21 2007
@@ -615,7 +615,9 @@
                 {
                     local.intf = intf->m_next;
                     VMBreakPoint local_bp = *bp;
-                    void *data = ref->data;
+                    // Set local copy's pointer to local copy of disassembler
+                    local_bp.disasm = &idisasm;
+                    POINTER_SIZE_INT data = ref->data;
 
                     Method *method = (Method*)bp->method;
                     jlocation location = bp->location;
@@ -844,7 +846,7 @@
                 {
                     local.intf = intf->m_next;
                     VMBreakPoint local_bp = *bp;
-                    void *data = ref->data;
+                    POINTER_SIZE_INT data = ref->data;
 
                     TRACE2("jvmti.break.intf",
                         "Calling interpreter breakpoint callback function: "
@@ -933,7 +935,7 @@
 }
 
 inline VMBreakPointRef*
-VMBreakInterface::add_reference_internal(VMBreakPoint *bp, void *data)
+VMBreakInterface::add_reference_internal(VMBreakPoint *bp, POINTER_SIZE_INT data)
 {
     VMBreakPointRef* bp_ref =
         (VMBreakPointRef*)STD_MALLOC(sizeof(VMBreakPointRef));
@@ -956,7 +958,7 @@
 }
 
 VMBreakPointRef*
-VMBreakInterface::add_reference(jmethodID method, jlocation location, void* data)
+VMBreakInterface::add_reference(jmethodID method, jlocation location, POINTER_SIZE_INT data)
 {
     assert(method);
 
@@ -993,7 +995,7 @@
 
 VMBreakPointRef*
 VMBreakInterface::add_reference(jmethodID method, jlocation location,
-                                NativeCodePtr addr, void* data)
+                                NativeCodePtr addr, POINTER_SIZE_INT data)
 {
     assert(method);
 
@@ -1033,7 +1035,7 @@
 }
 
 VMBreakPointRef*
-VMBreakInterface::add_reference(NativeCodePtr addr, void* data)
+VMBreakInterface::add_reference(NativeCodePtr addr, POINTER_SIZE_INT data)
 {
     assert(addr);
     assert(!interpreter_enabled());
@@ -1103,9 +1105,6 @@
 
     VMBreakPoint* brpt = found->bp;
     assert(brpt);
-
-    if (found->data)
-        _deallocate((unsigned char*)found->data);
 
     STD_FREE(found);
 

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=582311&r1=582310&r2=582311&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  5 08:17:21 2007
@@ -461,13 +461,13 @@
     jvmti_StepLocation *locations;
     unsigned locations_count;
 
-    jvmti_SingleStepLocation(p_TLS_vmthread, m, (unsigned)location,
-                            &locations, &locations_count);
-
     // lock breakpoints
     VMBreakPoints* vm_brpt = VM_Global_State::loader_env->TI->vm_brpt;
     LMAutoUnlock lock(vm_brpt->get_lock());
 
+    jvmti_SingleStepLocation(p_TLS_vmthread, m, (unsigned)location,
+                            &locations, &locations_count);
+
     jvmti_remove_single_step_breakpoints(ti, jvmti_thread);
 
     jvmti_set_single_step_breakpoints(ti, jvmti_thread, locations, locations_count);
@@ -495,7 +495,7 @@
 }
 
 static void jvmti_start_single_step_in_virtual_method(DebugUtilsTI *ti, VMBreakPoint* bp,
-                                                      void *data)
+                                                      POINTER_SIZE_INT data)
 {
 #if (defined _IA32_) || (defined _EM64T_)
     VM_thread *vm_thread = p_TLS_vmthread;
@@ -506,10 +506,15 @@
     // This is a virtual breakpoint set exactly on the call
     // instruction for the virtual method. In this place it is
     // possible to determine the target method in runtime
-    bool* UNREF virtual_flag = (bool *)data;
-    assert(*virtual_flag == true);
+    bool UNREF virtual_flag = (bool)data;
+    assert(virtual_flag == true);
 
     InstructionDisassembler *disasm = bp->disasm;
+
+    InstructionDisassembler::Type UNREF type = disasm->get_type();
+    assert(type == InstructionDisassembler::RELATIVE_CALL ||
+        type == InstructionDisassembler::INDIRECT_CALL);
+
     const InstructionDisassembler::Opnd& op = disasm->get_opnd(0);
     Method *method;
     if (op.kind == InstructionDisassembler::Kind_Mem)
@@ -572,7 +577,7 @@
 
 // Callback function for JVMTI single step processing
 static bool jvmti_process_jit_single_step_event(TIEnv* UNREF unused_env,
-                                                VMBreakPoint* bp, void *data)
+                                                VMBreakPoint* bp, POINTER_SIZE_INT data)
 {
     assert(bp);
 
@@ -603,7 +608,7 @@
     NativeCodePtr addr = bp->addr;
     assert(addr);
 
-    if (NULL != data)
+    if ((bool)data)
     {
         jvmti_start_single_step_in_virtual_method(ti, bp, data);
         return true;
@@ -727,24 +732,12 @@
             << " :" << locations[iii].location
             << " :" << locations[iii].native_location);
 
-        void *data = NULL;
-        if (locations[iii].no_event)
-        {
-            bool *virtual_flag;
-            jvmtiError error = _allocate(sizeof(bool),
-                (unsigned char**)&virtual_flag);
-
-            assert(error == JVMTI_ERROR_NONE);
-            *virtual_flag = true;
-            data = virtual_flag;
-        }
-
         VMBreakPointRef* ref =
             ss_state->predicted_breakpoints->add_reference(
                 (jmethodID)locations[iii].method,
                 locations[iii].location,
                 locations[iii].native_location,
-                data);
+                (POINTER_SIZE_INT)locations[iii].no_event);
         assert(ref);
     }
 }