Skip to content

refactor(executor)!: v3 - #840

Merged
George-Miao merged 4 commits into
compio-rs:masterfrom
George-Miao:refactor/executor/v3
Apr 9, 2026
Merged

George-Miao merged 4 commits into
compio-rs:masterfrom
George-Miao:refactor/executor/v3

Conversation

@George-Miao

@George-Miao George-Miao commented Apr 7, 2026 •

Copy link
Copy Markdown
Member

cc @Paraworker.

This time I used only one allocation for each task, at the cost of manually written vtable and a ton of unsafe.

Update: Loom & miri test added, a new CI dedicated for that also added.

@George-Miao
George-Miao force-pushed the refactor/executor/v3 branch 5 times, most recently from 54cbbfb to f421768 Compare April 7, 2026 17:02
@George-Miao
George-Miao force-pushed the refactor/executor/v3 branch 3 times, most recently from 40b402a to faa2428 Compare April 7, 2026 17:17
@George-Miao
George-Miao force-pushed the refactor/executor/v3 branch 7 times, most recently from 7353b5c to 4fc96a4 Compare April 8, 2026 02:47
@George-Miao George-Miao self-assigned this Apr 8, 2026
@George-Miao George-Miao changed the title refactor(executor): v3 refactor(executor)!: v3 Apr 8, 2026
@George-Miao George-Miao added breaking change ci github action and other ci-related change package: executor Related to compio-executor refactor Refactoring existing code and removed package: executor Related to compio-executor labels Apr 8, 2026
@George-Miao
George-Miao marked this pull request as ready for review April 8, 2026 02:50
Copilot AI review requested due to automatic review settings April 8, 2026 02:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors compio-executor to a new “v3” task representation aimed at reducing per-task allocations (manual vtable + more unsafe), and adds dedicated Loom + Miri coverage with CI support.

Changes:

  • Replaces the executor task/queue internals with a single-allocation, vtable-driven Task and a new state machine for scheduling, wakers, and results.
  • Adds new test suites (loom and standard executor behavior tests) and introduces a dedicated GitHub Actions workflow to run Loom + Miri.
  • Extends compio-runtime’s RuntimeBuilder to forward queue sizing and a driver waker into the executor config.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
flake.nix Adds devshell tooling (e.g., gdb, miri extension) to support new testing/debug workflows.
compio-runtime/src/lib.rs Wires new executor config knobs (queue sizes, waker) into runtime construction; removes get_extra re-export.
compio-executor/tests/loom.rs Adds Loom model tests for spawn/run, cancel/run race, and cross-thread wake.
compio-executor/tests/executor.rs Adds behavioral tests for cancellation, detach, panic isolation, and resume_unwind.
compio-executor/src/waker.rs Replaces prior generic waker-with-extra with task-backed RawWaker vtable integration.
compio-executor/src/util/slot_queue.rs Removes old slot-queue implementation (moved/replaced by new queue).
compio-executor/src/util/one_shot.rs Removes old oneshot-based join mechanism (replaced by in-task result storage).
compio-executor/src/util/mod.rs Removes old util module structure (replaced by util.rs).
compio-executor/src/util.rs Introduces abort_on_panic, transpose, and assert_not_impl helpers for new unsafe core.
compio-executor/src/task/state.rs Adds new atomic state machine (scheduled/scheduling/waker/result/cancel/refcount).
compio-executor/src/task/remote.rs Adds remote-thread view for scheduling + polling a task allocation.
compio-executor/src/task/mod.rs Introduces new single-allocation Task with manual vtable + drop/poll/run logic.
compio-executor/src/task/local.rs Adds local-thread view for faster scheduling/polling on the creating thread.
compio-executor/src/task.rs Removes old boxed-polymorphic task representation.
compio-executor/src/queue.rs Replaces queue implementation with a dual (hot/cold) SlotMap-backed structure.
compio-executor/src/lib.rs Reworks Executor API/impl around new Shared, TaskQueue, and JoinHandle.
compio-executor/src/join_handle.rs New join handle built on Task polling/cancellation instead of a oneshot channel.
compio-executor/Cargo.toml Swaps dependencies (crossbeam-queue, cfg-if) and adds Loom cfg dependency + lint cfg.
Cargo.toml Pins compio-send-wrapper to a git branch needed for Loom support.
.github/workflows/ci_test_executor.yml Adds a dedicated executor CI workflow running Loom (nextest) and Miri.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread compio-executor/src/task/mod.rs Resolved
Comment thread compio-executor/src/task/state.rs Resolved
Comment thread compio-executor/src/task/remote.rs Resolved
Comment thread compio-executor/src/task/remote.rs Resolved
Comment thread .github/workflows/ci_test_executor.yml Resolved
Comment thread compio-executor/src/queue.rs Resolved
@George-Miao
George-Miao force-pushed the refactor/executor/v3 branch from 4fc96a4 to 2022236 Compare April 8, 2026 12:07
@George-Miao
George-Miao requested a review from Berrysoft April 8, 2026 12:08
@George-Miao
George-Miao force-pushed the refactor/executor/v3 branch from 2022236 to 79f4e3a Compare April 8, 2026 12:20
@George-Miao
George-Miao enabled auto-merge April 8, 2026 13:26

@Berrysoft Berrysoft left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I simplified the comments of my copilot.

Comment thread compio-executor/src/task/mod.rs Resolved
Comment thread compio-executor/src/task/mod.rs Resolved
Comment thread compio-executor/src/task/remote.rs Resolved
@George-Miao
George-Miao force-pushed the refactor/executor/v3 branch from 8d5394b to 257e1cc Compare April 9, 2026 02:31

@Berrysoft Berrysoft left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@George-Miao
George-Miao added this pull request to the merge queue Apr 9, 2026
Merged via the queue into compio-rs:master with commit 54e801c Apr 9, 2026
75 checks passed
@George-Miao
George-Miao deleted the refactor/executor/v3 branch April 9, 2026 02:56
@github-actions github-actions Bot mentioned this pull request Apr 7, 2026
@George-Miao George-Miao mentioned this pull request Apr 10, 2026
4 of 5 tasks
This was referenced Apr 21, 2026
@github-actions github-actions Bot mentioned this pull request Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change ci github action and other ci-related change package: executor Related to compio-executor refactor Refactoring existing code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants