Repository navigation
Conversation
Add `program::breakpoint` and `program::span` to the ExecutionState dialect. A breakpoint suspends the invocation after the instruction: execute/resume return Ok(()) with `is_paused()` set and the PC at the following instruction; the next resume continues from there. A paused invocation stays active, so start and `Loadable::replace_image` are rejected until it completes or is reset. `span` records a source span on the current frame, readable through `ExecutionState::span()`. Callee frames start at (0, 0, 0) and returning restores the caller's span. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues blocking the breakpoint suspension and per-frame source-span changes.
No open issues 🎉
What changed in this PR
Adds breakpoint suspension and per-frame source spans to the program dialect for program-image execution, replacing capabilities unavailable from the CPU in this mode.
Changes:
- Adds
breakpointwith pause/resume behavior and anis_paused()accessor, without changing runner return types. - Adds
spanrecording and inspection, with fresh spans for callees and restoration on return. - Documents the behavior and adds integration tests for pauses, re-entry rejection, reset, and span tracking.
| File | Description |
|---|---|
README.md |
Documents breakpoint and source-span behavior. |
crates/vihaco-stdlib/tests/execution_integration.rs |
Tests pause/resume, reset, re-entry rejection, and frame spans. |
crates/vihaco-stdlib/src/program/dialect.rs |
Defines Breakpoint and Span instructions. |
crates/vihaco-stdlib/src/loadable.rs |
Documents paused invocation restrictions and resumption. |
crates/vihaco-stdlib/src/execution_state/storage.rs |
Exposes pause/span accessors and clears pauses on start/reset. |
crates/vihaco-stdlib/src/execution_state/runner.rs |
Stops execution at breakpoints and clears pauses on resume. |
crates/vihaco-stdlib/src/execution_state/execution.rs |
Implements breakpoint and span instruction execution. |
crates/vihaco-stdlib/src/execution_state.rs |
Adds pause state with default and clone support. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
With
program-image-executionenabled, the CPU'sSpanandBreakpointinstructions are compiled out, andExecutionStatehad no replacement for them. This PR adds both to theprogramdialect.program::breakpointsuspends the invocation after the instruction.execute/resumereturnOk(())with the newExecutionState::is_paused()set, andpc()points at the following instruction. The nextresumeclears the pause and continues from there.start/executeandLoadable::replace_imageare rejected until it completes orreset()is called, which also clears the pause.program::span file start endrecords a source span on the current frame, readable throughExecutionState::span(). Callee frames start at(0, 0, 0)and returning restores the caller's span.The
execute/resumereturn types are unchanged (eyre::Result<()>), so this change is not breaking. Callers checkis_paused()to tell a breakpoint from completion.Test plan
crates/vihaco-stdlib/tests/execution_integration.rs: pause/resume at breakpoints, rejection of re-entry while paused, reset, and span recording and restoration across call/returncargo fmt --all -- --checkcargo clippyin the default andvihaco/program-image-executionconfigurationscargo test --workspace --all-targetsand--doccargo test --workspace --exclude vihaco-doctests --all-targets --features vihaco/program-image-execution: all pass except the trybuild fixturevihaco-runtime/tests/compile_fail/dialect/out-of-line.rs, which fails the same way onmain(unrelated to this PR)🤖 Generated with Claude Code