illusion: ILLU-M7B RunChunk emission

This commit is contained in:
hermes-agent committed 2026-10-30 09:18:37 -09:00
1 parent d70a3c6a25
commit ac6a04e28f
2 files changed
+40 -7

No files matched your search

+5
View File
@@ -100,3 +100,8 @@ Chunk_Spike_Mover.g.cs(37,65): error CS1503: Argument 3: cannot convert from 'de
- `Ecs.cs` note: ILLU-M6's commit (`1078062`) exists only on its dispatch branch, not on `feat/illusion-layer-abi-4.2` in this worktree, so the M7A spike build borrowed that file uncommitted for compilation only. It is NOT staged in the M7A commit — M6's merge will supply it. (Flagging for the orchestrator: M6 shows complete but its file is unreachable from the feat branch.)
- Acceptance: `/tmp/m7a_spike` (cs1503 sources retargeted at this worktree's `managed/` projects): `Build succeeded. 0 Warning(s) 0 Error(s)` — CS1503 gone. The main-repo `build/spikes/cs1503` still fails because it references main-repo `managed/` (old generator + missing 4.2 bindings there); that is a spike-path artifact, not a generator defect.
- Emitted `Chunk_Spike_Mover.g.cs`: `ComponentSize`, `Faulted`, and `Register` blocks byte-match the §4.6 reference modulo whitespace (incl. `table->EngineSystemRegister(world, name, ids, access, 2u, fn, userData)` and `Spike.Mover\0` name); `RunChunk` signature matches, body inert by design (`_ = view; _ = dt;`) — full body is M7B's problem.
## M7B RunChunk emission (ILLU-M7B)
- Replaced the M7A inert `EmitChunkRunner` stub with the doc body (`IMPLEMENTATION_PROMPT.md:2679-2732`): unrunnable guard keeps `_ = view; _ = dt;`, runnable path emits `count`/`TermCount`/`s_faulted` guard, per-term `Span`/`ReadOnlySpan` unpacking (`col0` self type via `selfFqn`), `try`/`for` row loop `col0[i].Tick(...)` with `RowArgs`, `catch (Exception)` latching `Volatile.Write(ref s_faulted, 1)`.
- `managed/Engine.Analyzers/ComponentSystemGenerator.cs` is byte-identical to the doc fence (`2076..2809`); `dotnet build Engine.slnx -c Release`: `Build succeeded. 0 Warning(s) 0 Error(s)` (CS0649 gone — latch now written).
- `dotnet build build/spikes/cs1503` (copied into this worktree so refs resolve): `Build succeeded. 0 Warning(s) 0 Error(s)`. Emitted `Chunk_Spike_Mover.g.cs` is byte-identical to the §4.6 reference (`:154-235`) modulo the Roslyn BOM; contains `table->EngineSystemRegister(world, name, ids, access, 2u, fn, userData)` and `col0[i].Tick(ref col0[i], in col1[i], dt);`.
@@ -601,10 +601,6 @@ public sealed class ComponentSystemGenerator : IIncrementalGenerator
return string.Join(".", parts);
}
// M7A split note: the RunChunk span-unpacking/row-loop body is owned
// by ILLU-M7B (ComponentParams/RowArgs helpers above are already in). This inert stub
// keeps the M7A half compiling with the stable ABI 4.2 signature so the
// Register emission (the CS1503 fix) is verifiable on its own.
private static void EmitChunkRunner(StringBuilder sb, SystemSpec spec, TickSignatureSnapshot tick, string selfFqn)
{
var phases = tick.PhaseNames.Length != 0
@@ -622,8 +618,41 @@ public sealed class ComponentSystemGenerator : IIncrementalGenerator
sb.AppendLine(" [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]");
sb.AppendLine(" public static unsafe void RunChunk(NativeApi.EngineChunkColumns* view, float dt)");
sb.AppendLine(" {");
sb.AppendLine(" _ = view;");
sb.AppendLine(" _ = dt;");
if (!IsRunnable(tick, selfFqn))
{
// Never bound (Register returned -2): keep the body inert.
sb.AppendLine(" _ = view;");
sb.AppendLine(" _ = dt;");
sb.AppendLine(" }");
return;
}
var components = ComponentParams(tick);
sb.AppendLine(" int count = view->Count;");
sb.AppendLine($" if (count <= 0 || view->TermCount != {components.Count} || global::System.Threading.Volatile.Read(ref s_faulted) != 0)");
sb.AppendLine(" {");
sb.AppendLine(" return;");
sb.AppendLine(" }");
sb.AppendLine();
for (var k = 0; k < components.Count; k++)
{
var p = components[k];
var spanKind = p.RefKind == TickRefKind.In ? "ReadOnlySpan" : "Span";
var elemType = k == 0 ? selfFqn : p.TypeName;
sb.AppendLine($" var col{k} = new {spanKind}<{elemType}>((void*)view->Columns[{k}], count);");
}
sb.AppendLine(" try");
sb.AppendLine(" {");
sb.AppendLine(" for (int i = 0; i < count; i++)");
sb.AppendLine(" {");
sb.AppendLine($" col0[i].Tick({string.Join(", ", RowArgs(tick))});");
sb.AppendLine(" }");
sb.AppendLine(" }");
sb.AppendLine(" catch (global::System.Exception)");
sb.AppendLine(" {");
sb.AppendLine(" global::System.Threading.Volatile.Write(ref s_faulted, 1);");
sb.AppendLine(" }");
sb.AppendLine(" }");
}
@@ -663,7 +692,6 @@ public sealed class ComponentSystemGenerator : IIncrementalGenerator
}
}
private static bool IsRunnable(TickSignatureSnapshot tick, string selfFqn)
{
var components = new List<TickParameterSnapshot>();