Extract VM diagnostic handler
This commit is contained in:
@@ -214,6 +214,8 @@ execution, script-provider access, and shared lifecycle state remain in `Virtual
|
|||||||
`engine/Age.Engine/Vm/VirtualMachine.Values.cs` owns integer arithmetic, bitwise and comparison operations,
|
`engine/Age.Engine/Vm/VirtualMachine.Values.cs` owns integer arithmetic, bitwise and comparison operations,
|
||||||
string comparison/concatenation/conversion/move, native byte-length and CP932 operations, and the host-backed
|
string comparison/concatenation/conversion/move, native byte-length and CP932 operations, and the host-backed
|
||||||
fullwidth string editor; shared operand storage, addressing, and native-string encoding remain in the coordinator.
|
fullwidth string editor; shared operand storage, addressing, and native-string encoding remain in the coordinator.
|
||||||
|
`engine/Age.Engine/Vm/VirtualMachine.Diagnostics.cs` owns diagnostic value/newline accumulation and synchronous
|
||||||
|
show-and-clear opcode dispatch; shared diagnostic state and native-context formatting remain in the coordinator.
|
||||||
|
|
||||||
The disposable `build/page-map-<SCENE>.jsonl` files are produced by editor/development Godot runs and map
|
The disposable `build/page-map-<SCENE>.jsonl` files are produced by editor/development Godot runs and map
|
||||||
runtime ADV page ordinals to their authoritative script offsets for `tools/locate_page.py`. Packaged exports
|
runtime ADV page ordinals to their authoritative script offsets for `tools/locate_page.py`. Packaged exports
|
||||||
|
|||||||
@@ -728,6 +728,12 @@ do not mix mechanical moves with semantic changes.
|
|||||||
through guarded `StepValue`; shared operand storage, addressing, and native-string encoding remain in the
|
through guarded `StepValue`; shared operand storage, addressing, and native-string encoding remain in the
|
||||||
coordinator. Runtime validation remains green.
|
coordinator. Runtime validation remains green.
|
||||||
|
|
||||||
|
The seventeenth bounded `VirtualMachine.Step` extraction moved diagnostic operand/newline accumulation and
|
||||||
|
synchronous show-and-clear prompt dispatch into `engine/Age.Engine/Vm/VirtualMachine.Diagnostics.cs`. The
|
||||||
|
top-level dispatcher retains all labels and aliases at their existing positions and passes the complete
|
||||||
|
instruction through guarded `StepDiagnostic`; shared accumulator state and native-context formatting remain
|
||||||
|
in the coordinator. Runtime validation remains green.
|
||||||
|
|
||||||
**Gate:** no externally visible behavior or command changes; generated artifacts are byte-identical where
|
**Gate:** no externally visible behavior or command changes; generated artifacts are byte-identical where
|
||||||
deterministic, and the corresponding engine, Python, Godot, and corpus validations remain green after
|
deterministic, and the corresponding engine, Python, Godot, and corpus validations remain green after
|
||||||
each domain move.
|
each domain move.
|
||||||
@@ -1101,8 +1107,8 @@ Continue step 2 of the **codebase consolidation** maintenance slice: behavior-ne
|
|||||||
by the tracked launcher and layered validation driver. With the planned `Main`, `GodotAdvHost`, and `GfxState`
|
by the tracked launcher and layered validation driver. With the planned `Main`, `GodotAdvHost`, and `GfxState`
|
||||||
domains isolated and the audio, movie, surface/texture, retained-object, animation, presentation, ADV-text,
|
domains isolated and the audio, movie, surface/texture, retained-object, animation, presentation, ADV-text,
|
||||||
text-history, ADV-service, input, timing, persistence, and memory/collection `VirtualMachine.Step` families routed
|
text-history, ADV-service, input, timing, persistence, and memory/collection `VirtualMachine.Step` families routed
|
||||||
through domain handlers, with control-flow/coroutine, process/root-exit/cross-script lifecycle, and scalar and
|
through domain handlers, with control-flow/coroutine, process/root-exit/cross-script lifecycle, value, and
|
||||||
string-value dispatch now isolated as well, extract diagnostic accumulation and prompt dispatch next without
|
diagnostic dispatch now isolated as well, extract message-window and system-menu runtime settings
|
||||||
replacing the proven dispatcher or changing public types, commands, and generated output.
|
next without replacing the proven dispatcher or changing public types, commands, and generated output.
|
||||||
Concrete playthrough blockers may still preempt this bounded maintenance work; the consolidation effort does
|
Concrete playthrough blockers may still preempt this bounded maintenance work; the consolidation effort does
|
||||||
not replace Phase B gameplay validation or the open cross-platform gates.
|
not replace Phase B gameplay validation or the open cross-platform gates.
|
||||||
|
|||||||
29
engine/Age.Engine/Vm/VirtualMachine.Diagnostics.cs
Normal file
29
engine/Age.Engine/Vm/VirtualMachine.Diagnostics.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using Age.Engine.Model;
|
||||||
|
|
||||||
|
namespace Age.Engine.Vm;
|
||||||
|
|
||||||
|
public sealed partial class VirtualMachine
|
||||||
|
{
|
||||||
|
private int StepDiagnostic(string label, Instruction instruction, int pc)
|
||||||
|
{
|
||||||
|
IReadOnlyList<Operand> a = instruction.Args;
|
||||||
|
switch (label)
|
||||||
|
{
|
||||||
|
case "u00425790": // upstream ABI label
|
||||||
|
case "append-diagnostic-value": // 0x1b2: generic operand text -> EngineCtx accumulator
|
||||||
|
_diagnosticOutput.Append(FormatDiagnosticOperand(a[0]));
|
||||||
|
return pc + 1;
|
||||||
|
case "u004257D0": // upstream ABI label
|
||||||
|
case "append-diagnostic-newline": // 0x1b3: exact native CRLF bytes
|
||||||
|
_diagnosticOutput.Append("\r\n");
|
||||||
|
return pc + 1;
|
||||||
|
case "u004237C0": // upstream ABI label
|
||||||
|
case "show-and-clear-diagnostic": // 0x1b4: synchronous host prompt, then erase
|
||||||
|
_host.ShowDiagnosticMessage(BuildDiagnosticMessage(instruction));
|
||||||
|
_diagnosticOutput.Clear();
|
||||||
|
return pc + 1;
|
||||||
|
default:
|
||||||
|
throw new InvalidOperationException($"Non-diagnostic opcode routed to diagnostic handler: {label}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1244,17 +1244,11 @@ public sealed partial class VirtualMachine
|
|||||||
return StepValue(label, a, pc);
|
return StepValue(label, a, pc);
|
||||||
case "u00425790": // upstream ABI label
|
case "u00425790": // upstream ABI label
|
||||||
case "append-diagnostic-value": // 0x1b2: generic operand text -> EngineCtx accumulator
|
case "append-diagnostic-value": // 0x1b2: generic operand text -> EngineCtx accumulator
|
||||||
_diagnosticOutput.Append(FormatDiagnosticOperand(a[0]));
|
|
||||||
return pc + 1;
|
|
||||||
case "u004257D0": // upstream ABI label
|
case "u004257D0": // upstream ABI label
|
||||||
case "append-diagnostic-newline": // 0x1b3: exact native CRLF bytes
|
case "append-diagnostic-newline": // 0x1b3: exact native CRLF bytes
|
||||||
_diagnosticOutput.Append("\r\n");
|
|
||||||
return pc + 1;
|
|
||||||
case "u004237C0": // upstream ABI label
|
case "u004237C0": // upstream ABI label
|
||||||
case "show-and-clear-diagnostic": // 0x1b4: synchronous host prompt, then erase
|
case "show-and-clear-diagnostic": // 0x1b4: synchronous host prompt, then erase
|
||||||
_host.ShowDiagnosticMessage(BuildDiagnosticMessage(ins));
|
return StepDiagnostic(label, ins, pc);
|
||||||
_diagnosticOutput.Clear();
|
|
||||||
return pc + 1;
|
|
||||||
case "is-catalog-resource-unlocked":
|
case "is-catalog-resource-unlocked":
|
||||||
case "save-numbered-slot": // 0x19e
|
case "save-numbered-slot": // 0x19e
|
||||||
case "load-numbered-slot-data-only": // 0x19f
|
case "load-numbered-slot-data-only": // 0x19f
|
||||||
|
|||||||
Reference in New Issue
Block a user