harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r449223 - in /incubator/harmony/enhanced/drlvm/trunk/vm: port/include/ port/src/lil/em64t/pim/ port/src/lil/ia32/pim/ port/src/lil/ipf/pim/ vmcore/include/ vmcore/src/exception/ vmcore/src/gc/ vmcore/src/jit/ vmcore/src/jvmti/ vmcore/src/ut...
Date Sat, 23 Sep 2006 12:26:01 GMT
Author: geirm
Date: Sat Sep 23 05:26:00 2006
New Revision: 449223

URL: http://svn.apache.org/viewvc?view=rev&rev=449223
Log:
HARMONY-1532

[DRLVM] Implement advanced scheme of jvmti PopFrame and several fixes into JVMTI.

        - Implement advanced scheme of jvmti PopFrame. It provides opportunity to evaluate
locals on the stack after 
pop, and allow several frames popping. This scheme can works for safe_point only.

        - Fix possible bug in GC stack enumeration after PopFrame. After pop frame nobody
enumerate methods arguments 
for GC. This patch fixes it.
        - JVMTI PopFrame support in the JET (VM Part). To provide correct pop of the method
frame, popped frame 
should be compiled with special flags. It's provide opportunity to find corresponding "this"
and restore context 
before method call.
        - ExceptionCatch event does not send in some cases. The source of the bug is missed
callback setting. So 
after add missed callback set, bug was fixed.
        - Fixed m2n frame registers in breakpoint dispatcher function.

Depends on HARMONY-1523 


Tested on Ubuntu 6 - smoke and c-unit


Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/port/include/m2n.h
    incubator/harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h
    incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/m2n_ia32.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/m2n_ia32_internal.h
    incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions_jit.h
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/port/include/m2n.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/port/include/m2n.h?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/port/include/m2n.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/port/include/m2n.h Sat Sep 23 05:26:00 2006
@@ -41,14 +41,19 @@
 struct M2nFrame;
 
 enum frame_type {
-    FRAME_UNKNOWN = 0x0,
-    FRAME_NON_UNWINDABLE = 0x1000,
-    FRAME_JNI = 0x1 | FRAME_NON_UNWINDABLE,
-    FRAME_COMPILATION = 0x2 | FRAME_NON_UNWINDABLE,
+    FRAME_UNKNOWN = 0x00,
+    FRAME_NON_UNWINDABLE = 0x80,
+    FRAME_JNI = 0x01 | FRAME_NON_UNWINDABLE,
+    FRAME_COMPILATION = 0x02 | FRAME_NON_UNWINDABLE,
+
     FRAME_UNPOPABLE = 0x0000,
     FRAME_POPABLE = 0x0100,
     FRAME_POP_NOW = 0x0200,
-    FRAME_SAFE_POINT = 0x0400
+    FRAME_POP_DONE = FRAME_POPABLE | FRAME_POP_NOW,
+
+    FRAME_POP_MASK = 0x0700,
+
+    FRAME_SAFE_POINT = 0x0800
 };
 
 // The pushing and popping of native frames is done only by stubs that
@@ -135,5 +140,11 @@
 
 // answers true if passed in m2n frame represents suspended frame
 bool m2n_is_suspended_frame(M2nFrame *);
+
+// returns pointer to the registers used for jvmti PopFrame
+Registers* get_pop_frame_registers(M2nFrame* );
+
+// sets pointer to the registers used for jvmti PopFrame
+void set_pop_frame_registers(M2nFrame* , Registers*);
 
 #endif //!_M2N_H_

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h Sat Sep 23 05:26:00
2006
@@ -138,8 +138,9 @@
  *
  * @param[in] si -  the pointer to the stack iterator that will be iterated to the previous
  *                  frame
+ * @param[in] over_popped - take into account the intermediate result of pop frame operation.
  */
-void si_goto_previous(StackIterator* si);
+void si_goto_previous(StackIterator* si, bool over_popped = true);
 
 /**
  * Gets the instruction pointer for the current frame.
@@ -285,5 +286,15 @@
  * @return The number of inlined methods.
  */
 uint32 si_get_inline_depth(StackIterator* si);
