private void ScheduleInterfaces(MosaType type) { if (type.Interfaces.Count == 0) { return; } // find all interfaces methods for this type foreach (var itype in type.Interfaces) { if (!invokedInteraceTypes.Contains(itype)) { continue; } var imethods = TypeLayout.GetInterfaceTable(type, itype); var list = interfaceSlots.Get(itype); foreach (var slot in list) { var imethod = imethods[slot]; ScheduleMethod(imethod); } } }
private void ProcessBlock(BasicBlock block) { MainTrace?.Log($"Process Block: {block}"); // if the block has only one successor block, add successor block to executed block list if (block.NextBlocks.Count == 1) { AddExecutionBlock(block.NextBlocks[0]); } ProcessInstructionsContinuiously(block.First); // re-analyze phi statements var phiUse = phiStatements.Get(block); if (phiUse == null) { return; } foreach (var index in phiUse) { AddInstruction(index); } }
public Node GetFirstByKey(string key, string type) { var nodes = lookupByKey.Get(key); if (nodes == null) { return(null); } foreach (var node in nodes) { if (node.Type == type) { return(node); } } return(null); }
public ulong GetFirstSymbolByName(string name) { var sublist = SymbolNameLookup.Get(name); if (sublist == null) { return(0); } return(sublist[0].Address); }
private void UpdateBlockProtectInstructions() { foreach (var block in BasicBlocks) { var context = new Context(block.Last); while (context.IsEmpty || context.IsBlockEndInstruction || context.Instruction == IRInstruction.Flow) { context.GotoPrevious(); } if (context.Instruction is EndFinallyInstruction) { context.SetInstruction(IRInstruction.FinallyEnd); var entry = FindFinallyHandler(context.Node); var list = returns.Get(entry); if (list == null) { return; } context.AppendInstruction(IRInstruction.FinallyReturn); foreach (var returnBlock in list) { context.AddBranchTarget(returnBlock); } } else if (context.Instruction is LeaveInstruction) { // Find enclosing finally clause bool createLink = false; var entry = FindImmediateExceptionHandler(context.Node); if (entry != null) { if (entry.IsLabelWithinTry(context.Label)) { createLink = true; } } if (createLink) { var tryFinallyBlock = context.BranchTargets[0]; returns.Add(entry, tryFinallyBlock); context.SetInstruction(IRInstruction.TryEnd); if (entry.HandlerType == ExceptionHandlerType.Finally) { var finallyBlock = BasicBlocks.GetByLabel(entry.HandlerStart); context.AppendInstruction(IRInstruction.CallFinally, finallyBlock, tryFinallyBlock); } else { context.AppendInstruction(IRInstruction.Jmp, tryFinallyBlock); } //Debug.Assert(context.BasicBlock.NextBlocks.Count <= 1); } else { context.ReplaceInstructionOnly(IRInstruction.ExceptionEnd); } } } }
public List <SourceInfo> GetSources(int methodID) { return(SourceLookup.Get(methodID)); }
public List <SourceLabelInfo> GetSourceLabels(int methodID) { return(SourceLabelLookup.Get(methodID)); }
public List <Node> GetNodesOfValueType(string type) { return(lookupByType.Get(type)); }