Mon Feb 11 12:32:35 CET 2002 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Mon, 11 Feb 2002 07:42:10 +0000 (07:42 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Mon, 11 Feb 2002 07:42:10 +0000 (07:42 -0000)
* x86/tramp.c: fix handling of multiple marshaleed strings.
* x86/x86-codegen.h: some code to patch branch displacements.

svn path=/trunk/mono/; revision=2308

mono/arch/ChangeLog
mono/arch/x86/tramp.c
mono/arch/x86/x86-codegen.h

index 7c572e75abb7b439c6b39d5a523de6f65f9fe0fb..a85e8658e459a98c1a658dcbff9b4c3b9e1e7a16 100644 (file)
@@ -1,4 +1,9 @@
 
+Mon Feb 11 12:32:35 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+       * x86/tramp.c: fix handling of multiple marshaleed strings.
+       * x86/x86-codegen.h: some code to patch branch displacements.
+
 Fri Feb 1 16:03:00 CET 2002 Paolo Molaro <lupus@ximian.com>
 
        * x86/tramp.c, ppc/tramp.c: implement mono_method_pointer_get ().
index 93e2664497e095cd17635d9397db8e02b10497da..e9fef810eebba32324c507a0962144a6df96a4a0 100644 (file)
@@ -304,9 +304,8 @@ enum_retvalue:
         * free the allocated strings.
         */
        if (!(method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)) {
-               if (local_size)
-                       x86_mov_reg_imm (p, X86_EDX, g_free);
                for (i = 1; i <= local_size; ++i) {
+                       x86_mov_reg_imm (p, X86_EDX, g_free);
                        x86_push_membase (p, X86_EBP, LOC_POS * i);
                        x86_call_reg (p, X86_EDX);
                }
index 0bee23e436bb9d1fa30416ab3d9eec04eb748047..b57e50e3d58267f513844bc2aba95186f9dae16e 100644 (file)
@@ -1,7 +1,7 @@
 /* Copyright (C)  2000 Intel Corporation.  All rights reserved.
    Copyright (C)  2001 Ximian, Inc. 
 //
-// $Header: /home/miguel/third-conversion/public/mono/mono/arch/x86/x86-codegen.h,v 1.21 2002/02/01 12:04:33 dietmar Exp $
+// $Header: /home/miguel/third-conversion/public/mono/mono/arch/x86/x86-codegen.h,v 1.22 2002/02/11 07:42:10 lupus Exp $
 */
 
 #ifndef X86_H
@@ -260,6 +260,26 @@ typedef union {
                }       \
        } while (0)
 
+/* disp will need to be relative to the start position... */
+#define x86_patch(ins,disp)    \
+       do {    \
+               unsigned char* pos = (ins) + 1; \
+               int size = 0;   \
+               switch (*(ins)) {       \
+               case 0xe9: ++size; break;       \
+               case 0x0f: ++size; ++pos; break;        \
+               case 0xeb:      \
+               case 0x70: case 0x71: case 0x72: case 0x73:     \
+               case 0x74: case 0x75: case 0x76: case 0x77:     \
+               case 0x78: case 0x79: case 0x7a: case 0x7b:     \
+               case 0x7c: case 0x7d: case 0x7e: case 0x7f:     \
+                       break;  \
+               default: assert (0);    \
+               }       \
+               if (size) x86_imm_emit32 (pos, (disp)); \
+               else x86_imm_emit8 (pos, (disp));       \
+       } while (0)
+
 #define x86_breakpoint(inst) \
        do {    \
                *(inst)++ = 0xcc;       \