Repository navigation
fix: correct loadOffset handling in generated overrides - #2487
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the loadOffset and entry-dispatch changes.
No open issues 🎉
What changed in this PR
This PR corrects loadOffset handling in Spice86’s C# override generator so duplicate entry records do not produce mismatched signatures and cyclic jumps resume at the correct entry.
Changes:
- Use unique entry points when selecting generated calls, delegates, interrupt handlers, and fault handlers.
- Reload
loadOffsetduring cyclic jumps only when the current method requires entry dispatch. - Extend the existing ASM regression scenario and behavioral assertions; refresh goldens and raise readability limits for the expanded fixture.
| File | Description |
|---|---|
tests/Spice86.Tests/Resources/GeneratedCodeReadability/partition_multi_entry_irreducible_shared.spec.json |
Updates the source hash and metric limits for the expanded fixture. |
tests/Spice86.Tests/Resources/cpuTests/res/GeneratedCode/partition_multi_entry_irreducible_shared.spec.cs.txt |
Refreshes generated overrides, cyclic dispatch, and DS memory accessors. |
tests/Spice86.Tests/Resources/cpuTests/res/DumpedListing/partition_multi_entry_irreducible_shared.txt |
Updates the expected instruction listing. |
tests/Spice86.Tests/Resources/cpuTests/res/DumpedCfgPartitions/partition_multi_entry_irreducible_shared.json |
Records expanded partitions, duplicate entry evidence, and cyclic transfers. |
tests/Spice86.Tests/Resources/cpuTests/res/DumpedCfgBlocks/partition_multi_entry_irreducible_shared.json |
Updates expected control-flow blocks and edges. |
tests/Spice86.Tests/Resources/cpuTests/asmsrc/partition_multi_entry_irreducible_shared.asm |
Adds cyclic resumption and shared-handler transfer scenarios. |
tests/Spice86.Tests/AsmFixtures/AsmFixtureCatalog.cs |
Checks cycle completion, secondary-entry resumption, and four handler executions. |
src/Spice86.Core/Emulator/ReverseEngineer/CfgCodeGeneration/TransferEmitter.cs |
Uses unique entry counts for transfers, function references, and fault handlers. |
src/Spice86.Core/Emulator/ReverseEngineer/CfgCodeGeneration/InstructionLowerer.cs |
Uses unique entry counts for interrupt-handler references. |
src/Spice86.Core/Emulator/ReverseEngineer/CfgCodeGeneration/CSharpStatementPrinter.cs |
Bases cyclic offset reloads on the current method’s dispatch requirement. |
src/Spice86.Core/Emulator/ReverseEngineer/CfgCodeGeneration/CSharpExpressionPrinter.cs |
Exposes the current method’s entry-dispatch requirement. |
src/Spice86.Core/Emulator/ReverseEngineer/CfgCodeGeneration/Ast/CyclicJumpNode.cs |
Clarifies source-versus-target entry semantics in documentation only. |
Review effort: Balanced
maximilien-noal
approved these changes
Nov 8, 2026
maximilien-noal
approved these changes
Nov 8, 2026
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.
Fix generated method signatures and cyclic jumps by counting unique entry points and checking the current method’s loadOffset requirement. Extend an existing ASM fixture to reproduce compilation failures and incorrect entry resumption.