I've actually simplified it further:

Code:
for( int i = 0;  mStageInstrCounter[WB_STAGE] < mCodeSize; i++ )
It is ok for i to become larger than the code size (this is a Mips simulator). And, the <= was correct at one point, but after changes my vectors to be consistent, the < is correct now.