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(ext/ffi): Remove Deno.UnsafePointer
indirection
#14915
Conversation
} else { | ||
throw new TypeError(`Invalid FFI argument type '${type}'`); | ||
static of(value) { | ||
if (ObjectPrototypeIsPrototypeOf(UnsafeCallbackPrototype, value)) { |
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.
Supporting UnsafeCallbacks for UnsafePointer.of
seems unnecessary.
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.
We will get rid of the UnsafePointer class completely. I was thinking that we could turn this into a more common interface until it's removed.
LGTM. Did you check performance improvement? |
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, please update the manual before landing the PR
Oh yeah, one thing to note publicly in the PR on this implementation is that after this there will be no difference in typing for:
So, a lot of the possible benefits of types are lost, unfortunately. |
yeah, I think the most notable will be for callbacks. 64bit numeric types + pointers are bigint in JS. |
This commits removes the
Deno.UnsafePointer
wrapper around FFI pointers. A pointer is now
represented as a bigint primitive.
There still exist the
Deno.UnsafePointer.of
API to get pointer value for a TypedArray and
Deno.UnsafeCallback
.This commit also removes the extra processing for
FFI parameters. Hence,
Deno.UnsafeCallback
must bepassed as a pointer.