Adds an invariant check that chunk boundaries contain the proper number of instructions.
Fixes off-by-one errors in chunk counts due to not checking at end-of-loop, found by visual inspection (with a local view tool that prints instr counts; that will be committed later) and confirmed to break this new check without the fix in the tool.drcacheoff.invariant_checker test.
Issue: #5538