[M3devel] a trouble with passing records by value..
Jay K
jay.krell at cornell.edu
Wed Sep 1 06:13:08 CEST 2010
> Date: Tue, 31 Aug 2010 21:24:07 -0500
> From: rodney_bates@
>
> If the writers of an ABI actually *required* that small structs/records be
> passed in registers
Yes, they have. The rules are hard for me to understand. It isn't just based on size.
> then they have made a big blunder.
No they have not. They know what they are doing.
> Thus taking their address must always be possible,
If they have to be in memory, then they will be put in memory, at or before
the address is taken. That doesn't mean the parameters have to be passed in memory.
> 1) Declare that language semantics trump ABI requirements and defy the ABI.
Not necessary.
Granted, we don't have to follow the ABI. The ABI is for interoperability with C.
I'm plenty willing to say you can't pass records by value between C and Modula-3.
> 2) Pass them in registers at the time of control transfer, but store them
> in memory in the prologue, then access them from memory thereafter.
The backend does that as needed for C already.
Data can live in multiple places.
Just that there can be only be one mutable location at a time.
Look at the code generated Tony asked about, add like
printr("%p\n", &t);
you'll see the registers get written to the stack.
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100901/630aeeed/attachment-0002.html>
More information about the M3devel
mailing list