Sujet : Re: Calling conventions (particularly 32-bit ARM)
De : antispam (at) *nospam* fricas.org (Waldek Hebisch)
Groupes : comp.archDate : 16. Jan 2025, 04:02:44
Autres entêtes
Organisation : To protect and to server
Message-ID : <vm9ssi$3so92$1@paganini.bofh.team>
References : 1 2 3 4 5 6 7 8 9
User-Agent : tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
MitchAlsup1 <
mitchalsup@aol.com> wrote:
On Tue, 14 Jan 2025 21:48:19 +0000, Michael S wrote:
On Tue, 14 Jan 2025 19:18:27 +0100
Terje Mathisen <terje.mathisen@tmsw.no> wrote:
>
Stephen Fuld wrote:
On 1/12/2025 5:20 PM, Waldek Hebisch wrote:
You are implicitely assuming that passing large number of
arguments is expensive.
>
I guess. I am actually assuming that passing arguments in memory
is more expensive than passing them in registers. I don't think
that is controversial.
>
Usually true, except for recursive functions where you have to store
most stuff on the stack anyway, so going directly there can sometimes
generate more compact code.
>
Terje
>
>
I would think that for Fortran (==everything passed by reference)
memory would beat registers most of the time.
One still needs to pass _values_ of addresses. Doing it in
registers (assuming that enough are available) is likely to
be more efficient than storing addresses in memory and
re-fetching them later. _Relatively_ difference between
passing in registers and passing in memory is smaller, as
there are memory references to access arguments, but registers
are likely to be a plus (unless there is excessive spiling and
called routine needs to write addreses to memory and load
them later).
Pass by COMMON block was even faster.
I do not think so. I LAPACK-like cases there are array arguments.
Normal calling convention needs to store and later read parameters
and pass addresses. COMMON would force copying of entire arrays,
much less efficienct than handling parameters.
In complicated program there could be many COMMON blocks, leading
to worse locality than stack use (not relevant for cacheless
machine and one with very bing caches, but could make a difference
for machines with small caches).
It would require replacement of natural by-reference "pointer in
register points to value in memory" calling sequence to something like
copy-in/copy-out, right?
No, Fortran will pass dope vectors to called subroutines. The
called subroutine needs to understand the dope vector.
I would not say this. AFAIK in Fortran 77 caller passes enough
information so that called routine can construct its own dope
vector (if desired). IIUC that is very similar to VMT-s in C99.
I think PL/I, Ada, Extended Pascal and probably Fortran 90 use
dope vectors.
-- Waldek Hebisch