Skip to content

SPEC-VM-021 Step 1: Remove ProgramDispatch.origin and handler_continuation#372

Open
proboscis wants to merge 1 commit intomainfrom
vm-021-step1-remove-dispatch-copies
Open

SPEC-VM-021 Step 1: Remove ProgramDispatch.origin and handler_continuation#372
proboscis wants to merge 1 commit intomainfrom
vm-021-step1-remove-dispatch-copies

Conversation

@proboscis
Copy link
Copy Markdown
Owner

Summary

  • Removes origin: Continuation and handler_continuation: Continuation from ProgramDispatch, replacing them with plain fiber IDs and consumed flags
  • Eliminates clone_handle() usage for dispatch state — ProgramDispatch no longer stores Continuation copies that share Arc<AtomicBool> consumed tracking
  • Adds ProgramDispatch::origin_as_continuation() / handler_as_continuation() helpers to reconstruct view continuations from stored topology data when needed by existing APIs
  • Adds Continuation::from_ids() constructor and mark_dispatch_consumed_for_continuation() to keep dispatch consumed state in sync

This is Step 1 of SPEC-VM-021 (single-owner continuations). The key architectural change: ProgramDispatch stores plain data (Vec<FiberId> + bool) instead of Continuation objects. No shared ownership wrappers (Arc, AtomicBool) between dispatch state and real continuations.

Test plan

  • cargo check --features python_bridge — zero errors
  • cargo check --features python_bridge --all-targets — no new errors (3 pre-existing test compile errors)
  • Zero new warnings introduced
  • Python integration tests — pre-existing segfault on import blocks all Python tests on main

🤖 Generated with Claude Code

…ation

Replace Continuation copies in ProgramDispatch with stored fiber IDs and
consumed flags. This eliminates clone_handle() usage for dispatch state,
enforcing single-owner semantics for continuations.

Changes:
- ProgramDispatch.origin → origin_fiber_ids: Vec<FiberId> + origin_consumed: bool
- ProgramDispatch.handler_continuation → handler_fiber_ids: Vec<FiberId> +
  handler_cont_id: ContId + handler_consumed: bool
- Add ProgramDispatch::origin_as_continuation() and handler_as_continuation()
  helpers that reconstruct view continuations from stored IDs
- Add Continuation::from_ids() constructor for topology-only views
- Add mark_dispatch_consumed_for_continuation() to sync consumed state
- Replace all handler_dispatch_is_live(&dispatch.handler_continuation) calls
  with !dispatch.handler_consumed checks
- Update all ProgramDispatch construction sites and consumers

No shared Arc<AtomicBool> between ProgramDispatch and real continuations.
The dispatch stores plain data (fiber IDs + booleans), not Continuation copies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant