Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Moving VAX into 21 century :-)



Den 2019-09-01 kl. 13:31, skrev Johnny Billquist:
On 2019-09-01 13:28, Johnny Billquist wrote:
On 2019-09-01 13:22, Johnny Billquist wrote:
On 2019-09-01 09:14, Anders Magnusson wrote:
Den 2019-08-31 kl. 17:58, skrev Johnny Billquist:
On 2019-08-31 16:19, Anders Magnusson wrote:
Saving/restoring regs take the same time whether or not CALLS is used, so I removed that from the calculation.

AP is never needed, and FP only if VLAs are used (or alloca called).

You mean it is not used? So then the compiler is constantly computing the offsets from SP? Well, I guess you could definitely do this, but it's a lot messier.
Well, no. Since SP/FP/AP have the same values during the whole function execution (modulo VLAs etc...) it's just a matter of which offset is used.

How can that be?
If I do a

void foo(int x)
{
   char foo[x];
}

the compiler have no clue about how much stack it will need.

And before anyone starts screaming that you cannot do this, since the size have to be a constant known at compile time, this was changed to be allowed in C11.

Sorry, have to correct myself.
Variable length arrays was introduced as mandatory in C99. C11 moved them into optional.

D'oh! And only then did I notice your comment about VLA. But since they do exist, you cannot use SP to refer to arguments...
But sorry for making three comments where one should have sufficed.
:-)
For functions using VLAs (or alloca(), which is not a part of C but may be used anyway) FP is of course used, but it only affects those functions.

-- R




Home | Main Index | Thread Index | Old Index