Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ctypes: unify the foreign-call path on a single host_env
call()API #8235New 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
Uh oh!
There was an error while loading. Please reload this page.
ctypes: unify the foreign-call path on a single host_env
call()API #8235Changes from 1 commit
1c5b1132802682b5c8870c49d46588eb7849ccb21640d63d74681347File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
callforeign-call APIAdd a libffi-hiding foreign-call entry point that takes ctypes type codes and recursive layouts plus raw buffers instead of libffi `Type`/`Arg`, to become the single call path for the VM `_ctypes` (a later change) and other consumers. Also bring in the `callproc_simple` helper so this host_env copy stays byte-identical to the pyre-dev copy during the migration. - `CTypeLayout` (Simple/Pointer/Struct/Union/Array/Opaque) with `size()` and an internal libffi-type lowering built on `ffi_type_for_layout`. - `CallArg` (Typed/Int/Double/Pointer/Aggregate), `CallRet` (Void/Code/Pointer/Aggregate), `CallOptions` (use_errno/use_last_error), `CallValue` (Void/Scalar/Pointer/Aggregate), and `CallError`. - `call(addr, &[CallArg], CallRet, CallOptions) -> Result<CallValue, CallError>`, built on the existing `Cif`/`ffi_*` primitives: the errno / last-error swap wraps only the raw call, and by-value aggregate arguments and returns go through `Cif::call_return_into`. - 16 ABI unit tests over local `extern "C"` functions: scalar parity, by-value struct / nested / array-in-struct / {f32,f32} / large-struct arguments, small / odd / large struct returns, union size, the errno window, and the null-pointer / unknown-code / short-buffer errors. `callproc` and `callproc_simple` are left in place; both are removed once the migration onto `call` completes. Assisted-by: ClaudeUh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
Uh oh!
There was an error while loading. Please reload this page.