-
Notifications
You must be signed in to change notification settings - Fork 66
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
feat(ops): Basic buffer support for op2 #33
Conversation
thought: It's possible for V8 ArrayBuffers to be created from external pointers that do not follow the normal alignment rule of V8 ABs (code says always aligned to 4 bytes, experience seems to suggest this is 8 bytes for 64 bit environments). In these cases the TypedArrays will then happily allow for themselves to be created at odd offsets. This needs to be remembered when eg. a |
Definitely -- this is automatic in the fast path, but we should throw alignment errors if this happens in the slow path as well. Right now the existing f32/f64/u32/etc ops probably "work" on x64 and will segfault on ARM64. |
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
Adds:
#[buffer] &[u8]
#[buffer] &mut [u8]
TODO:
#[buffer] *const u8
(all primitive types) -- not recommended but used in FFI#[buffer] *mut u8
(all primitive types)#[buffer] bytes::Bytes
#[buffer] JSBuffer
#[buffer] V8Slice
#[buffer] Vec<..>
#[buffer] Box<[..]>
TODO: Alternative buffer modes:
#[buffer(shared)]
(the default)#[buffer(copy)]
#[buffer(detach)]