+
+/**
+ * Gets the method handle for the frame iterated by the stack iterator.
+ *
+ * @param[in] si - the pointer to the stack iterator indicating the frame,
+ *                 from which control will be transfered
+ * @param[in] callback - pointer to the native cose adress which should be
+ *                       called, after transfer control
+ */
+void si_set_callbak(StackIterator* si, NativeCodePtr* callback);
 
 #endif //!_STACK_ITERATOR_H_

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp
Sat Sep 23 05:26:00 2006
@@ -240,7 +240,7 @@
     return si->cci == NULL && si->m2n_frame == NULL;
 }
 
-void si_goto_previous(StackIterator * si) {
+void si_goto_previous(StackIterator * si, bool over_popped) {
     ASSERT_NO_INTERPRETER
     if (si_is_native(si)) {
         TRACE2("si", "si_goto_previous from ip = " 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/m2n_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/m2n_ia32.cpp?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/m2n_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/m2n_ia32.cpp Sat Sep 23
05:26:00 2006
@@ -28,6 +28,7 @@
 #include "encoder.h"
 #include "interpreter.h" // for asserts only
 
+
 //////////////////////////////////////////////////////////////////////////
 // M2nFrame Interface
 
@@ -184,7 +185,7 @@
 
 unsigned m2n_push_m2n_size(bool UNREF handles, unsigned num_callee_saves)
 {
-    return 20+(4-num_callee_saves)+m2n_ts_to_register_size()+11;
+    return 20+(4-num_callee_saves)+m2n_ts_to_register_size()+11+8;
 }
 
 char* m2n_gen_push_m2n(char* buf, Method_Handle method, frame_type current_frame_type, bool
UNREF handles, unsigned num_callee_saves)
@@ -199,6 +200,7 @@
     
     buf = m2n_gen_ts_to_register(buf, &eax_opnd);
     
+    buf = push(buf, Imm_Opnd(size_32, 0));
     //MVM APN 20050513 work with frame_type set up current_frame_type to NULL
     //int frame_type_offset = (int)&((VM_thread*)0)->current_frame_type;
     buf = push(buf, Imm_Opnd(current_frame_type));
@@ -239,7 +241,7 @@
     if (handles) size += (extra_on_stack+8<128 ? 12 : 15)+preserve_ret*2;
     else size += 11;
     if (extra_on_stack) size += (extra_on_stack<128 ? 3 : 6);
-    return size;
+    return size + 128;
 }
 
 void m2n_pop_local_handles() {
@@ -288,8 +290,8 @@
     buf = pop(buf,  esi_opnd);
     buf = pop(buf,  ebx_opnd);
     buf = mov(buf,  M_Base_Opnd(ebx_reg, +0),  esi_opnd);
-    buf = alu(buf, add_opc,  esp_opnd,  Imm_Opnd(+12));
-    
+    buf = alu(buf, add_opc,  esp_opnd,  Imm_Opnd(+16));
+
     if (num_callee_saves<4) buf = pop(buf,  edi_opnd);
     if (num_callee_saves<3) buf = pop(buf,  esi_opnd);
     if (num_callee_saves<2) buf = pop(buf,  ebx_opnd);
@@ -297,3 +299,14 @@
 
     return buf;
 }
+
+// returns pointer to the registers used for jvmti PopFrame
+Registers* get_pop_frame_registers(M2nFrame* m2nf) {
+    return m2nf->pop_regs;
+}
+
+// sets pointer to the registers used for jvmti PopFrame
+void set_pop_frame_registers(M2nFrame* m2nf, Registers* regs) {
+    m2nf->pop_regs = regs;
+}
+

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/m2n_ia32_internal.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/m2n_ia32_internal.h?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/m2n_ia32_internal.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/m2n_ia32_internal.h Sat
Sep 23 05:26:00 2006
@@ -40,7 +40,7 @@
 // It takes up space below and including the return address to the managed code, and thus
is immediately below the arguments.
 
 // This is the size of the structure that goes on the stack.
-const unsigned m2n_sizeof_m2n_frame = 40;
+const unsigned m2n_sizeof_m2n_frame = 44;
 
 // Generate code to put the thread local storage pointer into a given register
 unsigned m2n_ts_to_register_size();
@@ -95,12 +95,13 @@
     ObjectHandles*       local_object_handles;
     Method_Handle        method;
     frame_type           current_frame_type; // type of the current frame also shows is the
frame unwindable
+    Registers*           pop_regs; // This is only for M2nFrames for suspended managed code
(as against ones that call stubs and prepare jvmtiPopFrame)
     uint32               edi;
     uint32               esi;
     uint32               ebx;
     uint32               ebp;
     uint32               eip;
-    Registers*           regs; // This is only for M2nFrames for suspended managed code (as
against ones that call stubs)
+    Registers*           regs; // This is only for M2nFrames for suspended managed code (as
against ones that call stubs and prepare jvmtiPopFrame)
 };
 
 #endif //!_M2N_IA32_INTERNAL_H_

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp
Sat Sep 23 05:26:00 2006
@@ -59,7 +59,7 @@
 // Utilities
 
 // Goto the managed frame immediately prior to m2nfl
