Sujet : Re: Calling conventions (particularly 32-bit ARM)
De : gneuner2 (at) *nospam* comcast.net (George Neuner)
Groupes : comp.archDate : 07. Jan 2025, 22:52:27
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <ve4rnjpipquiugm3j1831m0a7v0va4lu03@4ax.com>
References : 1 2
User-Agent : ForteAgent/8.00.32.1272
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.
Where exactly the line is drawn between passing individual variables
from an enviroment vs passing the whole enviroment is a heuristic that
is tied to the CPU's argument passing convention.
YMMV.