internal void UpdateStackSize(OpCode opcode, int stackchange) { this.m_maxMidStackCur += stackchange; if (this.m_maxMidStackCur > this.m_maxMidStack) { this.m_maxMidStack = this.m_maxMidStackCur; } else if (this.m_maxMidStackCur < 0) { this.m_maxMidStackCur = 0; } if (opcode.EndsUncondJmpBlk()) { this.m_maxStackSize += this.m_maxMidStack; this.m_maxMidStack = 0; this.m_maxMidStackCur = 0; } }
internal void UpdateStackSize(OpCode opcode, int stackchange) { // Updates internal variables for keeping track of the stack size // requirements for the function. stackchange specifies the amount // by which the stacksize needs to be updated. // Special case for the Return. Returns pops 1 if there is a // non-void return value. // Update the running stacksize. m_maxMidStack specifies the maximum // amount of stack required for the current basic block irrespective of // where you enter the block. m_maxMidStackCur += stackchange; if (m_maxMidStackCur > m_maxMidStack) m_maxMidStack = m_maxMidStackCur; else if (m_maxMidStackCur < 0) m_maxMidStackCur = 0; // If the current instruction signifies end of a basic, which basically // means an unconditional branch, add m_maxMidStack to m_maxStackSize. // m_maxStackSize will eventually be the sum of the stack requirements for // each basic block. if (opcode.EndsUncondJmpBlk()) { m_maxStackSize += m_maxMidStack; m_maxMidStack = 0; m_maxMidStackCur = 0; } }