wide function pointer type
Florian Weimer
fweimer@redhat.com
Thu Oct 21 09:48:26 GMT 2021
* Kaz Kylheku:
> On 2021-10-20 02:10, Florian Weimer via Libffi-discuss wrote:
>> Perhaps a set of standard attributes to describe the explicit closure
>> argument would be useful, though.
>
> For what purpose though? If there is some attribute mechanism in the
> syntax, what translation decision does it drive? Or else, what
> diagnostic purpose?
Auto-generation of bindings for languages that have functions with
environments.
> If the compiler knows that some closure argument c is linked with a
> function f, what special treatment can it perform?
It can automatically separate the environment/chain pointer from the
code pointer and pass them in the right arguments. And a thunk can be
create if necessary.
> The annotation mechanism would have to be propagated to all the
> places in the program where the f value can reach; which means
> additional declaration material in multiple places. If a structure
> stores a function pointer and context value, we need to be able
> to relate them in a structure, and so forth.
Environment/chain arguments in structs would only need annotating if
they are publicly exposed on API boundaries. I am not convinced this is
a common occurrence.
With the new function pointer type, all these types have to be
duplicated, to preserve compatibility with older C versions. That seems
rather unlikely.
Thanks,
Florian
More information about the Libffi-discuss
mailing list