[Mono-dev] Question(s) about the JIT implementation

Mark Mason mmason at upwardaccess.com
Wed Nov 26 13:14:13 EST 2008


Hello all,

I'm working on getting the MIPS JIT ported back up to the top-of-tree,
and have run into a few issues - primarily with areas that have changed
a lot since I looked at it last. I am hoping that someone can spare a
couple of sentences to point me in the right direction here.

As it stands now, hello.exe on MIPS gets as far as the following:

mason at 10:~/Mono-MIPS/mono/mono/mini$ ./mono hello.exe 
Stacktrace:

  at System.Globalization.TextInfo..ctor
(System.Globalization.CultureInfo,int,void*,bool) <0xffffffff>
  at System.Globalization.TextInfo..ctor
(System.Globalization.CultureInfo,int,void*,bool) <0x00148>
  at System.Globalization.CultureInfo.ConstructInvariant (bool)
<0x001c0>
  at System.Globalization.CultureInfo..ctor (int,bool,bool) <0x00088>
  at System.Threading.Thread.get_CurrentCulture () <0xffffffff>
  at System.Threading.Thread.get_CurrentCulture () <0x0011c>
  at System.NumberFormatter..ctor (System.Threading.Thread) <0x00078>
  at System.Threading.Thread.AcquireNumberFormatter () <0x0006c>
  at System.NumberFormatter.GetInstance () <0x00030>
  at System.NumberFormatter.NumberToString
(string,int,System.IFormatProvider) <0x00024>
  at System.NumberFormatter.NumberToString (int,System.IFormatProvider)
<0x0007c>
  at int.ToString () <0x0002c>
  at System.Text.Encoding.GetEncoding (int) <0x003cc>
  at System.Text.Encoding.get_Default () <0x00210>
  at System.Console..cctor () <0x00210>
  at (wrapper runtime-invoke) object.runtime_invoke_void
(object,intptr,intptr,intptr) <0xffffffff>
  at TestBed1.MainClass.Main (string[]) <0xffffffff>
  at TestBed1.MainClass.Main (string[]) <0x0002c>
  at (wrapper runtime-invoke)
TestBed1.MainClass.runtime_invoke_void_object
(object,intptr,intptr,intptr) <0xffffffff>
Aborted

Rewriting: As MIPS uses compare-and-branch opcodes rather than separate
compare/branch opcodes (there's no condition register for one thing),
what we used to do was rewrites to MIPS specific opcodes in the burg
rules. Burg isn't with us any more, but the rewriting still needs to
happen. I'm currently doing it in peephole pass 1, but this really needs
to move into a separate pass which isn't an "optimization" that can be
disabled from the command line. Maybe add mono_arch_rewrite_pass_1() and
the appropriate enabling macro, and call it right after the lowering
pass? Thoughts?


IMT: I'm not quite clear on what this is, which makes adding support for
it a bit difficult. I have it enabled at the moment, and hello world is
crashing on the first "use" of it (see below). I know that I'm locating
the LMF correctly [because MIPS LMFs have magic numbers ;)] but I'm no
where near so confident about MONO_ARCH_IMT_REG,
mono_arch_build_imt_thunk (which hasn't been called yet below), and
other friends.

(gdb) r hello.exe 
Starting program: /home/mason/Mono-MIPS/mono/mono/mini/mono hello.exe
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 14569)]
[New Thread 32769 (LWP 14572)]
[New Thread 16386 (LWP 14573)]
[New Thread 32771 (LWP 14574)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 14569)]
0x00548ce4 in mono_convert_imt_slot_to_vtable_slot (slot=0x8395c0,
regs=0x7f88b440, code=0x2b3ffeb0 "\024@", method=0x84b3f8,
impl_method=0x0)
    at mini-trampolines.c:63
63                      interface_offset = mono_class_interface_offset
(vt->klass, imt_method->klass);
(gdb) where
#0  0x00548ce4 in mono_convert_imt_slot_to_vtable_slot (slot=0x8395c0,
regs=0x7f88b440, code=0x2b3ffeb0 "\024@", method=0x84b3f8, 
    impl_method=0x0) at mini-trampolines.c:63
#1  0x0054a0f0 in mono_magic_trampoline (regs=0x7f88b440,
code=0x2b3ffeb0 "\024@", m=0x84b3f8, tramp=0x0) at
mini-trampolines.c:335
#2  0x2aac8164 in ?? ()


Thanks all,
Mark




More information about the Mono-devel-list mailing list