-
Notifications
You must be signed in to change notification settings - Fork 326
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
Add cppgc
bindings
#1336
Add cppgc
bindings
#1336
Conversation
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.
Will need a layer ontop in deno_core
to make more rust idiomatic I think. Looking good
First of all, this is awesome! I wonder if we should keep this interface low-level for now. There's a few https://manishearth.github.io/blog/2021/04/05/a-tour-of-safe-tracing-gc-designs-in-rust/ I think the ideal level of interface here might be the ability to create a What we'd then do is build a library (maybe in the deno_core project?) to offer a |
/// Can be called multiple times when paired with `ShutdownProcess()`. | ||
pub fn initalize_process(platform: SharedRef<Platform>) { | ||
unsafe { | ||
cppgc__initialize_process(&*platform as *const Platform as *mut _); |
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.
nitpick: &mut *platform as *mut Platform
perhaps? Or does SharedRef
possibly have an as_ptr
or as_mut_ptr
API?
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.
SharedRef does not deref as mutable. This is a common pattern for passing pointers where Rust owernship does not matter:
Line 188 in 12dca0c
v8__V8__InitializePlatform(&*platform as *const Platform as *mut _) |
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.
Unrelated to this PR, but we should probably have as_ptr
and as_mut_ptr
convenience methods on SharedRef to avoid the need to deref/ref and cast to pointer.
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!
https://v8.dev/blog/high-performance-cpp-gc
Oilpan in Deno design doc: https://www.notion.so/denolandinc/Oilpan-cppgc-in-Deno-e194f4268e9f4135ba97610ff7d3a949?pvs=4
Oilpan can be used to implement GC'able resources in Deno
Closes #933