-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
BREAKING(ffi/unstable): always return u64 as bigint #23981
Conversation
Marked as breaking because of the type definition changes. It should not affect runtime usage since we didn't guarantee |
c385a94
to
378fb44
Compare
378fb44
to
82a76eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Actually, I wonder if we don't have some code on the Fast API path that is now irrelevant? I think we might be setting the Integer64Representation to Number, that should now change to BigInt |
Good catch. Did we ever use Lines 55 to 60 in b21004b
I updated the JS side where the unwrapping happens to always read it as BigInt. |
Hmm, didn't I ever get around to supporting them (u64, i64 return values that is) in FFI? 🤔 They're nowadays supported in Fast API though, so we could get rid of the JS-side unwrapping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, good to see so much code removed.
Built ontop of #23981, this sets FFI turbocalls (Fast Call API) to use the BigInt representation.
The mixed
number | bigint
representation was useful optimization for pointers. Now, pointers are represented as V8 externals. As part of the FFI stabilization effort we want to makebigint
the only representation foru64
andi64
.BigInt representation performance is almost on par with mixed representation with the added benefit that its less confusing and users don't need manual checks and conversions for doing operations on the value.