From ff707e6f39a27f6091b19ff43901c20589446623 Mon Sep 17 00:00:00 2001 From: Daijiro Wachi Date: Wed, 17 Jun 2026 19:00:16 +0900 Subject: [PATCH] doc: fix Fast FFI argument count in ffi.md The text said functions with more than 7 arguments fall back to the generic call path, contradicting the preceding sentence that Fast FFI calls support up to 8 arguments. The real limit is architecture- and type-dependent: the hard cap is 8 public arguments (src/ffi/fast.cc), but register pressure lowers the effective count to 7 integer/pointer arguments on AArch64 and 6 on x86-64, while floating-point arguments can use up to 8 on both. Describe this instead of the previous, inaccurate single threshold. Signed-off-by: Daijiro Wachi --- doc/api/ffi.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/api/ffi.md b/doc/api/ffi.md index 4deef4accad375..172af6bbc6edee 100644 --- a/doc/api/ffi.md +++ b/doc/api/ffi.md @@ -125,8 +125,13 @@ raw pointer `bigint` values. For pointer-like parameters, `null`, `undefined`, strings, `Buffer`, typed array, `DataView`, and `ArrayBuffer` values are converted on the JavaScript side before calling the optimized native wrapper. -Optimized Fast FFI calls support at most 8 function arguments. Functions with -more than 7 arguments use the generic FFI call path instead. +Optimized Fast FFI calls support at most 8 function arguments, but the exact +limit depends on the architecture and on the argument types, because each +argument must fit in the registers used by the platform trampoline. Integer +and pointer arguments are limited to 7 on AArch64 and to 6 on x86-64, while +floating-point arguments can use up to 8 on both. Functions that exceed these +limits, including any function with more than 8 arguments, use the generic FFI +call path instead. ## Signature objects