-static void si_unwind_from_m2n(StackIterator* si)
+static void si_unwind_from_m2n(StackIterator* si, bool over_popped = true)
 {
 #ifdef VM_STATS
     VM_Statistics::get_vm_stats().num_unwind_native_frames_all++;
@@ -87,6 +87,18 @@
         si->c.p_esi = &m2nfl->regs->esi;
         si->c.p_edi = &m2nfl->regs->edi;
         si->c.p_ebp = &m2nfl->regs->ebp;
+    } else if (over_popped &&
+            (FRAME_POP_DONE == (FRAME_POP_MASK & m2n_get_frame_type(m2nfl)))) {
+        si->c.esp = m2nfl->pop_regs->esp;
+        si->c.p_eip = &(m2nfl->pop_regs->eip);
+        si->c.is_ip_past = FALSE;
+        si->c.p_eax = &m2nfl->pop_regs->eax;
+        si->c.p_ebx = &m2nfl->pop_regs->ebx;
+        si->c.p_ecx = &m2nfl->pop_regs->ecx;
+        si->c.p_edx = &m2nfl->pop_regs->edx;
+        si->c.p_esi = &m2nfl->pop_regs->esi;
+        si->c.p_edi = &m2nfl->pop_regs->edi;
+        si->c.p_ebp = &m2nfl->pop_regs->ebp;
     } else {
         // Normal M2nFrame, eip is past instruction, esp is implicitly address just beyond
the frame, callee saves registers in M2nFrame
         si->c.esp   = (uint32)m2nfl + m2n_sizeof_m2n_frame;
@@ -137,9 +149,6 @@
     M_Base_Opnd m2(edx_reg, (int)&((StackIterator*)0)->c.esp);
     ss = mov(ss,  ecx_opnd,  m2);
 
-    M_Base_Opnd m3(ecx_reg, -4);
-    ss = mov(ss,  m3,  ebx_opnd);
-
     ss = alu(ss, sub_opc, ecx_opnd, Imm_Opnd(4));
     ss = mov(ss,  m1,  ecx_opnd);
 
@@ -147,6 +156,9 @@
     ss = get_reg(ss, &edi_opnd, edi_reg, edx_reg, (unsigned)&((StackIterator*)0)->c.p_edi);
     ss = get_reg(ss, &ebp_opnd, ebp_reg, edx_reg, (unsigned)&((StackIterator*)0)->c.p_ebp);
 
+    M_Base_Opnd m3(ecx_reg, 0);
+    ss = mov(ss,  m3,  ebx_opnd);
+
     ss = get_reg(ss, &eax_opnd, eax_reg, edx_reg, (unsigned)&((StackIterator*)0)->c.p_eax);
     ss = get_reg(ss, &ebx_opnd, ebx_reg, edx_reg, (unsigned)&((StackIterator*)0)->c.p_ebx);
     ss = get_reg(ss, &ecx_opnd, ecx_reg, edx_reg, (unsigned)&((StackIterator*)0)->c.p_ecx);
@@ -165,7 +177,6 @@
         mov         ebx,dword ptr [edx+0Ch]
         mov         ebx,dword ptr [ebx]
         mov         ecx,dword ptr [edx+4]
-        mov         dword ptr [ecx-4],ebx
         sub         ecx,4
         mov         dword ptr [esp+4],ecx
         mov         esi,dword ptr [edx+14h]
@@ -174,6 +185,7 @@
         mov         edi,dword ptr [edi]
         mov         ebp,dword ptr [edx+8]
         mov         ebp,dword ptr [ebp]
+        mov         dword ptr [ecx],ebx
         mov         eax,dword ptr [edx+1Ch]
         mov         eax,dword ptr [eax]
         mov         ebx,dword ptr [edx+18h]
@@ -265,7 +277,7 @@
     return si->cci==NULL && si->m2nfl==NULL;
 }
 
