[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> </DIV>
<DIV><SPAN class=3D269093717-18102002><FONT face=3D"Courier New"=20
size=3D2> =20
/*<BR> * Handle the =
return value=20
storage area.<BR> =20
*/<BR> x86_lea_membase (p, =
X86_EAX,=20
X86_EBP, stackval_pos);<BR> =20
x86_mov_membase_reg (p, X86_EBP, (MINV_POS + G_STRUCT_OFFSET =
(MonoInvocation,=20
retval)), X86_EAX, 4);<BR> if =
(sig->ret->type =3D=3D MONO_TYPE_VALUETYPE && =
!sig->ret->byref)=20
{<BR> &=
nbsp; =20
MonoClass *klass =3D=20
sig->ret->data.klass;<BR>  =
; =20
if (!klass->enumtype)=20
{<BR> &=
nbsp; =
<FONT color=3D#0000ff>x86_mov_reg_membase (p, X86_ECX, X86_EBP, 8,=20
4);<BR>  =
;  =
;=20
x86_mov_membase_reg (p, X86_EBP, stackval_pos, X86_ECX,=20
4);<BR></FONT> &nbs=
p; =20
}<BR> =
}<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--