<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>I think they are being passed correctly, by value. pop_struct and not pop_param is used.<BR>
When I get time, I will put my parse.c back (uncommited) and then just try some tests with "__cdecl" passing and returning structs. That removes the naming issue and PART of the calling convention issue and tests what is left.<BR>
Then I'll see if I can hack something up to test the rest.<BR>
<BR>
- Jay<BR><BR><BR>
<HR id=stopSpelling>
<BR>
> CC: m3devel@elegosoft.com<BR>> From: hosking@cs.purdue.edu<BR>> Subject: Re: stdcall naming discrepancy?<BR>> Date: Mon, 4 Feb 2008 09:52:31 -0500<BR>> To: jayk123@hotmail.com<BR>> <BR>> Any chance that standard_structs in Target.i3 is causing the front- <BR>> end to pass structs by reference (standard structs=TRUE)? Also, <BR>> looking at pop_struct in parse.c it seems to want to pass them by <BR>> reference (standard_structs=FALSE)? In any case, what does the <BR>> integrated back-end do with pop_struct? I bet it is passing by <BR>> value... whereas parse.c passes by ref. Blurgh! Looks like we need <BR>> to smarten things up for calls to non-M3 stdcall procedures.<BR>> <BR>> On Feb 4, 2008, at 1:23 AM, Jay wrote:<BR>> <BR>> > (and codegen..)<BR>> ><BR>> > C:\dev2\j\m3\t>type t.c<BR>> ><BR>> > typedef struct {<BR>> > int a,b,c,d,e,f;<BR>> > } Foo_t;<BR>> ><BR>> > void __stdcall Sleep(Foo_t foo);<BR>> ><BR>> > extern Foo_t a;<BR>> ><BR>> > void F1()<BR>> > {<BR>> > Sleep(a);<BR>> > }<BR>> ><BR>> > C:\dev2\j\m3\t>gcc -c -S t.c<BR>> ><BR>> > C:\dev2\j\m3\t>type t.s<BR>> > .file "t.c"<BR>> > .text<BR>> > .globl _F1<BR>> > .def _F1; .scl 2; .type 32; .endef<BR>> > _F1:<BR>> > pushl %ebp<BR>> > movl %esp, %ebp<BR>> > subl $24, %esp<BR>> > movl _a, %eax<BR>> > movl %eax, (%esp)<BR>> > movl _a+4, %eax<BR>> > movl %eax, 4(%esp)<BR>> > movl _a+8, %eax<BR>> > movl %eax, 8(%esp)<BR>> > movl _a+12, %eax<BR>> > movl %eax, 12(%esp)<BR>> > movl _a+16, %eax<BR>> > movl %eax, 16(%esp)<BR>> > movl _a+20, %eax<BR>> > movl %eax, 20(%esp)<BR>> > call _Sleep@24<BR>> > subl $24, %esp<BR>> > leave<BR>> > ret<BR>> > C:\dev2\j\m3\t><BR>> ><BR>> > (NOTE: This is NOT the correct declaration of Sleep, but ok for <BR>> > testing purposes.)<BR>> ><BR>> > C:\dev2\j\m3\t>type t.i3<BR>> > INTERFACE T;<BR>> ><BR>> > TYPE Foo_t = RECORD<BR>> > a,b,c,d,e,f : INTEGER;<BR>> > END;<BR>> ><BR>> > <*EXTERNAL Sleep:WINAPI*><BR>> > PROCEDURE Sleep (dwMilliseconds1: Foo_t);<BR>> > END T.<BR>> ><BR>> > C:\dev2\j\m3\t>type t.m3<BR>> ><BR>> > MODULE T;<BR>> > VAR<BR>> > Foo: Foo_t;<BR>> ><BR>> > BEGIN<BR>> > Sleep(Foo);<BR>> > END T.<BR>> ><BR>> ><BR>> > LM1:<BR>> > movl 8(%ebp), %eax<BR>> > xorl $1, %eax<BR>> > testb %al, %al<BR>> > jne L2<BR>> > .stabn 68,0,6,LM2-_T_M3<BR>> > LM2:<BR>> > movl $_MM_T+52, %eax<BR>> > movl %eax, %edx<BR>> > subl $8, %esp<BR>> > subl $24, %esp<BR>> > movl %esp, %eax<BR>> > movl %eax, %edi<BR>> > movl %edx, %esi<BR>> > cld<BR>> > movl $6, %eax<BR>> > movl %eax, %ecx<BR>> > rep<BR>> > movsl<BR>> > call _Sleep@4<BR>> > addl $8, %esp<BR>> > L2:<BR>> > movl $_MM_T, %eax<BR>> > LBE2:<BR>> > leal -8(%ebp), %esp<BR>> > popl %esi<BR>> > popl %edi<BR>> > leave<BR>> > ret<BR>> ><BR>> > ?<BR>> ><BR>> > - Jay<BR>> ><BR>> > Connect and share in new ways with Windows Live. Get it now!<BR>> <BR><BR><br /><hr />Climb to the top of the charts! Play the word scramble challenge with star power. <a href='http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan' target='_new'>Play now!</a></body>
</html>