[Mono-list] Quick trampoline explanation

Ferguson, Neale Neale.Ferguson@SoftwareAG-USA.com
Fri, 18 Oct 2002 12:38:48 -0400


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C276C4.D5A23440
Content-Type: text/plain;
	charset="iso-8859-1"

In the x86 mono_create_method_pointer routine there is the following section
of code:
 
        /*
         * Handle the return value storage area.
         */
        x86_lea_membase (p, X86_EAX, X86_EBP, stackval_pos);
        x86_mov_membase_reg (p, X86_EBP, (MINV_POS + G_STRUCT_OFFSET
(MonoInvocation, retval)), X86_EAX, 4);
        if (sig->ret->type == MONO_TYPE_VALUETYPE && !sig->ret->byref) {
                MonoClass *klass  = sig->ret->data.klass;
                if (!klass->enumtype) {
                        x86_mov_reg_membase (p, X86_ECX, X86_EBP, 8, 4);
                        x86_mov_membase_reg (p, X86_EBP, stackval_pos,
X86_ECX, 4);
                }
        }

To my undestanding this does:
- Get the address of the return value and set this in the Monoinvocation
structure
- if we are returning a structure (not by reference) and the structure isn't
a simple type then ?? [this is what I need an explanation of]

Neale Ferguson 



------_=_NextPart_001_01C276C4.D5A23440
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">


<META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D269093717-18102002><FONT face=3DArial size=3D2>In =
the x86 <FONT=20
face=3D"Courier New" color=3D#800000>mono_create_method_pointer</FONT> =
routine there=20
is the following section of code:</FONT></SPAN></DIV>
<DIV><SPAN class=3D269093717-18102002><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D269093717-18102002><FONT face=3D"Courier New"=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
/*<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Handle the =
return value=20
storage area.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
*/<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x86_lea_membase (p, =
X86_EAX,=20
X86_EBP, stackval_pos);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
x86_mov_membase_reg (p, X86_EBP, (MINV_POS + G_STRUCT_OFFSET =
(MonoInvocation,=20
retval)), X86_EAX, 4);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if =

(sig-&gt;ret-&gt;type =3D=3D MONO_TYPE_VALUETYPE &amp;&amp; =
!sig-&gt;ret-&gt;byref)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;=20
MonoClass *klass&nbsp; =3D=20
sig-&gt;ret-&gt;data.klass;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
if (!klass-&gt;enumtype)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =

<FONT color=3D#0000ff>x86_mov_reg_membase (p, X86_ECX, X86_EBP, 8,=20
4);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
x86_mov_membase_reg (p, X86_EBP, stackval_pos, X86_ECX,=20
4);<BR></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
}<BR></FONT></SPAN></DIV>
<DIV><SPAN class=3D269093717-18102002><FONT face=3DArial size=3D2>To my =
undestanding=20
this does:</FONT></SPAN></DIV>
<DIV><SPAN class=3D269093717-18102002><FONT face=3DArial size=3D2>- Get =
the address of=20
the return value and set this in the Monoinvocation=20
structure</FONT></SPAN></DIV>
<DIV><SPAN class=3D269093717-18102002><FONT face=3DArial size=3D2>- if =
we are=20
returning a structure (not by reference) and the structure isn't a =
simple type=20
then <FONT color=3D#0000ff>??</FONT> [this is what I need an =
explanation=20
of]</DIV></FONT></SPAN>
<P><FONT face=3D"Monotype Corsiva">Neale Ferguson</FONT> =
<BR></P></BODY></HTML>

------_=_NextPart_001_01C276C4.D5A23440--