On 9.3.18 20:16, Dennis Lee Bieber wrote:
> On Fri, 09 Mar 2018 17:16:19 +0100, David Brown
> declaimed the following:
>
>> On 09/03/18 15:13, bartc wrote:
>
>>>
>>> I guess simplicity of the call convention wasn't a priority.
>>>
>>
>> Well no, of course it was not a priority. Why should it be? Virtually
>> no one is interested in the calling conventions - just compiler writers,
>> people writing OS context switch routines, and the few dozen people
>> writing assembly routines instead of using higher level languages.
>> Efficiency of generated code was far and away the priority when AMD made
>> the System V AMD64 ABI used by everyone except Windows. $DEITY only
>> knows what MS's priorities were when they scrambled it and made
>> something pointlessly different and less efficient - the only think I
>> can think of was to make implementation of "printf" a little easier for
>> the MSVC compiler writers.
>
>
>
> There is always the convention used by Xerox Sigma Fortran-IV.
> Non-recursive, non-stack...
>
> Arguments were passed by putting them immediately after the CALL
> (branch and link opcode, and referenced by return address (saved in a
> register; I think 15 was the standard) + index. Code was responsible for
> incrementing the return address to jump over the arguments. {I don't have
> my 40 year old manuals handy, so pseudo-ops...}
>
> ...
> stw,9 arg2
> bl,15 mysub
> data arg1 ;normally this would save the address of arg1
> arg2 data 0 ;reserved space for storing a "pass by value"
>
>
>
> ...
>
> mysub lw,9 *15 ;indirect, load arg1 address into 9
> inc,15
> lw,10 *15 ;indirect, load arg2 value into 10
> inc,15
> stw,15 retadd
> ....
> lw,15 retadd
> ret
> retadd data 0 ;space to save return address
>
> Of course, the pass-by-value semantics would fail for any system that
> makes code-space read-only; pass-by-address is a compile time definition.
>
>
That was the classicl method in the minicomputer era.
--
-TV
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|