1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00
denoland-deno/ext/ffi
denobot e1b40a69c0
chore: forward v2.0.6 release commit to main (#26804)
This is the release commit being forwarded back to main for 2.0.6

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-11-10 13:12:18 +05:30
..
00_ffi.js fix(runtime): use more null proto objects again (#25040) 2024-09-06 12:52:59 +02:00
call.rs refactor(runtime/permissions): use concrete error types (#26464) 2024-11-04 09:17:21 -08:00
callback.rs refactor(runtime/permissions): use concrete error types (#26464) 2024-11-04 09:17:21 -08:00
Cargo.toml chore: forward v2.0.6 release commit to main (#26804) 2024-11-10 13:12:18 +05:30
dlfcn.rs refactor(runtime/permissions): use concrete error types (#26464) 2024-11-04 09:17:21 -08:00
ir.rs refactor(ext/ffi): use concrete error types (#26170) 2024-10-14 15:05:49 -07:00
lib.rs refactor(runtime/permissions): use concrete error types (#26464) 2024-11-04 09:17:21 -08:00
README.md chore: move test_ffi and test_nap to tests/ [WIP] (#22394) 2024-02-12 13:46:50 -07:00
repr.rs refactor(runtime/permissions): use concrete error types (#26464) 2024-11-04 09:17:21 -08:00
static.rs refactor(ext/ffi): use concrete error types (#26170) 2024-10-14 15:05:49 -07:00
symbol.rs BREAKING(unstable/ffi): remove callback reentrant flag (#24367) 2024-07-01 09:36:33 +05:30
turbocall.rs feat: upgrade deno_core (#25042) 2024-08-19 14:51:16 +00:00

deno_ffi

This crate implements dynamic library ffi.

Performance

Deno FFI calls have extremely low overhead (~1ns on M1 16GB RAM) and perform on par with native code. Deno leverages V8 fast api calls and JIT compiled bindings to achieve these high speeds.

Deno.dlopen generates an optimized and a fallback path. Optimized paths are triggered when V8 decides to optimize the function, hence call through the Fast API. Fallback paths handle types like function callbacks and implement proper error handling for unexpected types, that is not supported in Fast calls.

Optimized calls enter a JIT compiled function "trampoline" that translates Fast API values directly for symbol calls. JIT compilation itself is super fast, thanks to tinycc. Currently, the optimized path is only supported on Linux and MacOS.

To run benchmarks:

target/release/deno bench --allow-ffi --allow-read --unstable-ffi ./tests/ffi/tests/bench.js