-void si_goto_previous(StackIterator* si)
+void si_goto_previous(StackIterator* si, bool over_popped)
 {
     ASSERT_NO_INTERPRETER
     if (si->cci) {
@@ -280,7 +292,7 @@
         TRACE2("si", ("si_goto_previous from ip = %p (M2N)",
             (void*)si_get_ip(si)));
         if (!si->m2nfl) return;
-        si_unwind_from_m2n(si);
+        si_unwind_from_m2n(si, over_popped);
     }
     si->cci = vm_methods->find(si_get_ip(si), true);
     if (si->cci) {
@@ -493,6 +505,12 @@
     regs->esi = *si->c.p_esi;
     regs->ebx = *si->c.p_ebx;
     regs->eax = *si->c.p_eax;
+}
+
+void si_set_callbak(StackIterator* si, NativeCodePtr* callback) {
+    si->c.esp = si->c.esp - 4;
+    *((uint32*) si->c.esp) = *(si->c.p_eip);
+    si->c.p_eip = ((uint32*)callback);
 }
 
 void si_reload_registers()

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp
Sat Sep 23 05:26:00 2006
@@ -501,7 +501,7 @@
     return si->cci==NULL && si->m2nfl==NULL;
 }
 
-void si_goto_previous(StackIterator* si)
+void si_goto_previous(StackIterator* si, bool over_popped)
 {
     if (si->cci) {
         assert(si->cci->get_jit() && si->cci->get_method());

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions_jit.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions_jit.h?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions_jit.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions_jit.h Sat Sep 23 05:26:00
2006
@@ -92,4 +92,7 @@
 
 Class_Handle exn_get_class_cast_exception_type();
 
+// Exception catch callback for jvm ti support implementation
+void asm_jvmti_exception_catch_callback();
+
 #endif // _EXCEPTIONS_JIT_H_

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h Sat Sep 23 05:26:00
2006
@@ -162,6 +162,19 @@
     /** call corresponding VM helper upon setting a value of any field of reference type
*/
     Boolean  exe_insert_write_barriers : 1;
 
+   /**
+    * Provide possibility to obtain reference to the current 'this' object by
+    * means of get_address_of_this method. Used for JVMTI debug support.
+    */
+    Boolean  exe_provide_access_to_this : 1;
+
+   /**
+    * Provide restoring of arguments in the stack after the call
+    * of the unwind_frame method so that method could be called again
+    * with the same arguments. Used for JVMTI debug support.
+    */
+    Boolean  exe_restore_context_after_unwind : 1;
+
 } OpenMethodExecutionParams;
 
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h Sat Sep 23 05:26:00
2006
@@ -81,6 +81,8 @@
 // Marks topmost frame of the specified thead to be popped
 jvmtiError jvmti_jit_pop_frame(jthread thread);
 // On current thread perform popping of topmost frame
+void jvmti_jit_prepare_pop_frame();
+void jvmti_jit_complete_pop_frame();
 void jvmti_jit_do_pop_frame();
 
 /* Events functions */

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h Sat Sep 23 05:26:00
2006
@@ -461,13 +461,14 @@
         void ReleaseNotifyLists();
 
         enum GlobalCapabilities {
-            TI_GC_ENABLE_METHOD_ENTRY           = 0x01,
-            TI_GC_ENABLE_METHOD_EXIT            = 0x02,
-            TI_GC_ENABLE_FRAME_POP_NOTIFICATION = 0x04,
-            TI_GC_ENABLE_SINGLE_STEP            = 0x08,
+            TI_GC_ENABLE_METHOD_ENTRY             = 0x01,
+            TI_GC_ENABLE_METHOD_EXIT              = 0x02,
+            TI_GC_ENABLE_FRAME_POP_NOTIFICATION   = 0x04,
+            TI_GC_ENABLE_SINGLE_STEP              = 0x08,
             TI_GC_ENABLE_EXCEPTION_EVENT          = 0x10,
             TI_GC_ENABLE_FIELD_ACCESS_EVENT       = 0x20,
-            TI_GC_ENABLE_FIELD_MODIFICATION_EVENT = 0x40
+            TI_GC_ENABLE_FIELD_MODIFICATION_EVENT = 0x40,
+            TI_GC_ENABLE_POP_FRAME                = 0x80
         };
 
         void set_global_capability(GlobalCapabilities ti_gc)

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h Sat Sep 23
05:26:00 2006
@@ -17,6 +17,6 @@
 #ifndef _VERSION_SVN_TAG_
 #define _VERSION_SVN_TAG_
 
-#define VERSION_SVN_TAG  "448280"
+#define VERSION_SVN_TAG  "449091"
 
 #endif // _VERSION_SVN_TAG_

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions.cpp?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions.cpp Sat Sep
23 05:26:00 2006
@@ -316,10 +316,12 @@
 
 static void check_pop_frame(ManagedObject *exn) {
     if (exn == VM_Global_State::loader_env->popFrameException->object) {
+        exn_clear();
         frame_type type = m2n_get_frame_type(m2n_get_last_frame());
 
-        if (FRAME_POP_NOW == (FRAME_POP_NOW & type))
+        if (FRAME_POP_NOW == (FRAME_POP_MASK & type)) {
             jvmti_jit_do_pop_frame();
+        }
     }
 }
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp Sat
Sep 23 05:26:00 2006
@@ -28,6 +28,7 @@
 #include "classloader.h"
 #include "exceptions.h"
 #include "exceptions_impl.h"
+#include "exceptions_jit.h"
 #include "environment.h"
 #include "dump.h"
 #include "heap.h"
@@ -424,8 +425,18 @@
     }
 
     si_transfer_all_preserved_registers(si);
