[M3devel] stdcall naming discrepancy?

Tony Hosking hosking at cs.purdue.edu
Mon Feb 4 22:59:00 CET 2008


I just checked in a fix that initializes void_list_node.  I think  
this may be the fix you need for stdargs.  As far as I know,  
void_list_node is used to mark the end of non-varargs parameter lists.

On Feb 4, 2008, at 4:28 PM, Jay wrote:

> understood, did the attachment not come through?
> attached again
> (parse.c changes aren't really relevant here anyway, not for the *c  
> files, but for the *s files)
>
>  - Jay
>
>
>
> > CC: m3devel at elegosoft.com
> > From: hosking at cs.purdue.edu
> > Subject: Re: stdcall naming discrepancy?
> > Date: Mon, 4 Feb 2008 16:19:38 -0500
> > To: jayk123 at hotmail.com
> >
> > Jay,
> >
> > I'm not on Windows so I can't diagnose the stdcall problem. I want
> > to see the .mc file so I can get a sense of what is going on.
> >
> > On Feb 4, 2008, at 4:01 PM, Jay wrote:
> >
> > > This is without your most recent changes.
> > >
> > >
> > >
> > >
> > > > CC: m3devel at elegosoft.com
> > > > From: hosking at cs.purdue.edu
> > > > Subject: Re: stdcall naming discrepancy?
> > > > Date: Mon, 4 Feb 2008 15:30:23 -0500
> > > > To: jayk123 at hotmail.com
> > > >
> > > > OK. Not sure I understand what is going on then -- I would  
> like to
> > > > see the .mc file to get a sense of things.
> > > >
> > > > On Feb 4, 2008, at 2:43 PM, Jay wrote:
> > > >
> > > > > I think they are being passed correctly, by value.  
> pop_struct and
> > > > > not pop_param is used.
> > > > > 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.
> > > > > Then I'll see if I can hack something up to test the rest.
> > > > >
> > > > > - Jay
> > > > >
> > > > >
> > > > >
> > > > > > CC: m3devel at elegosoft.com
> > > > > > From: hosking at cs.purdue.edu
> > > > > > Subject: Re: stdcall naming discrepancy?
> > > > > > Date: Mon, 4 Feb 2008 09:52:31 -0500
> > > > > > To: jayk123 at hotmail.com
> > > > > >
> > > > > > Any chance that standard_structs in Target.i3 is causing the
> > > front-
> > > > > > end to pass structs by reference (standard structs=TRUE)?  
> Also,
> > > > > > looking at pop_struct in parse.c it seems to want to pass
> > > them by
> > > > > > reference (standard_structs=FALSE)? In any case, what  
> does the
> > > > > > integrated back-end do with pop_struct? I bet it is  
> passing by
> > > > > > value... whereas parse.c passes by ref. Blurgh! Looks  
> like we
> > > need
> > > > > > to smarten things up for calls to non-M3 stdcall procedures.
> > > > > >
> > > > > > On Feb 4, 2008, at 1:23 AM, Jay wrote:
> > > > > >
> > > > > > > (and codegen..)
> > > > > > >
> > > > > > > C:\dev2\j\m3\t>type t.c
> > > > > > >
> > > > > > > typedef struct {
> > > > > > > int a,b,c,d,e,f;
> > > > > > > } Foo_t;
> > > > > > >
> > > > > > > void __stdcall Sleep(Foo_t foo);
> > > > > > >
> > > > > > > extern Foo_t a;
> > > > > > >
> > > > > > > void F1()
> > > > > > > {
> > > > > > > Sleep(a);
> > > > > > > }
> > > > > > >
> > > > > > > C:\dev2\j\m3\t>gcc -c -S t.c
> > > > > > >
> > > > > > > C:\dev2\j\m3\t>type t.s
> > > > > > > .file "t.c"
> > > > > > > .text
> > > > > > > .globl _F1
> > > > > > > .def _F1; .scl 2; .type 32; .endef
> > > > > > > _F1:
> > > > > > > pushl %ebp
> > > > > > > movl %esp, %ebp
> > > > > > > subl $24, %esp
> > > > > > > movl _a, %eax
> > > > > > > movl %eax, (%esp)
> > > > > > > movl _a+4, %eax
> > > > > > > movl %eax, 4(%esp)
> > > > > > > movl _a+8, %eax
> > > > > > > movl %eax, 8(%esp)
> > > > > > > movl _a+12, %eax
> > > > > > > movl %eax, 12(%esp)
> > > > > > > movl _a+16, %eax
> > > > > > > movl %eax, 16(%esp)
> > > > > > > movl _a+20, %eax
> > > > > > > movl %eax, 20(%esp)
> > > > > > > call _Sleep at 24
> > > > > > > subl $24, %esp
> > > > > > > leave
> > > > > > > ret
> > > > > > > C:\dev2\j\m3\t>
> > > > > > >
> > > > > > > (NOTE: This is NOT the correct declaration of Sleep,  
> but ok
> > > for
> > > > > > > testing purposes.)
> > > > > > >
> > > > > > > C:\dev2\j\m3\t>type t.i3
> > > > > > > INTERFACE T;
> > > > > > >
> > > > > > > TYPE Foo_t = RECORD
> > > > > > > a,b,c,d,e,f : INTEGER;
> > > > > > > END;
> > > > > > >
> > > > > > > <*EXTERNAL Sleep:WINAPI*>
> > > > > > > PROCEDURE Sleep (dwMilliseconds1: Foo_t);
> > > > > > > END T.
> > > > > > >
> > > > > > > C:\dev2\j\m3\t>type t.m3
> > > > > > >
> > > > > > > MODULE T;
> > > > > > > VAR
> > > > > > > Foo: Foo_t;
> > > > > > >
> > > > > > > BEGIN
> > > > > > > Sleep(Foo);
> > > > > > > END T.
> > > > > > >
> > > > > > >
> > > > > > > LM1:
> > > > > > > movl 8(%ebp), %eax
> > > > > > > xorl $1, %eax
> > > > > > > testb %al, %al
> > > > > > > jne L2
> > > > > > > .stabn 68,0,6,LM2-_T_M3
> > > > > > > LM2:
> > > > > > > movl $_MM_T+52, %eax
> > > > > > > movl %eax, %edx
> > > > > > > subl $8, %esp
> > > > > > > subl $24, %esp
> > > > > > > movl %esp, %eax
> > > > > > > movl %eax, %edi
> > > > > > > movl %edx, %esi
> > > > > > > cld
> > > > > > > movl $6, %eax
> > > > > > > movl %eax, %ecx
> > > > > > > rep
> > > > > > > movsl
> > > > > > > call _Sleep at 4
> > > > > > > addl $8, %esp
> > > > > > > L2:
> > > > > > > movl $_MM_T, %eax
> > > > > > > LBE2:
> > > > > > > leal -8(%ebp), %esp
> > > > > > > popl %esi
> > > > > > > popl %edi
> > > > > > > leave
> > > > > > > ret
> > > > > > >
> > > > > > > ?
> > > > > > >
> > > > > > > - Jay
> > > > > > >
> > > > > > > Connect and share in new ways with Windows Live. Get it  
> now!
> > > > > >
> > > > >
> > > > >
> > > > > Climb to the top of the charts! Play the word scramble  
> challenge
> > > > > with star power. Play now!
> > > >
> > >
> > >
> > > Connect and share in new ways with Windows Live. Get it now!
> > > <t.tar.bz2>
> >
>
>
> Helping your favorite cause is as easy as instant messaging. You  
> IM, we give. Learn more.<t.tar.bz2>




More information about the M3devel mailing list