8000 Allow Rust objects to be (safely) traced by the v8 GC · Issue #63 · neon-bindings/neon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow Rust objects to be (safely) traced by the v8 GC #63

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

Closed
DemiMarie opened this issue Apr 6, 2016 · 4 comments
Closed

Allow Rust objects to be (safely) traced by the v8 GC #63

DemiMarie opened this issue Apr 6, 2016 · 4 comments

Comments

@DemiMarie
Copy link

It would be nice for Rust objects to be safely traceable by the v8 GC. This will require syntax extensions to handle the various tracing methods safely.

@dherman
Copy link
Collaborator
dherman commented Apr 21, 2016

@drbo I'm still a bit wobbly on my GC/memory management skills so let me see if I follow:

  • The handles API makes it possible for the stack to safely hold references to JS objects.
  • The class API (implemented in User defined classes #58) makes it possible for JS objects to safely own Rust objects.
  • But we can't currently have JS objects own Rust objects that hold references back to more JS objects.

So is that specifically what this would enable? If we could provide a safe way to implement the trace hooks for a Rust type, then it would be safe for a neon class to own Rust objects of that type.

Do I have that right?

@DemiMarie
Copy link
Author

Yes, that is what I am thinking of. It would probably require a compiler
plugin though.

On Thu, Apr 21, 2016 at 7:34 PM, Dave Herman notifications@github.com
wrote:

@drbo https://github.com/drbo I'm still a bit wobbly on my GC/memory
management skills so let me see if I follow:

  • The handles API makes it possible for the stack to safely hold
    references to JS objects.
  • The class API (implemented in User defined classes #58
    User defined classes #58) makes it possible for JS
    objects to safely own Rust objects.
  • But we can't currently have JS objects own Rust objects that hold
    references back to more JS objects.

So is that specifically what this would enable? If we could provide a safe
way to implement the trace hooks for a Rust type, then it would be safe for
a neon class to own Rust objects of that type.

Do I have that right?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#63 (comment)

@vinipsmaker
Copy link
vinipsmaker commented Aug 8, 2016

Are there plans to let the heap to safely hold references to JS objects (i.e. a a Rust object that "owns" a JS object, prevents a JS object from being GCed, v8::Persistent...)? If this is allowed, then the #26 would be a no-brainer and even more patterns could be implemented.

EDIT: Actually I forgot about the need to use libuv to execute the v8::Function in the proper thread. So Persistent wouldn't be enough =(

@dherman
Copy link
Collaborator
dherman commented Nov 22, 2017

I'd love to see an RFC sketching out the API! I'll open an issue in the RFCs repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0