+
+    DebugUtilsTI* ti = VM_Global_State::loader_env->TI;
+
     exn_propagate_exception(si, &local_exn_obj, exn_class, exn_constr,
         jit_exn_constr_args, vm_exn_constr_args);
+
+    if (ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_EXCEPTION_EVENT)) {
+        NativeCodePtr callback = (NativeCodePtr)
+                asm_jvmti_exception_catch_callback;
+        si_set_callbak(si, &callback);
+    }
+
     si_transfer_control(si);
 }   //exn_throw_for_JIT
 
@@ -482,9 +493,6 @@
     }
 
     M2nFrame *m2nf = m2n_push_suspended_frame(regs);
-
-    printf("jvmti_exception_catch_callback\n");
-    st_print();
 
     StackIterator *si = si_create_from_native();
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp Sat Sep
23 05:26:00 2006
@@ -275,7 +275,7 @@
                 << (m2n_get_method(si_get_m2n(si)) ? method_get_descriptor(m2n_get_method(si_get_m2n(si)))
: ""));
             oh_enumerate_handles(m2n_get_local_handles(si_get_m2n(si)));
         }
-        si_goto_previous(si);
+        si_goto_previous(si, false);
     }
     si_free(si);
 }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp Sat Sep 23 05:26:00
2006
@@ -691,14 +691,6 @@
     jvmti_get_compilation_flags(&flags);
     flags.exe_insert_write_barriers = gc_requires_barriers();
 
-    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if ( ti->isEnabled() ) {
-        if (ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_FIELD_ACCESS_EVENT))
-            flags.exe_notify_field_access = true;
-        if (ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_FIELD_MODIFICATION_EVENT))
-            flags.exe_notify_field_modification = true;
-    }
-
     Compilation_Handle ch;
     ch.env = VM_Global_State::loader_env;
     ch.jit = jit;
@@ -731,6 +723,9 @@
     if (!parallel_jit) {
         p_jit_a_method_lock->_unlock();
     }
+
+    // Find TI environment
+    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
 
     // Call TI callbacks
     if (ti->isEnabled() && ti->getPhase() == JVMTI_PHASE_LIVE) {

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp Sat Sep 23 05:26:00
2006
@@ -744,5 +744,14 @@
         ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_FRAME_POP_NOTIFICATION))
         flags->exe_notify_method_exit = 1;
 
