Update quickjs-ng to 2c620e4 and fix ArrayBuffer for new JS_NewArrayBuffer signature - #723
Update quickjs-ng to 2c620e4 and fix ArrayBuffer for new JS_NewArrayBuffer signature#723richarddd wants to merge 7 commits into
Conversation
Release 0.13.0
Release 0.12.2
21039a0 to
f0ffaf5
Compare
f0ffaf5 to
36033d3
Compare
| let p = | ||
| unsafe { &mut *(ctx.as_ptr() as *mut crate::context::ctx::RefCountHeader) }; | ||
| if p.ref_count <= 1 { | ||
| // Lock was poisoned, this should only happen on a panic. | ||
| // We should still free the context. | ||
| // TODO see if there is a way to recover from a panic which could cause the | ||
| // following assertion to trigger | ||
| #[cfg(feature = "std")] | ||
| assert!(std::thread::panicking()); | ||
| } |
There was a problem hiding this comment.
If there a way to detect lock poisoning or do panic recovery?
There was a problem hiding this comment.
Did we abandon the idea of supporting bellard quickjs?
There was a problem hiding this comment.
https://github.com/richarddd/rquickjs/pull/3/changes
I dont know it seems quite risky as the ABI has diverted quite a bit, not to bad tho.
| if size != 0 { | ||
| return core::ptr::null_mut(); | ||
| } |
There was a problem hiding this comment.
Add a comment to indicate that we only need to support the size 0 case (free command) and that other sizes are not expected since we set max_len to 0 (fixed) in the New function.
| ptr: *mut c_void, | ||
| size: qjs::size_t, | ||
| ) -> *mut c_void { | ||
| if size != 0 { |
| qjs::JS_GetRuntime(ctx.as_ptr()), | ||
| opaque, | ||
| ptr as *mut c_void, | ||
| 0, |
There was a problem hiding this comment.
Add a constant like const FREE: qjs::size_t = 0;
| ptr, | ||
| len as _, | ||
| // fixed-length buffer, not resizable | ||
| 0, |
There was a problem hiding this comment.
Add a constant like const FIXED_SIZE: qjs::size_t = 0;
| } | ||
|
|
||
| #[test] | ||
| fn transfer_to_different_length_preserves_vec_buffer() { |
There was a problem hiding this comment.
In theory we could support the transfer by allocating a new vec if we want.
…ArrayBufferDataFunc
f763aca to
810b2b6
Compare
quickjs-ng added a max_len param to JS_NewArrayBuffer and changed the free callback into a realloc callback, and moved ref_count out of the object body into the allocator header.
Updated both call sites and the callback signatures, regenerated bindings, and dropped the ref_count check in drop_context since that field is no longer readable.
Updated to quickjs-ng 0.16.2 (2c620e4), which includes several bug fixes on top of 0.16.0 with no further API changes.
Supersedes #722.