Skip to content

Commit ef4915f

Browse files
watilderichardlau
authored andcommitted
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 <daijiro.wachi@gmail.com> PR-URL: #63960 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
1 parent 518309c commit ef4915f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

doc/api/ffi.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,13 @@ raw pointer `bigint` values. For pointer-like parameters, `null`, `undefined`,
125125
strings, `Buffer`, typed array, `DataView`, and `ArrayBuffer` values are
126126
converted on the JavaScript side before calling the optimized native wrapper.
127127

128-
Optimized Fast FFI calls support at most 8 function arguments. Functions with
129-
more than 7 arguments use the generic FFI call path instead.
128+
Optimized Fast FFI calls support at most 8 function arguments, but the exact
129+
limit depends on the architecture and on the argument types, because each
130+
argument must fit in the registers used by the platform trampoline. Integer
131+
and pointer arguments are limited to 7 on AArch64 and to 6 on x86-64, while
132+
floating-point arguments can use up to 8 on both. Functions that exceed these
133+
limits, including any function with more than 8 arguments, use the generic FFI
134+
call path instead.
130135

131136
## Signature objects
132137

0 commit comments

Comments
 (0)