-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
fix(ext/ffi): trampoline for fast calls #15139
Conversation
#[test] | ||
fn test_gen_trampoline() { | ||
assert_eq!( | ||
codegen(vec![], NativeType::Void), |
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.
Nice! I like seeing tests with this.
Oh yeah, regarding the u8 / u16 / i8 / i16 support, @phosra had a good note about return values: |
This comment was marked as resolved.
This comment was marked as resolved.
0-ary C functions were already supported. eg. Here're a few lines from benchmarks I ran on a PR of mine which changes nothing related to normal FFI calls:
This just changes how those calls are called: Currently they're given an extra parameter that they do not expect but luckily also do not care about. |
This comment was marked as resolved.
This comment was marked as resolved.
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.
It would be very nice to have ext/ffi/README updated with an summary of how this works.
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.
Please add an explanation of the process to ext/ffi/README
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.
Why the third_party changes if windows is not supported?
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 - nice work Divy
TODO: remove tcc and directly write asm instead.
Pointed out by @aapoalas #15125 introduced a bug in FFI calls. The first parameter of a fast function must be a V8Value receiver. This patch implements a fix by patching symbol calls to ignore the receiver.