[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-devel-list
Subject:    Re: [Mono-dev] Question(s) about the JIT implementation
From:       Mark Mason <mmason () upwardaccess ! com>
Date:       2008-11-26 19:08:40
Message-ID: 1227726520.3823.69.camel () hawaii ! site
[Download RAW message or body]

Hello!

First off -- thanks Zoltan. I really appreciate it.

Regarding IMT: I turned it off entirely (not sure - is this the right
thing to do? I still don't even know what IMT stands for ;)), and had to
make a few small patches to common code to get things to link (see
attached). If these look OK (or at least not likely to break anything),
I can check them in if you like.

I'll start working through basic.exe and friends. I'm back to missing
opcode failures - those I know how to fix. ;)

Thanks for the pointers!
Mark


On Wed, 2008-11-26 at 19:37 +0100, Zoltan Varga wrote:
> Hi,
> 
>  * I think the compare opcodes can be rewritten in the lowering pass.
> * You can disable IMT first by simply not declaring MONO_ARCH_IMT_REG. The same
>    goes for MONO_ARCH_VTABLE_REG.
> * Instead of trying to run hello.exe, you should try running the JIT
> regression tests, which
>   consists of many small functions so it is much easier to track down
> failures. They can
>   be compiled in another machine by type-ing make check in the mini
> directory, then
>   copied to the MIPS machine, then run there by type-ing make check.
> 
>                          Zoltan
> 
> On Wed, Nov 26, 2008 at 7:14 PM, Mark Mason <mmason@upwardaccess.com> wrote:
> > 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@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
> >
> >
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >

["imt.diff" (imt.diff)]

Index: mini-trampolines.c
===================================================================
--- mini-trampolines.c	(revision 120061)
+++ mini-trampolines.c	(working copy)
@@ -172,7 +172,9 @@
 		else
 			g_assert (!m->klass->generic_container);
 
+#ifdef MONO_ARCH_HAVE_IMT
 		generic_virtual_method_inst = (MonoGenericInst*)mono_arch_find_imt_method ((gpointer*)regs, code);
+#endif
 		context.method_inst = generic_virtual_method_inst;
 
 		m = mono_class_inflate_generic_method (declaring, &context);
@@ -387,8 +389,9 @@
 	else
 		g_assert (!m->klass->generic_container);
 
+#ifdef MONO_ARCH_HAVE_IMT
 	context.method_inst = (MonoGenericInst*)mono_arch_find_imt_method ((gpointer*)regs, code);
-
+#endif
 	m = mono_class_inflate_generic_method (declaring, &context);
 	m = mono_marshal_get_remoting_invoke_with_check (m);
 
Index: method-to-ir.c
===================================================================
--- method-to-ir.c	(revision 120061)
+++ method-to-ir.c	(working copy)
@@ -2306,10 +2306,12 @@
 			slot_reg = vtable_reg;
 			call->inst.inst_offset = G_STRUCT_OFFSET (MonoVTable, vtable) +
 				(mono_method_get_vtable_index (method) * SIZEOF_VOID_P);
+#ifdef MONO_ARCH_HAVE_IMT
 			if (imt_arg) {
 				g_assert (mono_method_signature (method)->generic_param_count);
 				emit_imt_argument (cfg, call, imt_arg);
 			}
+#endif
 		}
 
 		call->inst.sreg1 = slot_reg;


_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic