private void PlugMethod() { var plugMethod = Compiler.PlugSystem.GetReplacement(Method); if (plugMethod == null) { return; } MethodData.ReplacedBy = plugMethod; Compiler.MethodScanner.MethodInvoked(plugMethod, Method); IsMethodPlugged = true; IsCILStream = false; IsExecutePipeline = false; IsStackFrameRequired = false; if (NotifyTraceLogHandler != null) { var traceLog = new TraceLog(TraceType.MethodInstructions, Method, "XX-Plugged Method", MethodData.Version); traceLog?.Log($"Plugged by {plugMethod.FullName}"); NotifyTraceLogHandler.Invoke(traceLog); } }
public static void Run(string stage, MosaMethod method, BasicBlocks basicBlocks, int version, NotifyTraceLogHandler handler) { var traceLog = new TraceLog(TraceType.MethodInstructions, method, stage, version); traceLog?.Log($"{method.FullName} [v{version}] after stage {stage}:"); traceLog?.Log(); if (basicBlocks.Count > 0) { foreach (var block in basicBlocks) { traceLog?.Log($"Block #{block.Sequence} - Label L_{block.Label:X5}" + (block.IsHeadBlock ? " [Header]" : string.Empty)); traceLog?.Log($" Prev: {ListBlocks(block.PreviousBlocks)}"); LogInstructions(traceLog, block.First); traceLog?.Log($" Next: {ListBlocks(block.NextBlocks)}"); traceLog?.Log(); } } else { traceLog?.Log("No instructions."); } handler.Invoke(traceLog); }