+    if (ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_FIELD_ACCESS_EVENT))
+        flags->exe_notify_field_access = true;
+    if (ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_FIELD_MODIFICATION_EVENT))
+        flags->exe_notify_field_modification = true;
+
+    if (ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_POP_FRAME)) {
+        flags->exe_restore_context_after_unwind = true;
+        flags->exe_provide_access_to_this = true;
+    }
 }
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp Sat Sep 23
05:26:00 2006
@@ -201,7 +201,9 @@
     assert(ti->isEnabled());
     assert(!interpreter_enabled());
 
-    M2nFrame *m2nf = m2n_push_suspended_frame(regs);
+    Registers orig_regs = *regs;
+
+    M2nFrame *m2nf = m2n_push_suspended_frame(&orig_regs);
     BEGIN_RAISE_AREA;
 
     // need to be able to pop the frame

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp Sat Sep
23 05:26:00 2006
@@ -272,6 +272,9 @@
     if (capabilities_ptr->can_generate_field_modification_events)
         ti->set_global_capability(DebugUtilsTI::TI_GC_ENABLE_FIELD_MODIFICATION_EVENT);
 
+    if (capabilities_ptr->can_pop_frame)
+        ti->set_global_capability(DebugUtilsTI::TI_GC_ENABLE_POP_FRAME);
+
     return JVMTI_ERROR_NONE;
 }
 
@@ -356,6 +359,9 @@
 
     if (removed_caps.can_generate_field_modification_events)
         ti->reset_global_capability(DebugUtilsTI::TI_GC_ENABLE_FIELD_MODIFICATION_EVENT);
+
+    if (capabilities_ptr->can_pop_frame)
+        ti->reset_global_capability(DebugUtilsTI::TI_GC_ENABLE_POP_FRAME);
 
     return JVMTI_ERROR_NONE;
 }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp Sat Sep
23 05:26:00 2006
@@ -41,8 +41,12 @@
     if (FRAME_POP_NOW != (FRAME_POP_NOW & type))
         return;
 
