public void AddHelpers() { var scope = new ScopeBlock(); var initBlock = new BasicBlock <IRInstrList>(1, new IRInstrList { new IRInstruction(IROpCode.RET) }); scope.Content.Add(initBlock); var retnBlock = new BasicBlock <IRInstrList>(0, new IRInstrList { new IRInstruction(IROpCode.VCALL, IRConstant.FromI4(this.rt.Descriptor.Runtime.VMCall[DarksVMCalls.EXIT])) }); scope.Content.Add(initBlock); this.CompileHelpers(this.methodINIT, scope); DarksVMMethodInfo info = this.rt.Descriptor.Data.LookupInfo(this.methodINIT); scope.ProcessBasicBlocks <ILInstrList>(block => { if (block.Id == 1) { this.AddHelper(null, this.methodINIT, (ILBlock)block); VMBlockKey blockKey = info.BlockKeys[block]; info.EntryKey = blockKey.EntryKey; info.ExitKey = blockKey.ExitKey; } this.rt.AddBlock(this.methodINIT, (ILBlock)block); }); }
private void AddHelper(DarksVMMethodInfo info, MethodDef method, ILBlock block) { var helperScope = new ScopeBlock(); block.Id = 0; helperScope.Content.Add(block); if (info != null) { var helperInfo = new DarksVMMethodInfo(); VMBlockKey keys = info.BlockKeys[block]; helperInfo.RootScope = helperScope; helperInfo.EntryKey = keys.EntryKey; helperInfo.ExitKey = keys.ExitKey; this.rt.Descriptor.Data.SetInfo(method, helperInfo); } this.rt.AddHelper(method, helperScope, block); }
public void Initialize(ILPostTransformer tr) { runtime = tr.Runtime; methodInfo = tr.Runtime.Descriptor.Data.LookupInfo(tr.Method); ComputeBlockKeys(tr.RootScope); }
public void Initialize(ILTransformer tr) { methodInfo = tr.VM.Data.LookupInfo(tr.Method); methodInfo.RootScope = tr.RootScope; tr.VM.Data.SetInfo(tr.Method, methodInfo); }