void ProcessOneInstruction(Mono.Cecil.Cil.Instruction cilInst) { #if DEBUGDIAG var(stack1, stack2) = stackMap.FrameToString(); Console.WriteLine($"LOCALS [{stack1}] STACK [{stack2}]"); Console.WriteLine(cilInst); #endif int instructionsCount = code.Instructions.Count; code.SetLabel((ushort)cilInst.Offset); this.cilInst = cilInst; this.cilOp = cilInst.OpCode.Code; exceptions.CheckAndSaveFrame(cilInst); var genericMark = CilMain.GenericStack.Mark(); CallInstructionTranslator(); CilMain.GenericStack.Release(genericMark); while (instructionsCount < code.Instructions.Count) { var newInst = code.Instructions[instructionsCount++]; #if DEBUGDIAG newInst.Line = (ushort)(lineNumber != 0 ? lineNumber : cilInst.Offset); #else newInst.Line = (ushort)lineNumber; #endif } }
void Process(int numCastableInterfaces) { code = newMethod.Code = new JavaCode(newMethod); var oldLabel = code.SetLabel(0xFFFF); locals = new CodeLocals(method, defMethod, code); arrays = new CodeArrays(code, locals); exceptions = new CodeExceptions(defMethodBody, code, locals); InsertMethodInitCode(numCastableInterfaces); code.SetLabel(oldLabel); stackMap = code.StackMap; stackMap.SaveFrame(0, false, CilMain.Where); ProcessInstructions(); (code.MaxLocals, code.MaxStack) = locals.GetMaxLocalsAndStack(); locals.TrackUnconditionalBranch(null); }