harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r507957 - in /harmony/enhanced/drlvm/trunk/vm: port/include/ port/src/lil/em64t/pim/ port/src/lil/ia32/pim/ port/src/lil/ipf/pim/ vmcore/src/exception/
Date Thu, 15 Feb 2007 15:17:03 GMT
Author: gshimansky
Date: Thu Feb 15 07:17:02 2007
New Revision: 507957

URL: http://svn.apache.org/viewvc?view=rev&rev=507957
Log:
Applied HARMONY-2692 [drlvm] throwing exception in mixed mode leaks memory

I've made changes to the patch to allow it compiled on IPF. I've also made
ad workaround to make it work on IPF in interpreter mode.

Tests passed on Ubuntu6 x86, Windows XP x86, SLES9 x86_64 and SLES9 IPF


Modified:
    harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h
    harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp
    harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp
    harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h?view=diff&rev=507957&r1=507956&r2=507957
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h Thu Feb 15 07:17:02 2007
@@ -296,6 +296,6 @@
  * @param[in] callback - pointer to the native cose adress which should be
  *                       called, after transfer control
  */
-void si_set_callbak(StackIterator* si, NativeCodePtr* callback);
+void si_set_callback(StackIterator* si, NativeCodePtr* callback);
 
 #endif //!_STACK_ITERATOR_H_

Modified: harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp?view=diff&rev=507957&r1=507956&r2=507957
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp Thu Feb
15 07:17:02 2007
@@ -372,7 +372,7 @@
     regs->r11 = *si->jit_frame_context.p_r11;
 }
 
-void si_set_callbak(StackIterator* si, NativeCodePtr* callback) {
+void si_set_callback(StackIterator* si, NativeCodePtr* callback) {
     si->jit_frame_context.rsp = si->jit_frame_context.rsp - 4;
     *((uint64*) si->jit_frame_context.rsp) = *(si->jit_frame_context.p_rip);
     si->jit_frame_context.p_rip = ((uint64*)callback);

Modified: harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp?view=diff&rev=507957&r1=507956&r2=507957
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp Thu Feb
15 07:17:02 2007
@@ -512,7 +512,7 @@
     regs->eax = unref_reg(si->c.p_eax);
 }
 
-void si_set_callbak(StackIterator* si, NativeCodePtr* callback) {
+void si_set_callback(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);

Modified: harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp?view=diff&rev=507957&r1=507956&r2=507957
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp Thu Feb 15
07:17:02 2007
@@ -656,6 +656,10 @@
     ABORT("Not implemented");
 }
 
+void si_set_callback(StackIterator* si, NativeCodePtr* callback) {
+    ABORT("Not implemented");
+}
+
 extern "C" void do_loadrs_asm(int loadrs);
 
 void si_reload_registers()

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp?view=diff&rev=507957&r1=507956&r2=507957
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp Thu Feb 15 07:17:02
2007
@@ -45,6 +45,7 @@
 #include "cci.h"
 
 #ifdef _IPF_
+#include "../m2n_ipf_internal.h"
 #elif defined _EM64T_
 #include "../m2n_em64t_internal.h"
 #else
@@ -439,12 +440,20 @@
     exn_propagate_exception(si, &local_exn_obj, exn_class, exn_constr,
         jit_exn_constr_args, vm_exn_constr_args);
 
+    M2nFrame* m2nFrame = m2n_get_last_frame();
+	ObjectHandles* last_m2n_frame_handles = m2nFrame->local_object_handles;
+
+	if (last_m2n_frame_handles) {
+            free_local_object_handles2(last_m2n_frame_handles);
+	}
+
     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_set_callback(si, &callback);
     }
 
+    // don't put any call here
     si_transfer_control(si);
 }   //exn_throw_for_JIT
 
@@ -605,9 +614,25 @@
         return addr;
     }
 
-    LilCodeStub *cs = lil_parse_code_stub("entry 0:managed:pint:void;"
-        "push_m2n 0, 0;"
-        "m2n_save_all;" "in2out platform:void;" "call.noret %0i;",
+    const unsigned cap_off = (unsigned)(POINTER_SIZE_INT)&((ObjectHandlesNew*)0)->capacity;
+    const unsigned next_off = (unsigned)(POINTER_SIZE_INT)&((ObjectHandlesNew*)0)->next;
+    const unsigned handles_size = (unsigned)(sizeof(ObjectHandlesNew)+sizeof(ManagedObject*)*16);
+    const unsigned cap_and_size = (unsigned)((0<<16) | 16);
+
+    LilCodeStub *cs = lil_parse_code_stub(
+		"entry 0:managed:pint:void;"
+        "push_m2n 0, 0, handles;"
+        "m2n_save_all;"
+		"locals 1;"
+		"alloc l0, %0i;"
+		"st[l0+%1i:g4], %2i;"
+		"st[l0+%3i:pint], 0;"
+		"handles=l0;"
+		"in2out platform:void;"
+		"call.noret %4i;",
+		handles_size,
+        cap_off, cap_and_size,
+        next_off,
         rth_throw_lazy);
     assert(lil_is_valid(cs));
     addr = LilCodeGenerator::get_platform()->compile(cs);
@@ -628,11 +653,24 @@
         return addr;
     }
 
+    const unsigned cap_off = (unsigned)(POINTER_SIZE_INT)&((ObjectHandlesNew*)0)->capacity;
+    const unsigned next_off = (unsigned)(POINTER_SIZE_INT)&((ObjectHandlesNew*)0)->next;
+    const unsigned handles_size = (unsigned)(sizeof(ObjectHandlesNew)+sizeof(ManagedObject*)*16);
+    const unsigned cap_and_size = (unsigned)((0<<16) | 16);
+
     LilCodeStub *cs = lil_parse_code_stub("entry 1:managed::void;"
-        "push_m2n 0, 0;"
+        "push_m2n 0, 0, handles;"
         "m2n_save_all;"
+		"locals 1;"
+		"alloc l0, %0i;"
+		"st[l0+%1i:g4], %2i;"
+		"st[l0+%3i:pint], 0;"
+		"handles=l0;"
         "out platform:ref,pint,pint,pint:void;"
-        "o0=0:ref;" "o1=sp0;" "o2=0;" "o3=0;" "call.noret %0i;",
+        "o0=0:ref;" "o1=sp0;" "o2=0;" "o3=0;" "call.noret %4i;",
+		handles_size,
+        cap_off, cap_and_size,
+        next_off,
         exn_athrow);
     assert(lil_is_valid(cs));
     addr = LilCodeGenerator::get_platform()->compile(cs);



Mime
View raw message