Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for __vectorcall calling convention #500

Open
lisachenko opened this issue Jul 10, 2019 · 10 comments
Open

Support for __vectorcall calling convention #500

lisachenko opened this issue Jul 10, 2019 · 10 comments
Labels
RFE Request For Enhancement x86

Comments

@lisachenko
Copy link

System Details

Windows x64, testing FFI with PHP7.4.0 alpha2-nts

Problems Description

I'm trying to import a function with FFI, but when I use DLL Export Viewer I can see that function name suffixed with double @@ and following number like some_func@@16 which is used for __vectorcall calling convention.
I am not sure why I couldn't import this function with FFI from x64 library, because all markers should be ignored for x64 platform as far as I know.

Is libffi supports importing of such functions or not?

@lisachenko
Copy link
Author

@weltling Could you please have a look at this?

@bharat-es
Copy link

@lisachenko Please let me know is it related to verifying the functionality of FFI for PHP7.4.0.
If so can you explain in detail how you are trying to import the function so that we can analyze further (Assuming you have installed PHP7.4.0 on Windows).

As we know that to enable the FFI extension, PHP has to be configured with --with-ffi.
For windows need to include php_ffi.dll into php.ini to enable the FFI extension.

@bharat-es
Copy link

@lisachenko As we go through the latest libffi sources, unable to find an abi related to vectorcall convention.

@lisachenko
Copy link
Author

@lisachenko As we go through the latest libffi sources, unable to find an abi related to vectorcall convention.

Yes, so support of __vectorcall should be added in libffi to handle this calling convention

@LifeIsStrange
Copy link

I believe php has a fork of libffi with basic support for vectorcall
http://git.php.net/?p=php-src.git;a=commit;h=bedbecf56d94353a2bcebc835d14896fd95ce6d7

See this thread:
https://bugs.php.net/bug.php?id=78270https://github.com/php/php-src/commit/3b6cd5fe4ce81d3d219887339f3915140214708c

Would be nice to get this upstreamed, it's fairly important

@weltling
Copy link

weltling commented Aug 9, 2020

@cmb69 for upstreaming :)

@cmb69
Copy link

cmb69 commented Aug 9, 2020

Thanks for the ping, @weltling!

Even "basic support" is somewhat exaggerated; see the commit message for some details. The problem is that float/double would need to be supported for the general case in libffi (such parameters are not used by PHP APIs, so the minimal patch for PHP is okay-ish), what is not trivial (contrary to the existing fake implementation).

@LifeIsStrange
Copy link

LifeIsStrange commented Oct 22, 2021

@cmb69 CPython use libffi and supports vectorcall by default https://www.python.org/dev/peps/pep-0590/
I wonder if they have forked libffi to achieve this?
@gvanrossum
@encukou

@encukou
Copy link

encukou commented Oct 22, 2021

CPython's vectorcall is something completely different from Windows' __vectorcall.

@LifeIsStrange
Copy link

oh OK my bad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFE Request For Enhancement x86
Projects
None yet
Development

No branches or pull requests

7 participants