-
Notifications
You must be signed in to change notification settings - Fork 2
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
Get Arguments Directly From Pointers #17
Conversation
const outArgs = outArgsDetail.map((d) => initArgument(d.type)); | ||
|
||
return outArgs; | ||
return new BigUint64Array(outArgsDetail.map((d) => initArgument(d.type))); |
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.
This isn't quite correct. I think initArgument
should return a pointer to a memory of the size of the interface (if given an interface) and not initialise a new object. Please advise!
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.
I'm not entirely sure about that. If you managed to do it the better way, introduce it in a new PR.
Maybe it's time to review this next? |
Sorry it's taking so long, I'm a bit busy these days. I'll review this by the end of the week. |
Hey! No worries. Take your time, and you don't have to review these ASAP. I just create a PR for every thing I change so the changes don't get lost. Please don't feel pressured to review this and take your time! |
I've rebased the code and removed the |
This PR is significant because it implements passing around arguments in their raw pointer form instead of allocating new ArrayBuffers.
This is done by creating a
BigUint64Array
, passed as an argument to FFI functions (gi_(function|method|callback)_invoke
). The FFI functions directly manipulate and set the pointers as indices of theBigUint64Array
, and we can get the assigned pointers directly from the BigUint64Array. Here's some pseudocode to explain this:Thanks for taking a look at this.
I also created a new file,
examples/bytes.ts
, a temporary file to test things out since deno_gi doesn't have actual tests at the moment (I'm working on it...). You can delete this before merging. Thanks!