[Mono-dev] Mono JIT on MIPS - disappearing this argument in virtual call....

Mark E Mason mark.e.mason at broadcom.com
Wed Sep 13 22:44:38 EDT 2006


Belay that - I found it.  My mistake.

It gets a lot farther now.... LOL

Thanks again,
/Mark 

> -----Original Message-----
> From: Mark E Mason 
> Sent: Wednesday, September 13, 2006 3:57 PM
> To: mono-devel-list at lists.ximian.com
> Cc: Mark E Mason
> Subject: Mono JIT on MIPS - disappearing this argument in 
> virtual call....
> 
> Hello all,
>  
> I'm working on a MIPS port of the Mono JIT compiler.  It's 
> coming along fairly well -- my "hello, world" test is getting 
> approximately halfway to actually producing output.... lol.
>  
> I've run into a problem with generating calls to virtual 
> functions with 'this' pointers.  In the 
> mono_arch_call_opcode() function (for most all JIT targets), 
> there's the following if() which prevents the 'this' argument 
> from being placed on the call->out_args list:
>  
> 1044                    if (is_virtual && i == 0) {
> 1045                            /* the argument will be 
> attached to the call instrucion */
> 1046                            in = call->args [i];
> 1047                            call->used_iregs |= 1 << ainfo->reg;
> 1048                    } else {
> 
> This seems to be compensated for in 
> mono_emit_method_call_full(), where the 'this' pointer gets 
> placed into the call instruction directly:
> 
> 	call->inst.flags |= MONO_INST_HAS_METHOD;
> 	call->inst.inst_left = this;
> 
> But - the 'this' argument doesn't get emitted, and I'm 
> getting lost in tracking down where this 'should' be handled. 
>  See below for an example (the first arg to the 3rd call in 
> Block 4 should be getting into 'a0', but that's not happening 
> (there's an assignment to 'R34' which never gets moved from 
> there to the register 'a0'.
> 
> Pointers anyone?  I've working off of the svn tip as of about 
> a week ago.
> 
> Thanks in advance,
> Mark
> 
> [Snipped output below - I've '*' the lines corresponding to 
> the 'this' pointer]
> 
> converting method System.Console:OpenStandardError (int)
> 
> CODE BLOCK 4 (nesting 0):
>  (stind.i local[3] call[get_ConsoleError])
>  (outarg iconst[7155124])
>  (stind.ref local[4] call[mono_object_new_specific])
> * (outarg (ldind.i local[3]))
>  (outarg iconst[2])
>  (outarg iconst[0])
>  (outarg (ldind.i4 arg[0]))
>  (outarg iconst[0])
>  (outarg (ceq (compare (ldind.i4 arg[0]) iconst[0])))
>  (voidcallvirt[.ctor])
>  (stind.ref local[1] (ldind.ref local[4]))
>  br[B6]
> 
> 
> DUMP BLOCK 4:
>  (stind.i regoffset[0x60(mips_fp)] call[get_ConsoleError])
>  (outarg iconst[7155124])
>  (stind.ref regvar[mips_s5] call[mono_object_new_specific])
> * (outarg (ldind.i regoffset[0x60(mips_fp)]))
>  (outarg iconst[2])
>  (outarg iconst[0])
>  (outarg (ldind.i4 regoffset[0x90(mips_fp)]))
>  (outarg iconst[0])
>  (outarg (ceq (compare (ldind.i4 regoffset[0x90(mips_fp)]) 
> iconst[0])))
>  (voidcallvirt[.ctor])
>  (stind.ref regoffset[0x58(mips_fp)] (ldind.ref regvar[mips_s5]))
>  br[B6]
> 
> 
> LABEL BLOCK 4:
>  (stind.i regoffset[0x60(mips_fp)] call[get_ConsoleError])
>  (outarg iconst[7155124])
>  (stind.ref regvar[mips_s5] call[mono_object_new_specific])
> * (outarg (ldind.i regoffset[0x60(mips_fp)]))
>  (outarg iconst[2])
>  (outarg iconst[0])
>  (outarg (ldind.i4 regoffset[0x90(mips_fp)]))
>  (outarg iconst[0])
>  (outarg (ceq (compare (ldind.i4 regoffset[0x90(mips_fp)]) 
> iconst[0])))
>  (voidcallvirt[.ctor])
>  (stind.ref regoffset[0x58(mips_fp)] (ldind.ref regvar[mips_s5]))
>  br[B6]
> 
> 
> LOCAL REGALLOC: BASIC BLOCK: 4
>         1  call R32 <- clobbers: c
>         2  store_membase_reg [mips_fp + 0x60] <- R32
>         3  setregimm mips_a0 <- clobbers: r
>         4  call R33 <- clobbers: c
>         5  move mips_s5 <- R33
> 
> Where did the calculation the 'this' pointer and the 
> assignment to 'a0' go? 
> 
>         6  load_membase R34 <- [mips_fp + 0x60]
>         7  setreg mips_a1 <- R34 clobbers: r
>         8  setregimm mips_a2 <- clobbers: r
>         9  setregimm mips_a3 <- clobbers: r
>         10 loadi4_membase R35 <- [mips_fp + 0x90]
>         11 store_membase_reg [mips_sp + 0x10] <- R35
>         12 store_membase_imm [mips_sp + 0x14] <-
>         13 loadi4_membase R37 <- [mips_fp + 0x90]
>         14 compare_imm R37
>         15 ceq R36 <-
>         16 store_membase_reg [mips_sp + 0x18] <- R36
>         17 move R38 <- mips_s5
>         18 setreg mips_v0 <- R38 clobbers: r
>         19 checkthis R38
>         20 voidcall clobbers: c
>         21 store_membase_reg [mips_fp + 0x58] <- mips_s5
>         22 br
> 
> 
> 




More information about the Mono-devel-list mailing list