1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-07-24 22:25:06 +00:00

Fix bug in inline JSR/JSL no-continue handling

JSR/JSL calls with inline data have the option of reporting that
they don't continue, which causes the code analyzer to treat them
as JMPs instead.  There was a bug that was causing the no-continue
flag to be lost in certain circumstances.

The code now explicitly records the plugin's response in an Anattrib
flag.  Test 2022-extension-scripts has been updated with a test case
that exercises this situation.
This commit is contained in:
Andy McFadden
2020-05-08 17:41:26 -07:00
parent 71af8bf117
commit 63d7a48705
11 changed files with 339 additions and 71 deletions

View File

@@ -690,11 +690,11 @@ namespace SourceGen {
}
}
if (!doContinue) {
mAnattribs[offset].DoesNotContinue = true;
mAnattribs[offset].NoContinue = !doContinue;
if (mAnattribs[offset].DoesNotContinue) {
// If we just decided not to continue, or an extension script set a flag
// on a previous visit, stop scanning forward.
break;
} else {
mAnattribs[offset].DoesNotContinue = false;
}
// Sanity check to avoid infinite loop.
@@ -710,14 +710,15 @@ namespace SourceGen {
break;
}
// On first visit, check for JSR/JSL inline call.
// On first visit, check for JSR/JSL inline call. If it's "no-continue",
// set a flag and halt here.
if (firstVisit) {
// Currently ignoring OpDef.OpJSR_AbsIndexXInd
if (op == OpDef.OpJSR_Abs || op == OpDef.OpJSR_AbsLong) {
bool noContinue = CheckForInlineCall(op, offset, false);
if (noContinue) {
LogD(offset, "Script declared inline call no-continue");
mAnattribs[offset].DoesNotContinue = true;
mAnattribs[offset].NoContinueScript = true;
break;
}
}