-    // if we are in hythread_safe_point() or frame is unwindable
-    if (FRAME_SAFE_POINT == (FRAME_SAFE_POINT & type) || is_unwindable()) {
+    // if we are in hythread_safe_point() frame is unwindable
+    if (FRAME_SAFE_POINT == (FRAME_SAFE_POINT & type)) {
+        jvmti_jit_prepare_pop_frame();
+
+    // if we in unwindable frame
+    } else if (is_unwindable()) {
         // wait for resume
         TRACE(("entering safe_point"));
         hythread_safe_point();
@@ -51,6 +55,8 @@
         // switch execution to the previous frame
         jvmti_jit_do_pop_frame();
         assert(0 /* mustn't get here */);
+
+    // if we in nonunwindable frame
     } else {
         // raise special exception object
         exn_raise_object(VM_Global_State::loader_env->popFrameException);
@@ -61,6 +67,12 @@
 {
     assert(hythread_is_suspend_enabled());
 
+    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
+
+    if (!ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_POP_FRAME)) {
+        return JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
+    }
+
     hythread_t hy_thread = jthread_get_native_thread(java_thread);
     VM_thread* vm_thread = get_vm_thread(hy_thread);
 
@@ -89,7 +101,10 @@
 
     si_free(si);
 
-    type = (frame_type) (type | FRAME_POP_NOW);
+    // change type from popable to pop_now, pop_done should'n be changed
+    if (FRAME_POPABLE == (type & FRAME_POP_MASK)) {
+        type = (frame_type)((type & ~FRAME_POP_MASK) | FRAME_POP_NOW);
+    }
     m2n_set_frame_type(top_frame, type);
 
     // Install safepoint callback that would perform popping job
@@ -98,14 +113,39 @@
     return JVMTI_ERROR_NONE;
 } //jvmti_jit_pop_frame
 
-void jvmti_jit_do_pop_frame()
-{
-    // Destructive Unwinding!!! NO CXZ Logging put here.
 
-    // create stack iterator from native
-    StackIterator* si = si_create_from_native();
-    si_transfer_all_preserved_registers(si);
+#ifdef _IPF_
+
+void jvmti_jit_prepare_pop_frame(){
+    assert(0);
+}
+
+void jvmti_jit_complete_pop_frame(){
+    assert(0);
+}
+
+void jvmti_jit_do_pop_frame(){
+    assert(0);
+}
+
+#elif defined _EM64T_
+
+void jvmti_jit_prepare_pop_frame(){
+    assert(0);
+}
+
+void jvmti_jit_complete_pop_frame(){
+    assert(0);
+}
+
+void jvmti_jit_do_pop_frame(){
+    assert(0);
+}
+
+#else // _IA32_
 
+// requires stack iterator and buffer to save intermediate information
+static void jvmti_jit_prepare_pop_frame(StackIterator* si, uint32* buf) {
     // pop native frame
     assert(si_is_native(si));
     si_goto_previous(si);
@@ -162,25 +202,27 @@
     } else if (0xd0ff == (*((unsigned short*)(((char*)ip)-2)))) {
         ip_reduce = 2;
         current_method_addr = cci->get_code_block_addr();
-        jitContext->p_eax = (uint32*)&current_method_addr;
+        *buf = (uint32)current_method_addr;
+        jitContext->p_eax = buf;
 
     // invoke virtual and special
     } else {
         VTable_Handle vtable = class_get_vtable( method_class);
+        *buf = (uint32) vtable;
         unsigned short code = (*((unsigned short*)(((char*)ip)-3)));
 
         // invoke virtual
         if (0x50ff == code) {
-            jitContext->p_eax = (uint32*) &vtable;
+            jitContext->p_eax = buf;
             ip_reduce = 3;
         } else if (0x51ff == code) {
-            jitContext->p_ecx = (uint32*) &vtable;
+            jitContext->p_ecx = buf;
             ip_reduce = 3;
         } else if (0x52ff == code) {
-            jitContext->p_edx = (uint32*) &vtable;
+            jitContext->p_edx = buf;
             ip_reduce = 3;
         } else if (0x53ff == code) {
-            jitContext->p_ebx = (uint32*) &vtable;
+            jitContext->p_ebx = buf;
             ip_reduce = 3;
 
         // invoke special
@@ -192,19 +234,123 @@
     // set corrrrect ip
     ip = (NativeCodePtr)(((char*)ip) - ip_reduce);
     si_set_ip(si, ip, false);
+}
+
+void jvmti_jit_prepare_pop_frame() {
+    // Find top m2n frame
+    M2nFrame* top_frame = m2n_get_last_frame();
+    frame_type type = m2n_get_frame_type(top_frame);
+
+    // Check that frame has correct type
+    assert((FRAME_POP_NOW == (FRAME_POP_MASK & type))
+            ||(FRAME_POP_DONE == (FRAME_POP_MASK & type)));
+
+    // create stack iterator from native
+    StackIterator* si = si_create_from_native();
+    si_transfer_all_preserved_registers(si);
+
+    // preare pop frame - find regs values
+    uint32 buf = 0;
+    jvmti_jit_prepare_pop_frame(si, &buf);
+
+    // save regs value from jit context to m2n
+    JitFrameContext* jitContext = si_get_jit_context(si);
+    Registers* regs = get_pop_frame_registers(top_frame);
+
+    regs->esp = jitContext->esp;
+    regs->eip = *(jitContext->p_eip);
+    regs->esi = *(jitContext->p_esi);
+    regs->edi = *(jitContext->p_edi);
+    regs->ebp = *(jitContext->p_ebp);
+
+    if (0 == jitContext->p_eax) {
+        regs->eax = 0;
+    } else {
+        regs->eax = *(jitContext->p_eax);
+    }
+
+    if (0 == jitContext->p_ebx) {
+        regs->ebx = 0;
+    } else {
+        regs->ebx = *(jitContext->p_ebx);
+    }
+
+    if (0 == jitContext->p_ecx) {
+        regs->ecx = 0;
+    } else {
+        regs->ecx = *(jitContext->p_ecx);
+    }
+
+    if (0 == jitContext->p_edx) {
+        regs->edx = 0;
+    } else {
+        regs->edx = *(jitContext->p_edx);
+    }
+
+    // set pop done frame state
+    m2n_set_frame_type(top_frame, FRAME_POP_DONE);
+}
+
+void jvmti_jit_complete_pop_frame() {
+    // Destructive Unwinding!!! NO CXX Logging put here.
+
+    // Find top m2n frame
+    M2nFrame* top_frame = m2n_get_last_frame();
+    frame_type type = m2n_get_frame_type(top_frame);
+
+    // Check that frame has correct type
+    assert(FRAME_POP_DONE == (FRAME_POP_MASK & type));
+
+    // create stack iterator from native
+    StackIterator* si = si_create_from_native();
+    si_transfer_all_preserved_registers(si);
+
+    // pop native frame
+    assert(si_is_native(si));
+    si_goto_previous(si);
 
     // transfer cdontrol
     si_transfer_control(si);
-} // jvmti_jit_do_pop_frame
+}
+
+void jvmti_jit_do_pop_frame() {
+    // Destructive Unwinding!!! NO CXX Logging put here.
+
+    // Find top m2n frame
+    M2nFrame* top_frame = m2n_get_last_frame();
+    frame_type type = m2n_get_frame_type(top_frame);
+
+    // Check that frame has correct type
+    assert(FRAME_POP_NOW == (FRAME_POP_MASK & type));
+
+    // create stack iterator from native
+    StackIterator* si = si_create_from_native();
+    si_transfer_all_preserved_registers(si);
+
+    // preare pop frame - find regs values
+    uint32 buf = 0;
+    jvmti_jit_prepare_pop_frame(si, &buf);
+
+    // transfer cdontrol
+    si_transfer_control(si);
+}
+#endif // _IA32_
 
 void jvmti_safe_point()
 {
-//    TRACE(("entering safe_point"));
+    Registers regs;
+    M2nFrame* top_frame = m2n_get_last_frame();
+    set_pop_frame_registers(top_frame, &regs);
+
+    TRACE(("entering safe_point"));
     hythread_safe_point();
+    TRACE(("left safe_point"));
 
-    //TRACE(("left safe_point"));
-    //frame_type type = m2n_get_frame_type(m2n_get_last_frame());
+    // find frame type
+    frame_type type = m2n_get_frame_type(top_frame);
 
-    //if (FRAME_POP_NOW == (FRAME_POP_NOW & type))
-    //    jvmti_jit_do_pop_frame();
+    // complete pop frame if frame has correct type
+    if (FRAME_POP_DONE == (FRAME_POP_MASK & type)){
+        jvmti_jit_complete_pop_frame();
+    }
 }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp Sat Sep
23 05:26:00 2006
@@ -109,7 +109,7 @@
     }
 }
 
