[Mono-dev] Mono:MIPS patch

Yoichi NAKAYAMA nakayama at pixela.co.jp
Wed Oct 17 20:41:51 EDT 2007


Hello,
  I'm trying to use Mono runtime on MIPS architecture. Attached change mend
some problems, but I'm not confident of the changes (especially the 2nd one),
and I want to ask for the review.

1. At first, compilation fails since there is no definition for mips
   in mono/mono/utils/mono-membar.h. I uses
     __asm__ __volatile__ ("" : : : "memory");
   as for ARM.

2. basic-long.exe stopped at 

     ** ERROR **: file mini-codegen.c: line 224 (mono_spillvar_offset_int): should not be reached

   When I remove the g_assert_not_reached, another assertion fails:

     ** ERROR **: file mini-mips.c: line 3190 (mono_arch_emit_prolog): assertion failed: ((alloc_size & (MIPS_STACK_ALIGNMENT-1)) == 0)

   Below the assertion,

     /* re-align cfg->stack_offset if needed (due to var spilling in mini-codegen.c) */
     cfg->stack_offset = (cfg->stack_offset + MIPS_STACK_ALIGNMENT - 1) & ~(MIPS_STACK_ALIGNMENT - 1);

     /* stack_offset should not be changed here. */
     alloc_size = cfg->stack_offset;
     cfg->stack_usage = alloc_size;

   implies spilling may break alignment and alloc_size is reset by aligned value,
   so I just removed the assertion, then basic-long.exe runs without aborting.

   I'm not sure what is the correct fix here. The second comment says 'stack_offset'
   should not be changed. Should we keep stack_offset and align alloc_size alone?

3. Wrong code genered for conditional branching, e.g.

     using System;
     class CompareIntegers_simple
     {
       public static void Main() {
         long i64 = 0;
     
         if (i64 < Int32.MinValue) {
           Console.WriteLine("True");
         }
       }
     }

   I found there are some mistakes in mono/mono/mini/inssel-long32-mips.brg.
   I've fixed it and added some related tests.

With those changes, I've checked that "mono --regression basic-long.exe"
passes except test_0_conv_to_r4 (tested on Debian-MIPS on qemu).

Sincerely yours,
--
Yoichi NAKAYAMA
Pixela Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mono_mips.patch
Type: application/octet-stream
Size: 9876 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20071018/5e697ae9/attachment.obj 


More information about the Mono-devel-list mailing list