Deutsch   English   Français   Italiano  
<uh8jpj1qarqbauqdv3lk4foikocgbv7fq9@4ax.com>

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

Path: ...!weretis.net!feeder9.news.weretis.net!news.nk.ca!rocksolid2!i2pn2.org!.POSTED!not-for-mail
From: George Neuner <gneuner2@comcast.net>
Newsgroups: comp.arch
Subject: Re: Calling conventions (particularly 32-bit ARM)
Date: Tue, 28 Jan 2025 22:53:00 -0500
Organization: i2pn2 (i2pn.org)
Message-ID: <uh8jpj1qarqbauqdv3lk4foikocgbv7fq9@4ax.com>
References: <vlgngv$1ks4a$1@dont-email.me> <4903307dfcce354508c9fc016a4c1ea1@www.novabbs.org> <ve4rnjpipquiugm3j1831m0a7v0va4lu03@4ax.com> <86lduv3frs.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: i2pn2.org;
	logging-data="1644026"; mail-complaints-to="usenet@i2pn2.org";
	posting-account="h5eMH71iFfocGZucc+SnA0y5I+72/ecoTCcIjMd3Uww";
User-Agent: ForteAgent/8.00.32.1272
X-Spam-Checker-Version: SpamAssassin 4.0.0
Bytes: 3298
Lines: 48

On Mon, 27 Jan 2025 17:09:59 -0800, Tim Rentsch
<tr.17687@z991.linuxsc.com> wrote:

>George Neuner <gneuner2@comcast.net> writes:
>
>> On Mon, 6 Jan 2025 20:10:13 +0000, mitchalsup@aol.com (MitchAlsup1)
>> wrote:
>>
>>> I looked high and low for codes using more than 8 arguments and
>>> returning aggregates larger than 8 double words, and about the
>>> only things I found were a handful of []print[]() calls.
>>
>> Large numbers of parameters may be generated either by closure
>> conversion or by lambda lifting.  These are FP language
>> transformations that are analogous to, but potentially more complex
>> than, the rewriting of object methods and their call sites to pass the
>> current object in an OO language.
>>
>> [The difference between closure conversion and lambda lifting is the
>> scope of the tranformation:  conversion limits code transformations to
>> within the defining call chain, whereas lifting pulls the closure to
>> top level making it (at least potentially) globally available.]
>>
>> In either case the original function is rewritten such that non-local
>> variables can be passed as parameters.  The function's code must be
>> altered to access the non-locals - either directly as explicit
>> individual parameters, or by indexing from a pointer to an environment
>> data structure.
>>
>> While in a simple case this could look exactly like the OO method
>> transformation, recall that a general closure may require access to
>> non-local variables spread through multiple environments.  Even if
>> whole environments are passed via single pointers, there still may
>> need to be multiple parameters added.
>
>Isn't it the case that access to all of the enclosing environments
>can be provided by passing a single pointer?  I'm pretty sure it
>is.

Certainly, if the enclosing environments somehow are chained together.
In real code though, in many instances such a chain will not already
exist when the closure is constructed.  The compiler would have to
install pointers to the needed environments (or, alternatively,
pointers directly to the needed values) into the new closure's
immediate environment.  
[essentially this creates a private "display" for the closure.]

Completely doable: it is simply that, if there are enough registers,
passing the pointers as parameters will tend to be more performant.