-static void __attribute__ ((cdecl)) asm_jvmti_exception_catch_callback() {
+void __attribute__ ((cdecl)) asm_jvmti_exception_catch_callback() {
     //naked_jvmti_exception_catch_callback:
     asm (
         "addl $-36, %%esp;\n"
@@ -154,7 +154,6 @@
         regs.esp = regs.esp - 4;
         *((uint32*) regs.esp) = regs.eip;
         regs.eip = ((uint32)asm_jvmti_exception_catch_callback);
-        //regs.eip = ((uint32)naked_jvmti_exception_catch_callback);
     }
 
     linux_regs_to_ucontext(uc, &regs);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp?view=diff&rev=449223&r1=449222&r2=449223
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
Sat Sep 23 05:26:00 2006
@@ -227,7 +227,7 @@
     jvmti_exception_catch_callback(&regs);
 }
 
-static void __declspec(naked) __stdcall naked_exception_catch_callback() {
+static void __declspec(naked) asm_exception_catch_callback() {
     __asm {
         push ebp
         mov ebp, esp
@@ -245,7 +245,7 @@
     }
 }
 
-static void __declspec(naked) __stdcall naked_jvmti_exception_catch_callback() {
+void __declspec(naked) asm_jvmti_exception_catch_callback() {
     __asm {
         push ebp
         mov ebp, esp
@@ -443,11 +443,11 @@
     if (ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_EXCEPTION_EVENT)) {
         regs.esp = regs.esp - 4;
         *((uint32*) regs.esp) = regs.eip;
-        regs.eip = ((uint32)naked_jvmti_exception_catch_callback);
+        regs.eip = ((uint32)asm_jvmti_exception_catch_callback);
     } else if (p_TLS_vmthread->restore_guard_page) {
         regs.esp = regs.esp - 4;
         *((uint32*) regs.esp) = regs.eip;
-        regs.eip = ((uint32)naked_exception_catch_callback);
+        regs.eip = ((uint32)asm_exception_catch_callback);
     }
 
     vm_to_nt_context(&regs, context);



Mime
View raw message