Deutsch   English   Français   Italiano  
<vm9ssi$3so92$1@paganini.bofh.team>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feeds.phibee-telecom.net!3.eu.feeder.erje.net!feeder.erje.net!usenet.goja.nl.eu.org!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
From: antispam@fricas.org (Waldek Hebisch)
Newsgroups: comp.arch
Subject: Re: Calling conventions (particularly 32-bit ARM)
Date: Thu, 16 Jan 2025 03:02:44 -0000 (UTC)
Organization: To protect and to server
Message-ID: <vm9ssi$3so92$1@paganini.bofh.team>
References: <vlgngv$1ks4a$1@dont-email.me> <4903307dfcce354508c9fc016a4c1ea1@www.novabbs.org> <vli2gu$1aftg$1@paganini.bofh.team> <vm17ka$1d58r$1@dont-email.me> <vm1pp4$31m2n$1@paganini.bofh.team> <vm67ic$2fnmd$1@dont-email.me> <vm69pj$2h7bt$1@dont-email.me> <20250114234819.000012ac@yahoo.com> <c7d39917db81f33fd90a8b57e7d0f85d@www.novabbs.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 16 Jan 2025 03:02:44 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="4088098"; posting-host="WwiNTD3IIceGeoS5hCc4+A.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A";
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
X-Notice: Filtered by postfilter v. 0.9.3
Bytes: 3810
Lines: 62

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