Skip to content

Update quickjs-ng to 2c620e4 and fix ArrayBuffer for new JS_NewArrayBuffer signature - #723

Open
richarddd wants to merge 10 commits into
DelSkayn:masterfrom
richarddd:sync/quickjs-ng-bump
Open

Update quickjs-ng to 2c620e4 and fix ArrayBuffer for new JS_NewArrayBuffer signature#723
richarddd wants to merge 10 commits into
DelSkayn:masterfrom
richarddd:sync/quickjs-ng-bump

Conversation

@richarddd

@richarddd richarddd commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

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.

@richarddd
richarddd force-pushed the sync/quickjs-ng-bump branch 3 times, most recently from 21039a0 to f0ffaf5 Compare August 9, 2026 04:18
@richarddd
richarddd force-pushed the sync/quickjs-ng-bump branch from f0ffaf5 to 36033d3 Compare August 24, 2026 19:37
@richarddd richarddd changed the title Update quickjs-ng to 10b9969 and fix ArrayBuffer for new JS_NewArrayBuffer signature Update quickjs-ng to 2c620e4 and fix ArrayBuffer for new JS_NewArrayBuffer signature Aug 24, 2026

@Sytten Sytten left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of comments

Comment thread core/src/context/async.rs Outdated
Comment thread core/src/value/array_buffer.rs Outdated
Comment thread core/src/value/array_buffer.rs Outdated
Comment thread core/src/value/array_buffer.rs Outdated
Comment thread core/src/value/array_buffer.rs Outdated
Comment thread core/src/value/array_buffer.rs Outdated
@richarddd
richarddd force-pushed the sync/quickjs-ng-bump branch from f763aca to 810b2b6 Compare August 29, 2026 07:04
psvensson added a commit to psvensson/lagrange-object-environment that referenced this pull request Sep 2, 2026
The real lagrange-images portable-runtime.js closure (107 ES modules) SIGSEGV'd
QuickJS-NG 0.15.1 at module LINK time (js_inner_module_linking NULL var_ref on
cyclic re-export of an imported binding). Root-caused to a 3-module synthetic
cycle with no Lagrange code; fixed upstream by quickjs-ng ef7a3a7 (first in
0.16.0). No released rquickjs carries a green engine, so pin rquickjs via
[patch.crates-io] to PR DelSkayn/rquickjs#723 head rev 810b2b66 (bundles
quickjs-ng 2c620e4). Exact rev, no floating branch, no vendoring; no
lagrange-images semantic changes (fix owned at the engine boundary).

The committed B0 probe goes RED -> GREEN: full_closure_links_and_exports_api
proves the real closure now links, evaluates, exports the portable API
(createPortableRuntime/createRuntimeCore/createPortableCodeExecutorRegistry) and
preserves the crypto-provider contract, with zero Node resolution requests. All
26 js_env tests stay green (incl. both command-quiet liveness regressions).
Falsified: reverting the pin restores the SIGSEGV. Crash guard retained (child
exit-status based, with a --list rename guard). TextEncoder/TextDecoder are
standard web-API host globals installed test-locally; 3zb-B decides the
production surface. Deferred: s3b (unpin to a release), stx (CI images ref).
…backed buffers by reallocating through a mutable capacity cell.
Comment thread core/src/value/array_buffer.rs Outdated
return core::ptr::null_mut();
}
} else if new_len < capacity {
unsafe { vec.set_len(new_len) };

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this is not safe because the current method allows:

#[derive(Copy, Clone)]
struct Point {
   x: i32,
   y: i32,
}

impl Drop on Point {
  fn drop(&mut self) {
     println!("Hello");
  }
}

let vec = vec![Point { x:1, y:2 }];
ArrayBuffer::new(ctx, vec);

If you use sel_len instead of truncate then the Drop is not called.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, switched to vec.truncate(new_len).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants