//final int noLocals = bc.getNoLocals();
//final int noLocalVars = noLocals - noArgs;
final int count = bc.getNoExceptionHandlers();
CompiledExceptionHandler[] ceh = new CompiledExceptionHandler[count];
for (int i = 0; i < count; i++) {
final VmInterpretedExceptionHandler eh = bc.getExceptionHandler(i);
final Label handlerLabel = helper.genLabel("$$ex-handler" + i);
final ObjectRef handlerRef = os.setObjectRef(handlerLabel);
/** Clear the calculation stack (only locals are left) */
if (noLocalVars < 0) {
System.out.println("@#@#@#@# noLocalVars = " + noLocalVars);
}
final int ofs = Math.max(0, noLocalVars) * slotSize;
os.writeLEA(asp, abp, -ofs);
/** Push the exception in EAX */
os.writePUSH(aax);
/** Goto the real handler */
os.writeJMP(helper.getInstrLabel(eh.getHandlerPC()));
ceh[i] = new CompiledExceptionHandler();
ceh[i].setStartPc(os.getObjectRef(helper.getInstrLabel(eh
.getStartPC())));
ceh[i].setEndPc(os
.getObjectRef(helper.getInstrLabel(eh.getEndPC())));
ceh[i].setHandler(handlerRef);
}
cm.setExceptionHandlers(ceh);