@scriptc/cli-darwin-x64 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/THIRD_PARTY_NOTICES +1 -1
- package/dist/bin/scriptc +0 -0
- package/dist/bin/scriptc.json +1 -1
- package/dist/lib/declarations/scriptc-node-fallback.d.ts +972 -245
- package/dist/lib/declarations/scriptc-overrides.d.ts +5 -1
- package/dist/lib/declarations/scriptc.d.ts +22 -2
- package/dist/lib/llvm/bin/scriptc-llvm-codegen +0 -0
- package/dist/lib/llvm/package.json +1 -1
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_dgram.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_fetch.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_readline.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_tls.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_util_compare.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_async_dyn.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_bigint_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_crypto_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_dc.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_dgram.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_dyn_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_fetch.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_ffi.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_ffi_queue.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_http.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_http2.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_inspect.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_loop_epoll.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_loop_kqueue.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_loop_wsapoll.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_net.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_path.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_qs.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_readline.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_test.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_tls.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_tls_ca.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_url_params.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_util.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_util_compare.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_util_style.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_watch.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_zlib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_dgram.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_island.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_readline.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_tls.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_util_compare.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic-text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/text-decoder-legacy-workers/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/workers/scr_mailbox.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/workers/scr_message.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/workers/scr_worker.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/workers/scr_worker_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_inspect.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_zlib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_inspect.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_zlib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_dgram.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_fetch.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_readline.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_tls.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_util_compare.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_async_dyn.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_bigint_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_crypto_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_dc.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_dgram.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_dyn_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_fetch.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_ffi.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_ffi_queue.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_http.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_http2.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_inspect.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_loop_epoll.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_loop_kqueue.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_loop_wsapoll.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_net.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_path.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_qs.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_readline.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_test.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_tls.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_tls_ca.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_url_params.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_util.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_util_compare.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_util_style.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_watch.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_zlib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_dgram.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_island.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_readline.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_tls.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_util_compare.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic-text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/text-decoder-legacy-workers/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/workers/scr_mailbox.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/workers/scr_message.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/workers/scr_worker.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/workers/scr_worker_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/package.json +1 -1
- package/dist/lib/runtime-darwin-x64/runtime-pack.json +3318 -790
- package/dist/lib/runtime-sources/package.json +1 -1
- package/dist/lib/runtime-sources/src/scr_array.c +479 -46
- package/dist/lib/runtime-sources/src/scr_assert.c +3 -3
- package/dist/lib/runtime-sources/src/scr_async.c +401 -71
- package/dist/lib/runtime-sources/src/scr_async.test.ts +16 -6
- package/dist/lib/runtime-sources/src/scr_async_dyn.c +30 -30
- package/dist/lib/runtime-sources/src/scr_bytes.c +487 -221
- package/dist/lib/runtime-sources/src/scr_bytes.test.c +85 -0
- package/dist/lib/runtime-sources/src/scr_bytes_io.c +45 -64
- package/dist/lib/runtime-sources/src/scr_child.c +48 -30
- package/dist/lib/runtime-sources/src/scr_closure.c +21 -11
- package/dist/lib/runtime-sources/src/scr_console.c +27 -5
- package/dist/lib/runtime-sources/src/scr_context.c +167 -0
- package/dist/lib/runtime-sources/src/scr_context.test.c +118 -0
- package/dist/lib/runtime-sources/src/scr_context.test.ts +47 -0
- package/dist/lib/runtime-sources/src/scr_copying.c +13 -2
- package/dist/lib/runtime-sources/src/scr_cycle.c +112 -12
- package/dist/lib/runtime-sources/src/scr_dc.c +8 -8
- package/dist/lib/runtime-sources/src/scr_dgram.c +10 -7
- package/dist/lib/runtime-sources/src/scr_error.c +26 -14
- package/dist/lib/runtime-sources/src/scr_events.c +45 -31
- package/dist/lib/runtime-sources/src/scr_events_emitter.c +34 -1
- package/dist/lib/runtime-sources/src/scr_exception.c +26 -7
- package/dist/lib/runtime-sources/src/scr_fetch.c +23 -20
- package/dist/lib/runtime-sources/src/scr_fetch_curl.c +1 -1
- package/dist/lib/runtime-sources/src/scr_ffi.c +3 -3
- package/dist/lib/runtime-sources/src/scr_file_handle.c +1 -0
- package/dist/lib/runtime-sources/src/scr_http.c +20 -16
- package/dist/lib/runtime-sources/src/scr_http2.c +10 -8
- package/dist/lib/runtime-sources/src/scr_inspect.c +1 -0
- package/dist/lib/runtime-sources/src/scr_island.c +1 -1
- package/dist/lib/runtime-sources/src/scr_json.c +652 -189
- package/dist/lib/runtime-sources/src/scr_json.test.c +339 -1
- package/dist/lib/runtime-sources/src/scr_json.test.ts +59 -25
- package/dist/lib/runtime-sources/src/scr_key.h +92 -0
- package/dist/lib/runtime-sources/src/scr_lib.c +256 -136
- package/dist/lib/runtime-sources/src/scr_mailbox.c +233 -0
- package/dist/lib/runtime-sources/src/scr_mailbox.h +28 -0
- package/dist/lib/runtime-sources/src/scr_mailbox.test.c +86 -0
- package/dist/lib/runtime-sources/src/scr_mailbox.test.ts +46 -0
- package/dist/lib/runtime-sources/src/scr_map.c +240 -107
- package/dist/lib/runtime-sources/src/scr_message.c +443 -0
- package/dist/lib/runtime-sources/src/scr_message.h +14 -0
- package/dist/lib/runtime-sources/src/scr_message.test.c +152 -0
- package/dist/lib/runtime-sources/src/scr_message.test.ts +44 -0
- package/dist/lib/runtime-sources/src/scr_net.c +14 -12
- package/dist/lib/runtime-sources/src/scr_number.c +36 -4
- package/dist/lib/runtime-sources/src/scr_numeric.h +25 -0
- package/dist/lib/runtime-sources/src/scr_numeric.test.c +37 -0
- package/dist/lib/runtime-sources/src/scr_numeric.test.ts +33 -0
- package/dist/lib/runtime-sources/src/scr_object.c +9 -4
- package/dist/lib/runtime-sources/src/scr_path.c +1 -1
- package/dist/lib/runtime-sources/src/scr_readline.c +8 -8
- package/dist/lib/runtime-sources/src/scr_regex.c +351 -167
- package/dist/lib/runtime-sources/src/scr_runtime.h +207 -34
- package/dist/lib/runtime-sources/src/scr_shared.c +280 -0
- package/dist/lib/runtime-sources/src/scr_shared.test.c +113 -0
- package/dist/lib/runtime-sources/src/scr_shared.test.ts +45 -0
- package/dist/lib/runtime-sources/src/scr_stream.c +9 -9
- package/dist/lib/runtime-sources/src/scr_string.c +365 -141
- package/dist/lib/runtime-sources/src/scr_test.c +8 -8
- package/dist/lib/runtime-sources/src/scr_tls.c +12 -12
- package/dist/lib/runtime-sources/src/scr_tls_ca.c +34 -12
- package/dist/lib/runtime-sources/src/scr_union.c +10 -5
- package/dist/lib/runtime-sources/src/scr_util_compare.c +1 -0
- package/dist/lib/runtime-sources/src/scr_util_style.c +11 -11
- package/dist/lib/runtime-sources/src/scr_watch.c +16 -6
- package/dist/lib/runtime-sources/src/scr_worker.c +232 -0
- package/dist/lib/runtime-sources/src/scr_worker.h +42 -0
- package/dist/lib/runtime-sources/src/scr_worker.test.c +115 -0
- package/dist/lib/runtime-sources/src/scr_worker.test.ts +49 -0
- package/dist/lib/runtime-sources/src/scr_worker_events.c +443 -0
- package/dist/lib/runtime-sources/src/scr_zlib.c +6 -0
- package/package.json +1 -1
|
@@ -197,7 +197,7 @@ struct ScrPromise {
|
|
|
197
197
|
};
|
|
198
198
|
|
|
199
199
|
#ifdef SCR_RC_AUDIT
|
|
200
|
-
static long scr_live_promises = 0;
|
|
200
|
+
static SCR_TL long scr_live_promises = 0;
|
|
201
201
|
long scr_promise_live_count(void) { return scr_live_promises; }
|
|
202
202
|
#endif
|
|
203
203
|
|
|
@@ -296,7 +296,7 @@ bool scr_promise_identity_equal(ScrPromise *a, ScrPromise *b) {
|
|
|
296
296
|
* registration — the scr_urj_deliver_fn pattern, so listener-free
|
|
297
297
|
* binaries keep their size class): called when a promise the checkpoint
|
|
298
298
|
* report already delivered as unhandled gains a handler. */
|
|
299
|
-
void (*scr_rjh_notify_fn)(ScrPromise *p) = NULL;
|
|
299
|
+
SCR_TL void (*scr_rjh_notify_fn)(ScrPromise *p) = NULL;
|
|
300
300
|
|
|
301
301
|
/* Every handler attach funnels here: mark the rejection observed, and
|
|
302
302
|
* fire Node's 'rejectionHandled' when the attach arrived AFTER the
|
|
@@ -383,6 +383,11 @@ typedef ucontext_t ScrCtx;
|
|
|
383
383
|
#endif
|
|
384
384
|
|
|
385
385
|
struct ScrFiber {
|
|
386
|
+
#ifdef SCR_WORKERS
|
|
387
|
+
struct ScrFiber *context_next;
|
|
388
|
+
struct ScrFiber **context_previous;
|
|
389
|
+
ScrPromise *waiting;
|
|
390
|
+
#endif
|
|
386
391
|
ScrCtx ctx;
|
|
387
392
|
/* wasm32 uses LLVM's stackless switched-coroutine frame instead of a
|
|
388
393
|
* native saved stack. The compiler emits these two generic wrappers in
|
|
@@ -432,8 +437,15 @@ struct ScrFiber {
|
|
|
432
437
|
* scr_async_dyn.c (gated — the size-class stance); this always-linked
|
|
433
438
|
* core keeps only what the fiber machinery itself touches: the active
|
|
434
439
|
* slot, the snapshot RC pair, and the switch/spawn/destroy wiring. */
|
|
435
|
-
static ScrAlsCtx *scr_als_main_slot = NULL;
|
|
440
|
+
static SCR_TL ScrAlsCtx *scr_als_main_slot = NULL;
|
|
441
|
+
#ifdef SCR_WORKERS
|
|
442
|
+
SCR_TL ScrAlsCtx **scr_als_active;
|
|
443
|
+
ScrAlsCtx **scr_als_slot(void) {
|
|
444
|
+
return scr_als_active ? scr_als_active : &scr_als_main_slot;
|
|
445
|
+
}
|
|
446
|
+
#else
|
|
436
447
|
ScrAlsCtx **scr_als_active = &scr_als_main_slot;
|
|
448
|
+
#endif
|
|
437
449
|
|
|
438
450
|
ScrAlsCtx *scr_als_ctx_retain(ScrAlsCtx *c) {
|
|
439
451
|
if (c) c->rc++;
|
|
@@ -448,10 +460,22 @@ void scr_als_ctx_release(ScrAlsCtx *c) {
|
|
|
448
460
|
|
|
449
461
|
|
|
450
462
|
|
|
451
|
-
static ScrCtx scr_loop_ctx; /* the main stack (scheduler home) */
|
|
452
|
-
static ScrFiber *scr_current = NULL;
|
|
453
|
-
static long scr_fibers_live = 0;
|
|
454
|
-
static long scr_fibers_abandoned = 0;
|
|
463
|
+
static SCR_TL ScrCtx scr_loop_ctx; /* the main stack (scheduler home) */
|
|
464
|
+
static SCR_TL ScrFiber *scr_current = NULL;
|
|
465
|
+
static SCR_TL long scr_fibers_live = 0;
|
|
466
|
+
static SCR_TL long scr_fibers_abandoned = 0;
|
|
467
|
+
|
|
468
|
+
#ifdef SCR_WORKERS
|
|
469
|
+
static SCR_TL ScrFiber *scr_context_fibers;
|
|
470
|
+
static void scr_fiber_track(ScrFiber *fiber) {
|
|
471
|
+
fiber->context_next = scr_context_fibers;
|
|
472
|
+
fiber->context_previous = &scr_context_fibers;
|
|
473
|
+
if (scr_context_fibers) scr_context_fibers->context_previous = &fiber->context_next;
|
|
474
|
+
scr_context_fibers = fiber;
|
|
475
|
+
}
|
|
476
|
+
#else
|
|
477
|
+
static void scr_fiber_track(ScrFiber *fiber) { (void)fiber; }
|
|
478
|
+
#endif
|
|
455
479
|
|
|
456
480
|
long scr_abandoned_fiber_count(void) { return scr_fibers_abandoned; }
|
|
457
481
|
|
|
@@ -475,8 +499,8 @@ void scr_wasi_coro_started(void *handle) {
|
|
|
475
499
|
#endif
|
|
476
500
|
|
|
477
501
|
/* Microtask queue: ready fibers, FIFO. */
|
|
478
|
-
static ScrFiber **scr_ready = NULL;
|
|
479
|
-
static size_t scr_ready_head = 0, scr_ready_len = 0, scr_ready_cap = 0;
|
|
502
|
+
static SCR_TL ScrFiber **scr_ready = NULL;
|
|
503
|
+
static SCR_TL size_t scr_ready_head = 0, scr_ready_len = 0, scr_ready_cap = 0;
|
|
480
504
|
|
|
481
505
|
static void scr_ready_push(ScrFiber *f) {
|
|
482
506
|
if (scr_ready_head + scr_ready_len == scr_ready_cap) {
|
|
@@ -511,14 +535,14 @@ typedef struct {
|
|
|
511
535
|
double delay_ms; /* the original delay — refresh() re-arms to now + this */
|
|
512
536
|
} ScrTimer;
|
|
513
537
|
|
|
514
|
-
static ScrTimer *scr_timers = NULL;
|
|
515
|
-
static size_t scr_ntimers = 0, scr_timers_cap = 0;
|
|
516
|
-
static unsigned long scr_timer_seq = 0;
|
|
538
|
+
static SCR_TL ScrTimer *scr_timers = NULL;
|
|
539
|
+
static SCR_TL size_t scr_ntimers = 0, scr_timers_cap = 0;
|
|
540
|
+
static SCR_TL unsigned long scr_timer_seq = 0;
|
|
517
541
|
/* REF'd armed timers — the loop's timer-liveness count (an unref'd timer
|
|
518
542
|
* sits in the heap and still FIRES if the loop runs for other reasons, but
|
|
519
543
|
* does not by itself keep the loop alive). Kept in sync by push/pop/remove
|
|
520
544
|
* and by ref/unref. */
|
|
521
|
-
static size_t scr_reffed_timers = 0;
|
|
545
|
+
static SCR_TL size_t scr_reffed_timers = 0;
|
|
522
546
|
|
|
523
547
|
/* Exported: the island's timer machinery (scr_web.c) shares this clock so
|
|
524
548
|
* its deadlines are comparable with the loop's. */
|
|
@@ -600,11 +624,11 @@ void scr_set_timeout(ScrClosure *cb, double ms) {
|
|
|
600
624
|
* its callback runs, so the run loop re-pushes it only if the callback
|
|
601
625
|
* did not clear it. */
|
|
602
626
|
|
|
603
|
-
static unsigned long scr_interval_next_id = 1;
|
|
604
|
-
static unsigned long scr_firing_id = 0; /* interval currently running */
|
|
605
|
-
static bool scr_firing_cleared = false;
|
|
606
|
-
static bool scr_firing_reffed = true; /* the running interval's ref state */
|
|
607
|
-
static bool scr_firing_refresh = false; /* refresh() called mid-callback */
|
|
627
|
+
static SCR_TL unsigned long scr_interval_next_id = 1;
|
|
628
|
+
static SCR_TL unsigned long scr_firing_id = 0; /* interval currently running */
|
|
629
|
+
static SCR_TL bool scr_firing_cleared = false;
|
|
630
|
+
static SCR_TL bool scr_firing_reffed = true; /* the running interval's ref state */
|
|
631
|
+
static SCR_TL bool scr_firing_refresh = false; /* refresh() called mid-callback */
|
|
608
632
|
|
|
609
633
|
/* Removes heap entry i (swap-with-last, then sift whichever way the moved
|
|
610
634
|
* entry needs). */
|
|
@@ -740,7 +764,7 @@ bool scr_timer_has_ref(double handle) {
|
|
|
740
764
|
* callback). Resource kinds this runtime does not model as loop handles
|
|
741
765
|
* (TCP wraps, FS requests, ...) are absent — SEMANTICS.md names the
|
|
742
766
|
* divergence. Result +1. */
|
|
743
|
-
static size_t scr_pending_immediates; /* defined below with the queue */
|
|
767
|
+
static SCR_TL size_t scr_pending_immediates; /* defined below with the queue */
|
|
744
768
|
ScrArr *scr_active_resources(void) {
|
|
745
769
|
ScrArr *arr = scr_arr_new(SCR_ELEM_STR, 8);
|
|
746
770
|
size_t timeouts = scr_ntimers + ((scr_firing_id != 0 && !scr_firing_cleared) ? 1 : 0);
|
|
@@ -763,8 +787,8 @@ typedef struct ScrNtick {
|
|
|
763
787
|
struct ScrNtick *next;
|
|
764
788
|
} ScrNtick;
|
|
765
789
|
|
|
766
|
-
static ScrNtick *scr_nt_head = NULL;
|
|
767
|
-
static ScrNtick *scr_nt_tail = NULL;
|
|
790
|
+
static SCR_TL ScrNtick *scr_nt_head = NULL;
|
|
791
|
+
static SCR_TL ScrNtick *scr_nt_tail = NULL;
|
|
768
792
|
|
|
769
793
|
/* Public: releases every queued tick without running it — the loop-exit
|
|
770
794
|
* teardown below AND the exit-listener runner (scr_events.c) both call
|
|
@@ -860,13 +884,13 @@ typedef struct {
|
|
|
860
884
|
bool reffed; /* keeps the loop alive; unref() clears it (Node semantics) */
|
|
861
885
|
} ScrImmediate;
|
|
862
886
|
|
|
863
|
-
static ScrImmediate *scr_immediates = NULL;
|
|
864
|
-
static size_t scr_nimmediates = 0, scr_immediates_head = 0, scr_immediates_cap = 0;
|
|
865
|
-
static unsigned long scr_immediate_seq = 0;
|
|
887
|
+
static SCR_TL ScrImmediate *scr_immediates = NULL;
|
|
888
|
+
static SCR_TL size_t scr_nimmediates = 0, scr_immediates_head = 0, scr_immediates_cap = 0;
|
|
889
|
+
static SCR_TL unsigned long scr_immediate_seq = 0;
|
|
866
890
|
/* Pending (queued, uncleared) immediates and the reffed subset — the
|
|
867
891
|
* loop's no-sleep signal and liveness count respectively. */
|
|
868
|
-
static size_t scr_pending_immediates = 0;
|
|
869
|
-
static size_t scr_reffed_immediates = 0;
|
|
892
|
+
static SCR_TL size_t scr_pending_immediates = 0;
|
|
893
|
+
static SCR_TL size_t scr_reffed_immediates = 0;
|
|
870
894
|
|
|
871
895
|
double scr_set_immediate(ScrClosure *cb) {
|
|
872
896
|
if (scr_nimmediates == scr_immediates_cap) {
|
|
@@ -945,8 +969,8 @@ static void scr_immediates_teardown(void) {
|
|
|
945
969
|
}
|
|
946
970
|
|
|
947
971
|
/* Unhandled rejections: rejected promises retained here until observed. */
|
|
948
|
-
static ScrPromise **scr_maybe_unhandled = NULL;
|
|
949
|
-
static size_t scr_nunhandled = 0, scr_unhandled_cap = 0;
|
|
972
|
+
static SCR_TL ScrPromise **scr_maybe_unhandled = NULL;
|
|
973
|
+
static SCR_TL size_t scr_nunhandled = 0, scr_unhandled_cap = 0;
|
|
950
974
|
|
|
951
975
|
static void scr_track_rejection(ScrPromise *p) {
|
|
952
976
|
if (scr_nunhandled == scr_unhandled_cap) {
|
|
@@ -960,7 +984,7 @@ static void scr_track_rejection(ScrPromise *p) {
|
|
|
960
984
|
/* ── context switching (ASan-annotated) ───────────────────────────────── */
|
|
961
985
|
|
|
962
986
|
#ifdef SCR_ASAN_FIBERS
|
|
963
|
-
static void *scr_main_fake_stack; /* fake-stack slot for the main context */
|
|
987
|
+
static SCR_TL void *scr_main_fake_stack; /* fake-stack slot for the main context */
|
|
964
988
|
#endif
|
|
965
989
|
|
|
966
990
|
#ifdef _WIN32
|
|
@@ -1082,7 +1106,12 @@ static void scr_promise_all_settle(ScrAllState *st, ScrPromise *result, size_t i
|
|
|
1082
1106
|
* destination's own pending check. Promise.all entries dispatch through
|
|
1083
1107
|
* their shared countdown state instead of the adapt pair. */
|
|
1084
1108
|
static void scr_promise_settle_wake(ScrPromise *p) {
|
|
1085
|
-
for (size_t i = 0; i < p->nwaiters; i++)
|
|
1109
|
+
for (size_t i = 0; i < p->nwaiters; i++) {
|
|
1110
|
+
#ifdef SCR_WORKERS
|
|
1111
|
+
p->waiters[i]->waiting = NULL;
|
|
1112
|
+
#endif
|
|
1113
|
+
scr_ready_push(p->waiters[i]);
|
|
1114
|
+
}
|
|
1086
1115
|
p->nwaiters = 0;
|
|
1087
1116
|
for (size_t i = 0; i < p->ncbs; i++) {
|
|
1088
1117
|
if (p->cbs[i].all) {
|
|
@@ -1254,6 +1283,15 @@ static void scr_fiber_finish(ScrFiber *self) {
|
|
|
1254
1283
|
return;
|
|
1255
1284
|
}
|
|
1256
1285
|
ScrPromise *p = self->promise;
|
|
1286
|
+
#ifdef SCR_WORKERS
|
|
1287
|
+
if (scr_context_stopping()) {
|
|
1288
|
+
scr_context_checkpoint();
|
|
1289
|
+
scr_promise_reject_from_cell(p, &self->exc);
|
|
1290
|
+
p->rejection_observed = true;
|
|
1291
|
+
self->done = true;
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
#endif
|
|
1257
1295
|
if (scr_exc_pending()) {
|
|
1258
1296
|
/* The body's exception escaped: the promise rejects with the payload
|
|
1259
1297
|
* (moved from the fiber's cell into the promise). */
|
|
@@ -1318,6 +1356,12 @@ static void scr_fiber_context_init(ScrFiber *f) {
|
|
|
1318
1356
|
* fiber object and its stack — legal here because a finished fiber has
|
|
1319
1357
|
* switched away and can never be current again. */
|
|
1320
1358
|
static void scr_fiber_destroy(ScrFiber *f) {
|
|
1359
|
+
#ifdef SCR_WORKERS
|
|
1360
|
+
if (f->context_previous) {
|
|
1361
|
+
*f->context_previous = f->context_next;
|
|
1362
|
+
if (f->context_next) f->context_next->context_previous = f->context_previous;
|
|
1363
|
+
}
|
|
1364
|
+
#endif
|
|
1321
1365
|
#ifdef _WIN32
|
|
1322
1366
|
DeleteFiber(f->ctx);
|
|
1323
1367
|
#elif defined(__wasi__)
|
|
@@ -1337,12 +1381,13 @@ static void scr_fiber_destroy(ScrFiber *f) {
|
|
|
1337
1381
|
ScrPromise *scr_async_spawn(void (*entry)(ScrFiber *, void *), void *argpack) {
|
|
1338
1382
|
ScrFiber *f = calloc(1, sizeof *f);
|
|
1339
1383
|
if (!f) scr_oom();
|
|
1384
|
+
scr_fiber_track(f);
|
|
1340
1385
|
f->promise = scr_promise_new();
|
|
1341
1386
|
f->entry = entry;
|
|
1342
1387
|
f->argpack = argpack;
|
|
1343
1388
|
/* AsyncLocalStorage: the child runs in the SPAWNER's context (Node's
|
|
1344
1389
|
* init-time capture); snapshots are immutable, so a retain suffices. */
|
|
1345
|
-
f->als = scr_als_ctx_retain(*
|
|
1390
|
+
f->als = scr_als_ctx_retain(*SCR_ALS_SLOT());
|
|
1346
1391
|
scr_fibers_live++;
|
|
1347
1392
|
|
|
1348
1393
|
#ifdef _WIN32
|
|
@@ -1413,7 +1458,7 @@ ScrPromise *scr_async_spawn_after(ScrPromise *dependency,
|
|
|
1413
1458
|
f->promise = scr_promise_new();
|
|
1414
1459
|
f->entry = entry;
|
|
1415
1460
|
f->argpack = argpack;
|
|
1416
|
-
f->als = scr_als_ctx_retain(*
|
|
1461
|
+
f->als = scr_als_ctx_retain(*SCR_ALS_SLOT());
|
|
1417
1462
|
scr_fibers_live++;
|
|
1418
1463
|
|
|
1419
1464
|
if (dependency->state == SCR_PROM_PENDING) {
|
|
@@ -1444,7 +1489,22 @@ static void scr_await_park(ScrPromise *p) {
|
|
|
1444
1489
|
if (!p->waiters) scr_oom();
|
|
1445
1490
|
}
|
|
1446
1491
|
p->waiters[p->nwaiters++] = self;
|
|
1492
|
+
#ifdef SCR_WORKERS
|
|
1493
|
+
self->waiting = p;
|
|
1494
|
+
#endif
|
|
1447
1495
|
scr_switch(&self->ctx, self->return_to, NULL);
|
|
1496
|
+
#ifdef SCR_WORKERS
|
|
1497
|
+
/* Shutdown resumes suspended stacks without settling their dependencies.
|
|
1498
|
+
* Remove the borrowed waiter before the stack releases its promise. */
|
|
1499
|
+
if (self->waiting) {
|
|
1500
|
+
for (size_t i = 0; i < p->nwaiters; i++) {
|
|
1501
|
+
if (p->waiters[i] != self) continue;
|
|
1502
|
+
memmove(p->waiters + i, p->waiters + i + 1, (--p->nwaiters - i) * sizeof(*p->waiters));
|
|
1503
|
+
break;
|
|
1504
|
+
}
|
|
1505
|
+
self->waiting = NULL;
|
|
1506
|
+
}
|
|
1507
|
+
#endif
|
|
1448
1508
|
/* Resumed by the loop: return_to must now point at the loop's context. */
|
|
1449
1509
|
}
|
|
1450
1510
|
|
|
@@ -1517,6 +1577,7 @@ static void scr_promise_rethrow(ScrPromise *p) {
|
|
|
1517
1577
|
case SCR_EXC_PRIMITIVE_REF: scr_throw_primitive_ref(p->retain_fn(p->payload), p->retain_fn, p->release_fn, p->trace_fn); break;
|
|
1518
1578
|
case SCR_EXC_OBJ: scr_throw_obj(p->retain_fn(p->payload), p->retain_fn, p->release_fn, p->trace_fn); break;
|
|
1519
1579
|
case SCR_EXC_NONE:
|
|
1580
|
+
case SCR_EXC_TERMINATE:
|
|
1520
1581
|
case SCR_EXC_GENRET: /* unreachable: the sentinel never settles a promise */
|
|
1521
1582
|
scr_throw_str(scr_str_new("undefined", 9));
|
|
1522
1583
|
break;
|
|
@@ -1525,6 +1586,9 @@ static void scr_promise_rethrow(ScrPromise *p) {
|
|
|
1525
1586
|
|
|
1526
1587
|
/* Await result extraction. Rejection re-throws into the awaiter. */
|
|
1527
1588
|
static bool scr_await_settled(ScrPromise *p) {
|
|
1589
|
+
#ifdef SCR_WORKERS
|
|
1590
|
+
if (scr_context_checkpoint()) return false;
|
|
1591
|
+
#endif
|
|
1528
1592
|
#ifdef __wasi__
|
|
1529
1593
|
if (p->state == SCR_PROM_PENDING) {
|
|
1530
1594
|
fputs("scriptc: internal error: resumed before awaited promise settled\n", stderr);
|
|
@@ -1532,7 +1596,15 @@ static bool scr_await_settled(ScrPromise *p) {
|
|
|
1532
1596
|
}
|
|
1533
1597
|
#else
|
|
1534
1598
|
if (p->state != SCR_PROM_PENDING) scr_await_yield();
|
|
1535
|
-
while (p->state == SCR_PROM_PENDING)
|
|
1599
|
+
while (p->state == SCR_PROM_PENDING) {
|
|
1600
|
+
#ifdef SCR_WORKERS
|
|
1601
|
+
if (scr_context_checkpoint()) return false;
|
|
1602
|
+
#endif
|
|
1603
|
+
scr_await_park(p);
|
|
1604
|
+
}
|
|
1605
|
+
#ifdef SCR_WORKERS
|
|
1606
|
+
if (scr_context_checkpoint()) return false;
|
|
1607
|
+
#endif
|
|
1536
1608
|
#endif
|
|
1537
1609
|
scr_prom_observe(p);
|
|
1538
1610
|
if (p->state == SCR_PROM_REJECTED) {
|
|
@@ -1843,6 +1915,9 @@ ScrPromise *scr_fsp_rename(ScrStr *oldpath, ScrStr *newpath) {
|
|
|
1843
1915
|
* platform mutex publishes each result before the loop removes it from the
|
|
1844
1916
|
* completion queue. */
|
|
1845
1917
|
#if !defined(SCR_LIB) && !defined(__wasi__)
|
|
1918
|
+
#ifdef SCR_WORKERS
|
|
1919
|
+
typedef struct ScrFsRenameOwner ScrFsRenameOwner;
|
|
1920
|
+
#endif
|
|
1846
1921
|
typedef struct ScrFsRenameOp {
|
|
1847
1922
|
bool generic;
|
|
1848
1923
|
bool ran;
|
|
@@ -1856,13 +1931,28 @@ typedef struct ScrFsRenameOp {
|
|
|
1856
1931
|
ScrFsRenameFn fn;
|
|
1857
1932
|
int error;
|
|
1858
1933
|
struct ScrFsRenameOp *next;
|
|
1934
|
+
#ifdef SCR_WORKERS
|
|
1935
|
+
ScrFsRenameOwner *owner;
|
|
1936
|
+
#endif
|
|
1859
1937
|
} ScrFsRenameOp;
|
|
1860
1938
|
|
|
1861
1939
|
static ScrFsRenameOp *scr_fs_rename_work = NULL;
|
|
1862
1940
|
static ScrFsRenameOp **scr_fs_rename_work_tail = &scr_fs_rename_work;
|
|
1941
|
+
#ifdef SCR_WORKERS
|
|
1942
|
+
struct ScrFsRenameOwner {
|
|
1943
|
+
ScrFsRenameOp *done;
|
|
1944
|
+
ScrFsRenameOp **tail;
|
|
1945
|
+
size_t pending;
|
|
1946
|
+
};
|
|
1947
|
+
static SCR_TL ScrFsRenameOwner *scr_fs_rename_owner;
|
|
1948
|
+
#define scr_fs_rename_done (scr_fs_rename_owner->done)
|
|
1949
|
+
#define scr_fs_rename_done_tail (scr_fs_rename_owner->tail)
|
|
1950
|
+
#define scr_fs_rename_pending_count (scr_fs_rename_owner->pending)
|
|
1951
|
+
#else
|
|
1863
1952
|
static ScrFsRenameOp *scr_fs_rename_done = NULL;
|
|
1864
1953
|
static ScrFsRenameOp **scr_fs_rename_done_tail = &scr_fs_rename_done;
|
|
1865
1954
|
static size_t scr_fs_rename_pending_count = 0;
|
|
1955
|
+
#endif
|
|
1866
1956
|
static size_t scr_fs_rename_worker_count = 0;
|
|
1867
1957
|
static bool scr_fs_rename_stopping = false;
|
|
1868
1958
|
static bool scr_fs_rename_shutdown_registered = false;
|
|
@@ -1903,6 +1993,41 @@ static void scr_fs_rename_op_release(ScrFsRenameOp *op) {
|
|
|
1903
1993
|
free(op);
|
|
1904
1994
|
}
|
|
1905
1995
|
|
|
1996
|
+
#ifdef SCR_WORKERS
|
|
1997
|
+
static void scr_fs_rename_context_cleanup(void) {
|
|
1998
|
+
ScrFsRenameOwner *owner = scr_fs_rename_owner;
|
|
1999
|
+
/* Outstanding native work may still borrow payload storage. Wait for its
|
|
2000
|
+
* publication before reclaiming it, without invoking script callbacks
|
|
2001
|
+
* during context teardown. Other script contexts keep using the pool. */
|
|
2002
|
+
while (owner->pending) {
|
|
2003
|
+
scr_fs_rename_lock_enter();
|
|
2004
|
+
while (!owner->done) scr_fs_rename_wait();
|
|
2005
|
+
ScrFsRenameOp *op = owner->done;
|
|
2006
|
+
owner->done = op->next;
|
|
2007
|
+
if (!owner->done) owner->tail = &owner->done;
|
|
2008
|
+
scr_fs_rename_lock_leave();
|
|
2009
|
+
owner->pending--;
|
|
2010
|
+
scr_fs_rename_op_release(op);
|
|
2011
|
+
}
|
|
2012
|
+
scr_fs_rename_owner = NULL;
|
|
2013
|
+
free(owner);
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
static ScrFsRenameOwner *scr_fs_rename_context(void) {
|
|
2017
|
+
if (!scr_fs_rename_owner) {
|
|
2018
|
+
ScrFsRenameOwner *owner = calloc(1, sizeof(*owner));
|
|
2019
|
+
if (!owner) scr_oom();
|
|
2020
|
+
owner->tail = &owner->done;
|
|
2021
|
+
if (scr_atexit(scr_fs_rename_context_cleanup) != 0) {
|
|
2022
|
+
free(owner);
|
|
2023
|
+
scr_trap("scriptc: could not register work context cleanup\n");
|
|
2024
|
+
}
|
|
2025
|
+
scr_fs_rename_owner = owner;
|
|
2026
|
+
}
|
|
2027
|
+
return scr_fs_rename_owner;
|
|
2028
|
+
}
|
|
2029
|
+
#endif
|
|
2030
|
+
|
|
1906
2031
|
static void scr_fs_rename_worker_loop(void) {
|
|
1907
2032
|
for (;;) {
|
|
1908
2033
|
scr_fs_rename_lock_enter();
|
|
@@ -1922,8 +2047,14 @@ static void scr_fs_rename_worker_loop(void) {
|
|
|
1922
2047
|
|
|
1923
2048
|
scr_fs_rename_lock_enter();
|
|
1924
2049
|
op->next = NULL;
|
|
2050
|
+
#ifdef SCR_WORKERS
|
|
2051
|
+
*op->owner->tail = op;
|
|
2052
|
+
op->owner->tail = &op->next;
|
|
2053
|
+
scr_fs_rename_broadcast();
|
|
2054
|
+
#else
|
|
1925
2055
|
*scr_fs_rename_done_tail = op;
|
|
1926
2056
|
scr_fs_rename_done_tail = &op->next;
|
|
2057
|
+
#endif
|
|
1927
2058
|
scr_fs_rename_lock_leave();
|
|
1928
2059
|
}
|
|
1929
2060
|
}
|
|
@@ -1963,6 +2094,15 @@ static void scr_fs_renames_shutdown(void) {
|
|
|
1963
2094
|
}
|
|
1964
2095
|
|
|
1965
2096
|
scr_fs_rename_lock_enter();
|
|
2097
|
+
#ifdef SCR_WORKERS
|
|
2098
|
+
/* Every context drains its in-flight work before it exits. This final
|
|
2099
|
+
* process hook owns only the pool threads and cannot touch runtime heaps. */
|
|
2100
|
+
if (scr_fs_rename_work) {
|
|
2101
|
+
scr_fs_rename_lock_leave();
|
|
2102
|
+
scr_trap("scriptc: work queue survived context teardown\n");
|
|
2103
|
+
}
|
|
2104
|
+
scr_fs_rename_lock_leave();
|
|
2105
|
+
#else
|
|
1966
2106
|
ScrFsRenameOp *work = scr_fs_rename_work;
|
|
1967
2107
|
ScrFsRenameOp *done = scr_fs_rename_done;
|
|
1968
2108
|
scr_fs_rename_work = NULL;
|
|
@@ -1981,11 +2121,20 @@ static void scr_fs_renames_shutdown(void) {
|
|
|
1981
2121
|
scr_fs_rename_op_release(done);
|
|
1982
2122
|
done = next;
|
|
1983
2123
|
}
|
|
2124
|
+
#endif
|
|
1984
2125
|
}
|
|
1985
2126
|
|
|
1986
|
-
static bool scr_fs_renames_pending(void) {
|
|
2127
|
+
static bool scr_fs_renames_pending(void) {
|
|
2128
|
+
#ifdef SCR_WORKERS
|
|
2129
|
+
if (!scr_fs_rename_owner) return false;
|
|
2130
|
+
#endif
|
|
2131
|
+
return scr_fs_rename_pending_count != 0;
|
|
2132
|
+
}
|
|
1987
2133
|
|
|
1988
2134
|
static bool scr_fs_renames_dispatch(void) {
|
|
2135
|
+
#ifdef SCR_WORKERS
|
|
2136
|
+
if (!scr_fs_rename_owner) return false;
|
|
2137
|
+
#endif
|
|
1989
2138
|
scr_fs_rename_lock_enter();
|
|
1990
2139
|
ScrFsRenameOp *op = scr_fs_rename_done;
|
|
1991
2140
|
if (op != NULL) {
|
|
@@ -2017,14 +2166,21 @@ static bool scr_fs_renames_dispatch(void) {
|
|
|
2017
2166
|
}
|
|
2018
2167
|
|
|
2019
2168
|
static void scr_work_submit_op(ScrFsRenameOp *op) {
|
|
2169
|
+
#ifdef SCR_WORKERS
|
|
2170
|
+
op->owner = scr_fs_rename_context();
|
|
2171
|
+
scr_fs_rename_pending_count++;
|
|
2172
|
+
scr_fs_rename_lock_enter();
|
|
2173
|
+
#endif
|
|
2020
2174
|
if (!scr_fs_rename_shutdown_registered) {
|
|
2021
2175
|
if (atexit(scr_fs_renames_shutdown) != 0) {
|
|
2022
2176
|
scr_trap("scriptc: could not register worker cleanup\n");
|
|
2023
2177
|
}
|
|
2024
2178
|
scr_fs_rename_shutdown_registered = true;
|
|
2025
2179
|
}
|
|
2180
|
+
#ifndef SCR_WORKERS
|
|
2026
2181
|
scr_fs_rename_pending_count++;
|
|
2027
2182
|
scr_fs_rename_lock_enter();
|
|
2183
|
+
#endif
|
|
2028
2184
|
*scr_fs_rename_work_tail = op;
|
|
2029
2185
|
scr_fs_rename_work_tail = &op->next;
|
|
2030
2186
|
int create_error = 0;
|
|
@@ -2055,8 +2211,14 @@ static void scr_work_submit_op(ScrFsRenameOp *op) {
|
|
|
2055
2211
|
failed->error = create_error;
|
|
2056
2212
|
failed->ran = !failed->generic;
|
|
2057
2213
|
failed->next = NULL;
|
|
2214
|
+
#ifdef SCR_WORKERS
|
|
2215
|
+
*failed->owner->tail = failed;
|
|
2216
|
+
failed->owner->tail = &failed->next;
|
|
2217
|
+
scr_fs_rename_broadcast();
|
|
2218
|
+
#else
|
|
2058
2219
|
*scr_fs_rename_done_tail = failed;
|
|
2059
2220
|
scr_fs_rename_done_tail = &failed->next;
|
|
2221
|
+
#endif
|
|
2060
2222
|
}
|
|
2061
2223
|
scr_fs_rename_work_tail = &scr_fs_rename_work;
|
|
2062
2224
|
} else {
|
|
@@ -2198,10 +2360,14 @@ typedef struct ScrCryptoBytesOp {
|
|
|
2198
2360
|
struct ScrCryptoBytesOp *next;
|
|
2199
2361
|
} ScrCryptoBytesOp;
|
|
2200
2362
|
|
|
2201
|
-
static ScrCryptoBytesOp *scr_crypto_bytes_head = NULL;
|
|
2202
|
-
|
|
2203
|
-
static
|
|
2204
|
-
|
|
2363
|
+
static SCR_TL ScrCryptoBytesOp *scr_crypto_bytes_head = NULL;
|
|
2364
|
+
#ifdef SCR_WORKERS
|
|
2365
|
+
static SCR_TL ScrCryptoBytesOp **scr_crypto_bytes_tail;
|
|
2366
|
+
#else
|
|
2367
|
+
static SCR_TL ScrCryptoBytesOp **scr_crypto_bytes_tail = &scr_crypto_bytes_head;
|
|
2368
|
+
#endif
|
|
2369
|
+
static SCR_TL size_t scr_crypto_bytes_pending_count = 0;
|
|
2370
|
+
static SCR_TL bool scr_crypto_bytes_cleanup_registered = false;
|
|
2205
2371
|
|
|
2206
2372
|
static void scr_crypto_bytes_shutdown(void) {
|
|
2207
2373
|
while (scr_crypto_bytes_head != NULL) {
|
|
@@ -2235,13 +2401,14 @@ static bool scr_crypto_bytes_dispatch(void) {
|
|
|
2235
2401
|
|
|
2236
2402
|
void scr_crypto_defer_bytes(ScrBytes *value, ScrError *error, ScrClosure *cb, ScrCryptoBytesFn fn) {
|
|
2237
2403
|
if (!scr_crypto_bytes_cleanup_registered) {
|
|
2238
|
-
if (
|
|
2404
|
+
if (scr_atexit(scr_crypto_bytes_shutdown) != 0) {
|
|
2239
2405
|
scr_bytes_release(value);
|
|
2240
2406
|
scr_error_release(error);
|
|
2241
2407
|
scr_closure_release(cb);
|
|
2242
2408
|
scr_trap("scriptc: could not register crypto callback cleanup\n");
|
|
2243
2409
|
}
|
|
2244
2410
|
scr_crypto_bytes_cleanup_registered = true;
|
|
2411
|
+
scr_crypto_bytes_tail = &scr_crypto_bytes_head;
|
|
2245
2412
|
}
|
|
2246
2413
|
ScrCryptoBytesOp *op = malloc(sizeof *op);
|
|
2247
2414
|
if (!op) {
|
|
@@ -2371,10 +2538,10 @@ void scr_queue_microtask_dyn(const ScrDyn *cb) {
|
|
|
2371
2538
|
* code hint in scr_exception.c, so each unit stays self-contained (the
|
|
2372
2539
|
* runtime C tests link them separately). */
|
|
2373
2540
|
|
|
2374
|
-
static bool (*scr_events_pending_fn)(void) = NULL; /* keeps the loop alive */
|
|
2375
|
-
static bool (*scr_events_watching_fn)(void) = NULL; /* wants the poll sleep */
|
|
2376
|
-
static void (*scr_events_dispatch_fn)(void) = NULL; /* fire due listeners */
|
|
2377
|
-
static int (*scr_events_pollfds_fn)(int out[2]) = NULL;
|
|
2541
|
+
static SCR_TL bool (*scr_events_pending_fn)(void) = NULL; /* keeps the loop alive */
|
|
2542
|
+
static SCR_TL bool (*scr_events_watching_fn)(void) = NULL; /* wants the poll sleep */
|
|
2543
|
+
static SCR_TL void (*scr_events_dispatch_fn)(void) = NULL; /* fire due listeners */
|
|
2544
|
+
static SCR_TL int (*scr_events_pollfds_fn)(int out[2]) = NULL;
|
|
2378
2545
|
|
|
2379
2546
|
void scr_loop_set_events(bool (*pending)(void), bool (*watching)(void),
|
|
2380
2547
|
void (*dispatch)(void), int (*pollfds)(int out[2])) {
|
|
@@ -2467,8 +2634,8 @@ static void scr_resume_fiber(ScrFiber *f) {
|
|
|
2467
2634
|
* engine-job draining + fetch transfer polling here. Static builds never
|
|
2468
2635
|
* set it — both slots stay NULL and the loop is byte-identical in
|
|
2469
2636
|
* behavior. */
|
|
2470
|
-
static bool (*scr_io_pending_fn)(void) = NULL;
|
|
2471
|
-
static void (*scr_io_poll_fn)(double max_wait_ms) = NULL;
|
|
2637
|
+
static SCR_TL bool (*scr_io_pending_fn)(void) = NULL;
|
|
2638
|
+
static SCR_TL void (*scr_io_poll_fn)(double max_wait_ms) = NULL;
|
|
2472
2639
|
|
|
2473
2640
|
void scr_loop_set_io(bool (*pending)(void), void (*poll)(double)) {
|
|
2474
2641
|
scr_io_pending_fn = pending;
|
|
@@ -2479,7 +2646,7 @@ void scr_loop_set_io(bool (*pending)(void), void (*poll)(double)) {
|
|
|
2479
2646
|
* the sleep below so an armed AbortSignal.timeout fires on time while
|
|
2480
2647
|
* the loop waits on socket readiness — without keeping the loop alive by
|
|
2481
2648
|
* itself (the liveness test never consults it, Node's unref'd timer). */
|
|
2482
|
-
static double (*scr_island_deadline_fn)(void) = NULL;
|
|
2649
|
+
static SCR_TL double (*scr_island_deadline_fn)(void) = NULL;
|
|
2483
2650
|
|
|
2484
2651
|
void scr_loop_set_island_deadline(double (*fn)(void)) { scr_island_deadline_fn = fn; }
|
|
2485
2652
|
|
|
@@ -2489,9 +2656,9 @@ void scr_loop_set_island_deadline(double (*fn)(void)) { scr_island_deadline_fn =
|
|
|
2489
2656
|
* fd for the idle poll(2) sleep (readable while events are pending —
|
|
2490
2657
|
* kqueue and epoll fds both behave this way).
|
|
2491
2658
|
* Net-free builds keep every slot NULL and the loop is byte-identical. */
|
|
2492
|
-
static bool (*scr_net_pending_fn)(void) = NULL;
|
|
2493
|
-
static void (*scr_net_dispatch_fn)(void) = NULL;
|
|
2494
|
-
static int (*scr_net_pollfd_fn)(void) = NULL;
|
|
2659
|
+
static SCR_TL bool (*scr_net_pending_fn)(void) = NULL;
|
|
2660
|
+
static SCR_TL void (*scr_net_dispatch_fn)(void) = NULL;
|
|
2661
|
+
static SCR_TL int (*scr_net_pollfd_fn)(void) = NULL;
|
|
2495
2662
|
|
|
2496
2663
|
void scr_loop_set_net(bool (*pending)(void), void (*dispatch)(void), int (*pollfd)(void)) {
|
|
2497
2664
|
scr_net_pending_fn = pending;
|
|
@@ -2502,9 +2669,9 @@ void scr_loop_set_net(bool (*pending)(void), void (*dispatch)(void), int (*pollf
|
|
|
2502
2669
|
/* The dgram hook (scr_dgram.c, when linked) — the net hook's exact shape:
|
|
2503
2670
|
* one more set of nullable slots, byte-identical loop behavior when
|
|
2504
2671
|
* unset. */
|
|
2505
|
-
static bool (*scr_dgram_pending_fn)(void) = NULL;
|
|
2506
|
-
static void (*scr_dgram_dispatch_fn)(void) = NULL;
|
|
2507
|
-
static int (*scr_dgram_pollfd_fn)(void) = NULL;
|
|
2672
|
+
static SCR_TL bool (*scr_dgram_pending_fn)(void) = NULL;
|
|
2673
|
+
static SCR_TL void (*scr_dgram_dispatch_fn)(void) = NULL;
|
|
2674
|
+
static SCR_TL int (*scr_dgram_pollfd_fn)(void) = NULL;
|
|
2508
2675
|
|
|
2509
2676
|
void scr_loop_set_dgram(bool (*pending)(void), void (*dispatch)(void), int (*pollfd)(void)) {
|
|
2510
2677
|
scr_dgram_pending_fn = pending;
|
|
@@ -2515,9 +2682,9 @@ void scr_loop_set_dgram(bool (*pending)(void), void (*dispatch)(void), int (*pol
|
|
|
2515
2682
|
/* The fs.watch hook (scr_watch.c, when linked) — the net hook's exact
|
|
2516
2683
|
* shape: one more set of nullable slots, byte-identical loop behavior
|
|
2517
2684
|
* when unset. */
|
|
2518
|
-
static bool (*scr_watch_pending_fn)(void) = NULL;
|
|
2519
|
-
static void (*scr_watch_dispatch_fn)(void) = NULL;
|
|
2520
|
-
static int (*scr_watch_pollfd_fn)(void) = NULL;
|
|
2685
|
+
static SCR_TL bool (*scr_watch_pending_fn)(void) = NULL;
|
|
2686
|
+
static SCR_TL void (*scr_watch_dispatch_fn)(void) = NULL;
|
|
2687
|
+
static SCR_TL int (*scr_watch_pollfd_fn)(void) = NULL;
|
|
2521
2688
|
|
|
2522
2689
|
void scr_loop_set_watch(bool (*pending)(void), void (*dispatch)(void), int (*pollfd)(void)) {
|
|
2523
2690
|
scr_watch_pending_fn = pending;
|
|
@@ -2528,10 +2695,10 @@ void scr_loop_set_watch(bool (*pending)(void), void (*dispatch)(void), int (*pol
|
|
|
2528
2695
|
/* The foreign-FFI queue hook (scr_ffi.c when a format-5 descriptor exists).
|
|
2529
2696
|
* Its pending count includes live registrations (reffed by default) and
|
|
2530
2697
|
* queued deliveries; dispatch runs exactly one callback per loop turn. */
|
|
2531
|
-
static bool (*scr_ffi_pending_fn)(void) = NULL;
|
|
2532
|
-
static bool (*scr_ffi_dispatch_fn)(void) = NULL;
|
|
2533
|
-
static int (*scr_ffi_pollfd_fn)(void) = NULL;
|
|
2534
|
-
static void (*scr_ffi_stop_fn)(void) = NULL;
|
|
2698
|
+
static SCR_TL bool (*scr_ffi_pending_fn)(void) = NULL;
|
|
2699
|
+
static SCR_TL bool (*scr_ffi_dispatch_fn)(void) = NULL;
|
|
2700
|
+
static SCR_TL int (*scr_ffi_pollfd_fn)(void) = NULL;
|
|
2701
|
+
static SCR_TL void (*scr_ffi_stop_fn)(void) = NULL;
|
|
2535
2702
|
|
|
2536
2703
|
void scr_loop_set_ffi(bool (*pending)(void), bool (*dispatch)(void),
|
|
2537
2704
|
int (*pollfd)(void), void (*stop)(void)) {
|
|
@@ -2546,14 +2713,53 @@ void scr_loop_set_ffi(bool (*pending)(void), bool (*dispatch)(void),
|
|
|
2546
2713
|
* TOP of every turn — before the events/net stations, the closest
|
|
2547
2714
|
* placement to Node's process.nextTick (whose stream emissions these
|
|
2548
2715
|
* are). No poller fd: ticks are pure CPU work, always ready. */
|
|
2549
|
-
static bool (*scr_stream_pending_fn)(void) = NULL;
|
|
2550
|
-
static void (*scr_stream_dispatch_fn)(void) = NULL;
|
|
2716
|
+
static SCR_TL bool (*scr_stream_pending_fn)(void) = NULL;
|
|
2717
|
+
static SCR_TL void (*scr_stream_dispatch_fn)(void) = NULL;
|
|
2551
2718
|
|
|
2552
2719
|
void scr_loop_set_stream(bool (*pending)(void), void (*dispatch)(void)) {
|
|
2553
2720
|
scr_stream_pending_fn = pending;
|
|
2554
2721
|
scr_stream_dispatch_fn = dispatch;
|
|
2555
2722
|
}
|
|
2556
2723
|
|
|
2724
|
+
#ifdef SCR_WORKERS
|
|
2725
|
+
static SCR_TL bool (*scr_workers_pending_fn)(void);
|
|
2726
|
+
static SCR_TL void (*scr_workers_dispatch_fn)(void);
|
|
2727
|
+
static SCR_TL int (*scr_workers_pollfd_fn)(void);
|
|
2728
|
+
static SCR_TL bool (*scr_workers_ready_fn)(void);
|
|
2729
|
+
static SCR_TL void (*scr_workers_wait_fn)(double);
|
|
2730
|
+
|
|
2731
|
+
void scr_loop_set_workers(bool (*pending)(void), bool (*ready)(void), void (*dispatch)(void),
|
|
2732
|
+
int (*pollfd)(void), void (*wait)(double)) {
|
|
2733
|
+
scr_workers_pending_fn = pending;
|
|
2734
|
+
scr_workers_dispatch_fn = dispatch;
|
|
2735
|
+
scr_workers_pollfd_fn = pollfd;
|
|
2736
|
+
scr_workers_ready_fn = ready;
|
|
2737
|
+
scr_workers_wait_fn = wait;
|
|
2738
|
+
}
|
|
2739
|
+
#endif
|
|
2740
|
+
|
|
2741
|
+
static bool scr_workers_pending(void) {
|
|
2742
|
+
#ifdef SCR_WORKERS
|
|
2743
|
+
return scr_workers_pending_fn && scr_workers_pending_fn();
|
|
2744
|
+
#else
|
|
2745
|
+
return false;
|
|
2746
|
+
#endif
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
static void scr_workers_dispatch(void) {
|
|
2750
|
+
#ifdef SCR_WORKERS
|
|
2751
|
+
if (scr_workers_dispatch_fn) scr_workers_dispatch_fn();
|
|
2752
|
+
#endif
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
static int scr_workers_pollfd(void) {
|
|
2756
|
+
#ifdef SCR_WORKERS
|
|
2757
|
+
return scr_workers_pollfd_fn ? scr_workers_pollfd_fn() : -1;
|
|
2758
|
+
#else
|
|
2759
|
+
return -1;
|
|
2760
|
+
#endif
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2557
2763
|
/* Dispatch hooks yield between event batches when fibers are already
|
|
2558
2764
|
* queued, so promise jobs interleave with event delivery (Node's
|
|
2559
2765
|
* microtask checkpoints between macrotasks). */
|
|
@@ -2659,6 +2865,9 @@ static bool scr_loop_run_pass(ScrPromise *top_level, bool first_checkpoint) {
|
|
|
2659
2865
|
if (scr_ready_len > 0) continue;
|
|
2660
2866
|
if (scr_stream_pending_fn != NULL && scr_stream_pending_fn()) continue;
|
|
2661
2867
|
}
|
|
2868
|
+
scr_workers_dispatch();
|
|
2869
|
+
if (scr_exc_pending()) return false;
|
|
2870
|
+
if (scr_ready_len > 0) continue;
|
|
2662
2871
|
/* Event dispatch (scr_events.c, when linked): watched signals
|
|
2663
2872
|
* delivered since the last turn fire their listeners now (macrotasks,
|
|
2664
2873
|
* like timers), then stdin — while a consumer exists, probe fd 0 and
|
|
@@ -2717,7 +2926,7 @@ static bool scr_loop_run_pass(ScrPromise *top_level, bool first_checkpoint) {
|
|
|
2717
2926
|
(scr_dgram_pending_fn != NULL && scr_dgram_pending_fn()) ||
|
|
2718
2927
|
(scr_watch_pending_fn != NULL && scr_watch_pending_fn()) ||
|
|
2719
2928
|
(scr_ffi_pending_fn != NULL && scr_ffi_pending_fn()) ||
|
|
2720
|
-
scr_fs_renames_pending() || scr_crypto_bytes_pending();
|
|
2929
|
+
scr_fs_renames_pending() || scr_crypto_bytes_pending() || scr_workers_pending();
|
|
2721
2930
|
if (held) {
|
|
2722
2931
|
scr_children_poll();
|
|
2723
2932
|
if (scr_exc_pending()) return false; /* uncaught throw in a listener */
|
|
@@ -2739,13 +2948,14 @@ static bool scr_loop_run_pass(ScrPromise *top_level, bool first_checkpoint) {
|
|
|
2739
2948
|
bool ffi = scr_ffi_pending_fn != NULL && scr_ffi_pending_fn();
|
|
2740
2949
|
bool renames = scr_fs_renames_pending();
|
|
2741
2950
|
bool crypto = scr_crypto_bytes_pending();
|
|
2951
|
+
bool workers = scr_workers_pending();
|
|
2742
2952
|
/* Timer liveness counts only REF'd timers: an unref'd timer stays in
|
|
2743
2953
|
* the heap (and fires if the loop runs on for other reasons) but does
|
|
2744
2954
|
* not by itself keep the process alive — Node's unref semantics.
|
|
2745
2955
|
* Children follow the same rule: an unref'd child is still REAPED
|
|
2746
2956
|
* while the loop runs (kids drives the sweeps and sleeps above) but
|
|
2747
2957
|
* only reffed ones keep the process alive. */
|
|
2748
|
-
if (scr_reffed_timers == 0 && scr_reffed_immediates == 0 && !scr_children_reffed_pending() && !io && !events && !net && !dgram && !watch && !ffi && !renames && !crypto) break;
|
|
2958
|
+
if (scr_reffed_timers == 0 && scr_reffed_immediates == 0 && !scr_children_reffed_pending() && !io && !events && !net && !dgram && !watch && !ffi && !renames && !crypto && !workers) break;
|
|
2749
2959
|
/* Sleep to the earliest deadline, then run every due timer (each may
|
|
2750
2960
|
* enqueue microtasks, which the next iteration drains first). Who
|
|
2751
2961
|
* sleeps depends on what is pending:
|
|
@@ -2784,21 +2994,30 @@ static bool scr_loop_run_pass(ScrPromise *top_level, bool first_checkpoint) {
|
|
|
2784
2994
|
* during that turn. No fd will wake us for this userspace work: return to
|
|
2785
2995
|
* dispatch without sleeping, still allowing due timers and immediates. */
|
|
2786
2996
|
if (scr_children_ready()) due = now;
|
|
2997
|
+
#ifdef SCR_WORKERS
|
|
2998
|
+
if (scr_workers_ready_fn && scr_workers_ready_fn()) due = now;
|
|
2999
|
+
#endif
|
|
2787
3000
|
#if !defined(_WIN32) && !defined(__wasi__)
|
|
2788
3001
|
if (due > now) scr_fiber_stacks_clear();
|
|
2789
3002
|
#endif
|
|
2790
3003
|
bool evw = scr_events_watching_fn != NULL && scr_events_watching_fn();
|
|
3004
|
+
#ifdef SCR_WORKERS
|
|
3005
|
+
if (workers && scr_workers_wait_fn && !io && !kids && !evw && !net && !dgram && !watch && !ffi && !renames && !crypto) {
|
|
3006
|
+
scr_workers_wait_fn(due > now ? due - now : 0);
|
|
3007
|
+
now = scr_now_ms();
|
|
3008
|
+
} else
|
|
3009
|
+
#endif
|
|
2791
3010
|
if (io) {
|
|
2792
3011
|
if (kids && due > now + SCR_CHILD_POLL_MS) due = now + SCR_CHILD_POLL_MS;
|
|
2793
3012
|
/* Signals/stdin/net can't wake curl's fd wait (and its poll retries
|
|
2794
3013
|
* on EINTR), so they re-impose a coarser cap — bounded Ctrl-C and
|
|
2795
3014
|
* socket latency during a fetch, without the reap-granularity
|
|
2796
3015
|
* cost. */
|
|
2797
|
-
else if ((evw || net || dgram || watch || ffi) && due > now + SCR_SIGNAL_POLL_MS) due = now + SCR_SIGNAL_POLL_MS;
|
|
3016
|
+
else if ((evw || net || dgram || watch || ffi || workers) && due > now + SCR_SIGNAL_POLL_MS) due = now + SCR_SIGNAL_POLL_MS;
|
|
2798
3017
|
scr_io_poll_fn(due > now ? due - now : 0);
|
|
2799
3018
|
now = scr_now_ms();
|
|
2800
3019
|
if (scr_ready_len > 0) continue; /* io callbacks woke fibers */
|
|
2801
|
-
} else if (evw || net || dgram || watch || ffi) {
|
|
3020
|
+
} else if (evw || net || dgram || watch || ffi || workers) {
|
|
2802
3021
|
#if defined(_WIN32) || defined(__wasi__)
|
|
2803
3022
|
/* The win32 arm, and WASI hosts whose poll_oneoff adapters do not
|
|
2804
3023
|
* reliably wake for a closed inherited stdin pipe: the sleep is a capped nanosleep and
|
|
@@ -2813,7 +3032,7 @@ static bool scr_loop_run_pass(ScrPromise *top_level, bool first_checkpoint) {
|
|
|
2813
3032
|
* WaitForMultipleObjects over WSAEVENTs, or IOCP. */
|
|
2814
3033
|
if (evw && due > now + SCR_SIGNAL_POLL_MS) due = now + SCR_SIGNAL_POLL_MS;
|
|
2815
3034
|
if ((net || dgram || watch) && due > now + SCR_CHILD_POLL_MS) due = now + SCR_CHILD_POLL_MS;
|
|
2816
|
-
if (ffi && due > now + SCR_CHILD_POLL_MS) due = now + SCR_CHILD_POLL_MS;
|
|
3035
|
+
if ((ffi || workers) && due > now + SCR_CHILD_POLL_MS) due = now + SCR_CHILD_POLL_MS;
|
|
2817
3036
|
if (kids && due > now + SCR_CHILD_POLL_MS) due = now + SCR_CHILD_POLL_MS;
|
|
2818
3037
|
if (due > now) {
|
|
2819
3038
|
double wait = due - now;
|
|
@@ -2830,7 +3049,7 @@ static bool scr_loop_run_pass(ScrPromise *top_level, bool first_checkpoint) {
|
|
|
2830
3049
|
* events are pending); unrepresentable children keep the ~1ms reap cap
|
|
2831
3050
|
* instead. Dispatch happens at the next turn's top — the poll only
|
|
2832
3051
|
* decides how long to sleep. */
|
|
2833
|
-
struct pollfd fds[
|
|
3052
|
+
struct pollfd fds[8];
|
|
2834
3053
|
int nfds = 0;
|
|
2835
3054
|
int evfds[2];
|
|
2836
3055
|
int nev = evw && scr_events_pollfds_fn != NULL ? scr_events_pollfds_fn(evfds) : 0;
|
|
@@ -2895,6 +3114,16 @@ static bool scr_loop_run_pass(ScrPromise *top_level, bool first_checkpoint) {
|
|
|
2895
3114
|
due = now + SCR_CHILD_POLL_MS;
|
|
2896
3115
|
}
|
|
2897
3116
|
}
|
|
3117
|
+
if (workers) {
|
|
3118
|
+
int worker_fd = scr_workers_pollfd();
|
|
3119
|
+
if (worker_fd >= 0) {
|
|
3120
|
+
fds[nfds].fd = worker_fd;
|
|
3121
|
+
fds[nfds].events = POLLIN;
|
|
3122
|
+
fds[nfds++].revents = 0;
|
|
3123
|
+
} else if (due > now + SCR_CHILD_POLL_MS) {
|
|
3124
|
+
due = now + SCR_CHILD_POLL_MS;
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
2898
3127
|
double wait = due > now ? due - now : 0;
|
|
2899
3128
|
if (wait > 1e9) wait = 1e9; /* poll takes int ms */
|
|
2900
3129
|
(void)poll(fds, (nfds_t)nfds, (int)(wait + 0.999));
|
|
@@ -3047,8 +3276,8 @@ bool scr_loop_run(ScrPromise *top_level) {
|
|
|
3047
3276
|
* ledger below reported nothing — one report, one voice, like Node's
|
|
3048
3277
|
* first-unhandled-rejection death. Returns whether the island had any.
|
|
3049
3278
|
* Static builds never set it. */
|
|
3050
|
-
static bool (*scr_island_rejections_fn)(bool print) = NULL;
|
|
3051
|
-
static int (*scr_island_jobs_drain_fn)(void) = NULL;
|
|
3279
|
+
static SCR_TL bool (*scr_island_rejections_fn)(bool print) = NULL;
|
|
3280
|
+
static SCR_TL int (*scr_island_jobs_drain_fn)(void) = NULL;
|
|
3052
3281
|
|
|
3053
3282
|
void scr_loop_set_island_rejections(bool (*fn)(bool print),
|
|
3054
3283
|
int (*drain_jobs)(void)) {
|
|
@@ -3065,7 +3294,7 @@ void scr_loop_set_island_rejections(bool (*fn)(bool print),
|
|
|
3065
3294
|
* registration — the loop-hook pattern, so listener-free binaries keep
|
|
3066
3295
|
* their size class): called per never-observed rejection; false = a
|
|
3067
3296
|
* listener threw (the uncaught crash path). */
|
|
3068
|
-
bool (*scr_urj_deliver_fn)(ScrPromise *p) = NULL;
|
|
3297
|
+
SCR_TL bool (*scr_urj_deliver_fn)(ScrPromise *p) = NULL;
|
|
3069
3298
|
|
|
3070
3299
|
/* Unhandled rejections at a completed nextTick/microtask checkpoint:
|
|
3071
3300
|
* Node prints an error and exits 1 when no listener handles the event.
|
|
@@ -3108,6 +3337,14 @@ bool scr_report_unhandled_rejections(void) {
|
|
|
3108
3337
|
}
|
|
3109
3338
|
} else if (!any) {
|
|
3110
3339
|
any = true;
|
|
3340
|
+
#ifdef SCR_WORKERS
|
|
3341
|
+
if (scr_context_report_error) {
|
|
3342
|
+
scr_promise_rethrow(p);
|
|
3343
|
+
scr_exc_print_uncaught();
|
|
3344
|
+
scr_promise_release(p);
|
|
3345
|
+
continue;
|
|
3346
|
+
}
|
|
3347
|
+
#endif
|
|
3111
3348
|
fflush(stdout);
|
|
3112
3349
|
fputs("Unhandled promise rejection: ", stderr);
|
|
3113
3350
|
switch (p->payload_kind) {
|
|
@@ -3386,6 +3623,9 @@ struct ScrGen {
|
|
|
3386
3623
|
ScrExcCell async_error;
|
|
3387
3624
|
bool settle_queued;
|
|
3388
3625
|
bool success_hop_done;
|
|
3626
|
+
#ifdef SCR_WORKERS
|
|
3627
|
+
bool context_abandoned;
|
|
3628
|
+
#endif
|
|
3389
3629
|
};
|
|
3390
3630
|
|
|
3391
3631
|
static ScrGen *scr_gen_new_common(void (*entry)(ScrFiber *, void *), void *argpack,
|
|
@@ -3404,12 +3644,13 @@ static ScrGen *scr_gen_new_common(void (*entry)(ScrFiber *, void *), void *argpa
|
|
|
3404
3644
|
ScrFiber *f = calloc(1, sizeof *f);
|
|
3405
3645
|
if (!f) scr_oom();
|
|
3406
3646
|
f->gen = g;
|
|
3647
|
+
scr_fiber_track(f);
|
|
3407
3648
|
f->entry = entry;
|
|
3408
3649
|
f->argpack = argpack; /* owned by the fiber start; drop_args if never started */
|
|
3409
3650
|
/* AsyncLocalStorage: generator bodies run in their CREATOR's context
|
|
3410
3651
|
* (the spawn-inheritance stance; resumes swap it active like any
|
|
3411
3652
|
* fiber switch). */
|
|
3412
|
-
f->als = scr_als_ctx_retain(*
|
|
3653
|
+
f->als = scr_als_ctx_retain(*SCR_ALS_SLOT());
|
|
3413
3654
|
scr_fibers_live++;
|
|
3414
3655
|
#ifdef _WIN32
|
|
3415
3656
|
f->ctx = CreateFiberEx(4096, 0, 0, scr_trampoline, NULL);
|
|
@@ -3441,6 +3682,16 @@ ScrGen *scr_gen_retain(ScrGen *g) {
|
|
|
3441
3682
|
|
|
3442
3683
|
void scr_gen_release(ScrGen *g) {
|
|
3443
3684
|
if (!g || --g->rc != 0) return;
|
|
3685
|
+
#ifdef SCR_WORKERS
|
|
3686
|
+
if (g->fiber && g->state != SCR_GEN_UNSTARTED && g->state != SCR_GEN_DONE) {
|
|
3687
|
+
/* A dropped suspended generator cannot run user finalizers. Keep its
|
|
3688
|
+
* native frame valid until context shutdown can unwind owned locals
|
|
3689
|
+
* through the noncatchable stop path. */
|
|
3690
|
+
g->rc = 1;
|
|
3691
|
+
g->context_abandoned = true;
|
|
3692
|
+
return;
|
|
3693
|
+
}
|
|
3694
|
+
#endif
|
|
3444
3695
|
scr_dyn_release(g->receiver);
|
|
3445
3696
|
scr_gen_slot_reset(&g->out);
|
|
3446
3697
|
scr_gen_slot_reset(&g->in);
|
|
@@ -3995,3 +4246,82 @@ static void scr_async_gen_resume_ready(ScrGen *g) {
|
|
|
3995
4246
|
}
|
|
3996
4247
|
scr_gen_release(g);
|
|
3997
4248
|
}
|
|
4249
|
+
|
|
4250
|
+
#ifdef SCR_WORKERS
|
|
4251
|
+
static void scr_context_ready_discard(void) {
|
|
4252
|
+
while (scr_ready_len) {
|
|
4253
|
+
ScrFiber *fiber = scr_ready[scr_ready_head++];
|
|
4254
|
+
scr_ready_len--;
|
|
4255
|
+
if (fiber->micro_cb) {
|
|
4256
|
+
scr_closure_release(fiber->micro_cb);
|
|
4257
|
+
free(fiber);
|
|
4258
|
+
} else if (fiber->gen_job) {
|
|
4259
|
+
ScrGen *generator = fiber->gen_job;
|
|
4260
|
+
generator->settle_queued = false;
|
|
4261
|
+
scr_gen_release(generator);
|
|
4262
|
+
free(fiber);
|
|
4263
|
+
}
|
|
4264
|
+
/* Real fibers belong to the context registry, including queued ones. */
|
|
4265
|
+
}
|
|
4266
|
+
scr_ready_head = 0;
|
|
4267
|
+
}
|
|
4268
|
+
|
|
4269
|
+
/* Thread exit reclaims suspended native stacks by resuming only their
|
|
4270
|
+
* compiler-owned unwind paths. No JavaScript catch/finally or queued user
|
|
4271
|
+
* callback runs after the stop flag is installed. */
|
|
4272
|
+
void scr_loop_context_shutdown(void) {
|
|
4273
|
+
if (scr_current) scr_trap("scriptc: context shutdown on an active fiber\n");
|
|
4274
|
+
scr_context_stop(scr_exit_code_hint_get());
|
|
4275
|
+
scr_timers_teardown();
|
|
4276
|
+
scr_context_ready_discard();
|
|
4277
|
+
while (scr_context_fibers) {
|
|
4278
|
+
ScrFiber *fiber = scr_context_fibers;
|
|
4279
|
+
if (fiber->gen) {
|
|
4280
|
+
ScrGen *generator = scr_gen_retain(fiber->gen);
|
|
4281
|
+
if (generator->state == SCR_GEN_UNSTARTED) {
|
|
4282
|
+
if (generator->drop_args) generator->drop_args(fiber->argpack);
|
|
4283
|
+
else free(fiber->argpack);
|
|
4284
|
+
scr_fiber_destroy(fiber);
|
|
4285
|
+
generator->fiber = NULL;
|
|
4286
|
+
generator->state = SCR_GEN_DONE;
|
|
4287
|
+
scr_fibers_live--;
|
|
4288
|
+
} else {
|
|
4289
|
+
scr_gen_switch_in(generator);
|
|
4290
|
+
if (generator->fiber) scr_trap("scriptc: generator did not unwind during shutdown\n");
|
|
4291
|
+
}
|
|
4292
|
+
while (generator->requests_head) {
|
|
4293
|
+
ScrAsyncGenRequest *request = generator->requests_head;
|
|
4294
|
+
generator->requests_head = request->next;
|
|
4295
|
+
scr_gen_slot_reset(&request->arg);
|
|
4296
|
+
scr_gen_exc_reset(&request->thrown);
|
|
4297
|
+
scr_promise_release(request->promise);
|
|
4298
|
+
free(request);
|
|
4299
|
+
scr_gen_release(generator);
|
|
4300
|
+
}
|
|
4301
|
+
generator->requests_tail = NULL;
|
|
4302
|
+
if (generator->active_request) {
|
|
4303
|
+
scr_promise_release(generator->active_request);
|
|
4304
|
+
generator->active_request = NULL;
|
|
4305
|
+
scr_gen_release(generator);
|
|
4306
|
+
}
|
|
4307
|
+
if (generator->context_abandoned) {
|
|
4308
|
+
generator->context_abandoned = false;
|
|
4309
|
+
scr_gen_release(generator);
|
|
4310
|
+
}
|
|
4311
|
+
scr_gen_release(generator);
|
|
4312
|
+
} else {
|
|
4313
|
+
scr_resume_fiber(fiber);
|
|
4314
|
+
if (scr_context_fibers == fiber) scr_trap("scriptc: async function did not unwind during shutdown\n");
|
|
4315
|
+
}
|
|
4316
|
+
scr_context_ready_discard();
|
|
4317
|
+
}
|
|
4318
|
+
scr_discard_unhandled_rejections();
|
|
4319
|
+
free(scr_ready); scr_ready = NULL; scr_ready_cap = 0;
|
|
4320
|
+
free(scr_timers); scr_timers = NULL; scr_timers_cap = 0;
|
|
4321
|
+
free(scr_immediates); scr_immediates = NULL; scr_immediates_cap = 0;
|
|
4322
|
+
free(scr_maybe_unhandled); scr_maybe_unhandled = NULL; scr_unhandled_cap = 0;
|
|
4323
|
+
scr_als_ctx_release(scr_als_main_slot); scr_als_main_slot = NULL;
|
|
4324
|
+
scr_fibers_abandoned = 0;
|
|
4325
|
+
scr_note_abandoned_fibers(0);
|
|
4326
|
+
}
|
|
4327
|
+
#endif
|