[Mono-list] Problem with mono_arch_local_regalloc( )
Piyush Garyali
Piyush Garyali" <piyush_garyali@rediffmail.com
13 Nov 2003 15:03:48 -0000
This is a multipart mime message
--Next_1068735828---0-203.199.83.37-9941
Content-type: text/html;
charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
<P>=0AHello, <BR>=0A<BR>=0AI found that the runtime was generating the foll=
owing runtime invoke code for Assembly.DoAssemblyLoad:<BR>=0A<BR>=0ARUNTIME=
CODE FOR (wrapper runtime-invoke) System.AppDomain:DoAssemblyLoad (object,=
intptr,intptr)<BR>=0A IL_0000: ldarg.2 <BR>=0A IL_0001: brfalse.s IL=
_0006<BR>=0A IL_0003: ldarg.2 <BR>=0A IL_0004: ldnull <=
BR>=0A IL_0005: stind.i <BR>=0A IL_0006: ldarg.0 <BR>=0A IL_0=
007: ldarg.1 <BR>=0A IL_0008: ldind.i <BR>=0A IL_0009: ldftn&=
nbsp; 0x00000001<BR>=0A IL_000f: calli 0x00000002<BR>=
=0A IL_0014: ldnull <BR>=0A IL_0015: stloc.0 <BR>=0A IL=
_0016: leave IL_002b<BR>=0A IL_001b: pop =
<BR>=0A IL_001c: ldarg.2 <BR>=0A IL_001d: ldc.i4.0 <BR>=0A IL=
_001e: cgt.un <BR>=0A IL_0020: endfilter <BR>=0A IL_0022: stlo=
c.1 <BR>=0A IL_0023: ldarg.2 <BR>=0A IL_0024: ldloc.1 =
<BR>=0A IL_0025: stind.i <BR>=0A IL_0026: leave IL_002=
b<BR>=0A IL_002b: ldloc.0 <BR>=0A IL_002c: ret<BR>=0A<BR>=0ANow whil=
e this code is being compiled using mini_method_compile()-->mono_codegen=
()-->mono_arch_local_regalloc() something different is looked in the cpu=
-g4.h array instead of the code above:<BR>=0A<BR>=0A372: load_membase<BR>=
=0A312: compare_imm<BR>=0A59 : beq<BR>=0A372: load_membase<BR>=0A360: store=
_membase_imm<BR>=0A372: load_membase<BR>=0A361: store_membase_reg<BR>=0A372=
: load_membase<BR>=0A372: load_membase<BR>=0A361: store_membase_reg<BR>=0A3=
27: setregimm<BR>=0A40 : call<BR>=0A361: store_membase_reg<BR>=0A372: load_=
membase<BR>=0A326: setreg<BR>=0A372: load_membase<BR>=0A332: voidcall_reg<B=
R>=0A360: store_membase_reg<BR>=0A56 : br<BR>=0A551: start_handler<BR>=0A<B=
R>=0ANow in the "cpu-g4.h" the value assigned for "start_han=
dler" is "NULL" which make the following code inside mono_ar=
ch_local_regalloc() ..<BR>=0A<BR>=0A<snip><BR>=0A..<BR>=0A &nbs=
p; while(ins) {<BR>=0A spec =
=3D ins_spec[ins->opcode];<BR>=0A  =
;..<BR>=0A if (spec[MONO_INST_SRC1])=
{ <BR>=0A ..<BR>=
=0A }<BR>=0A</snip><BR>=0A &nbs=
p; <BR>=0A.. to crash as spec becomes NULL and the if statemen=
t tries to access a null pointer. What I am surprised to find is that for t=
he RUNTIME INVOKE code for DoAssemblyLoad the instrcutions looked into the =
ins_spec[] array and completely different.<BR>=0A<BR>=0AIs there anything I=
am missing in here ???<BR>=0A<BR>=0Aregards,<BR>=0Apg=0A</P>=0A<br><br>=0A=
<A target=3D"_blank" HREF=3D"http://clients.rediff.com/signature/track_sig.=
asp"><IMG SRC=3D"http://ads.rediff.com/RealMedia/ads/adstream_nx.cgi/www.re=
diffmail.com/inbox.htm@Bottom" BORDER=3D0 VSPACE=3D0 HSPACE=3D0 HEIGHT=3D74=
WIDTH=3D496></a>=0A
--Next_1068735828---0-203.199.83.37-9941
Content-type: text/plain;
charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hello, =0A=0AI found that the runtime was generating the following runtime =
invoke code for Assembly.DoAssemblyLoad:=0A=0ARUNTIME CODE FOR (wrapper run=
time-invoke) System.AppDomain:DoAssemblyLoad (object,intptr,intptr)=0A IL_0=
000: ldarg.2 =0A IL_0001: brfalse.s IL_0006=0A IL_0003: ldarg.2 =0A IL_=
0004: ldnull =0A IL_0005: stind.i =0A IL_0006: ldarg.0 =0A IL_0007: =
ldarg.1 =0A IL_0008: ldind.i =0A IL_0009: ldftn 0x00000001=0A IL_00=
0f: calli 0x00000002=0A IL_0014: ldnull =0A IL_0015: stloc.0 =0A I=
L_0016: leave IL_002b=0A IL_001b: pop =0A IL_001c: ldarg.2 =0A =
IL_001d: ldc.i4.0 =0A IL_001e: cgt.un =0A IL_0020: endfilter =0A IL_002=
2: stloc.1 =0A IL_0023: ldarg.2 =0A IL_0024: ldloc.1 =0A IL_0025: sti=
nd.i =0A IL_0026: leave IL_002b=0A IL_002b: ldloc.0 =0A IL_002c: re=
t=0A=0ANow while this code is being compiled using mini_method_compile()-->=
mono_codegen()-->mono_arch_local_regalloc() something different is looked i=
n the cpu-g4.h array instead of the code above:=0A=0A372: load_membase=0A31=
2: compare_imm=0A59 : beq=0A372: load_membase=0A360: store_membase_imm=0A37=
2: load_membase=0A361: store_membase_reg=0A372: load_membase=0A372: load_me=
mbase=0A361: store_membase_reg=0A327: setregimm=0A40 : call=0A361: store_me=
mbase_reg=0A372: load_membase=0A326: setreg=0A372: load_membase=0A332: void=
call_reg=0A360: store_membase_reg=0A56 : br=0A551: start_handler=0A=0ANow i=
n the "cpu-g4.h" the value assigned for "start_handler" is "NULL" which mak=
e the following code inside mono_arch_local_regalloc() ..=0A=0A<snip>=0A..=
=0A while(ins) {=0A spec =3D ins_spec[ins->opcode];=0A ..=0A if (spec[MO=
NO_INST_SRC1]) { =0A ..=0A }=0A</snip>=0A =0A.. to crash as spec becomes =
NULL and the if statement tries to access a null pointer. What I am surpris=
ed to find is that for the RUNTIME INVOKE code for DoAssemblyLoad the instr=
cutions looked into the ins_spec[] array and completely different.=0A=0AIs =
there anything I am missing in here ???=0A=0Aregards,=0Apg
--Next_1068735828---0-203.199.83.37-9941--