final Label ok = new Label(curInstrLabel + "$$cbok");  assertCondition(ref.isRegister(), "ref must be in a register"); final Register r = ref.getRegister(); if (index.isConstant()) {   index.load(eContext); os.writeCMP(r, VmArray.LENGTH_OFFSET * slotSize, index .getRegister()); } else { os.writeCMP(r, VmArray.LENGTH_OFFSET * slotSize, index .getRegister()); } os.writeJCC(ok, X86Constants.JA);  os.writeINT(5); os.setObjectRef(ok); }
final Label ok = new Label(curInstrLabel + "$$cbok");  assertCondition(ref.isRegister(), "ref must be in a register"); final Register r = ref.getRegister(); if (index.isConstant()) { os.writeCMP_Const(r, arrayLengthOffset, index.getValue()); } else {  os.writeCMP(r, arrayLengthOffset, index.getRegister()); } os.writeJCC(ok, X86Constants.JA);  os.writeINT(5); os.setObjectRef(ok); }
    private final void checkBounds(RefItem ref, IntItem index) {        final Label ok = new Label(curInstrLabel + "$$cbok");        // CMP length, index        assertCondition(ref.isRegister(), "ref must be in a register");        final Register r = ref.getRegister();        if (index.isConstant()) {            //TODO: implement CMP dist[reg], imm32            // final int val = ((IntConstant)index.getConstant()).getValue();            index.load(eContext);            os.writeCMP(r, VmArray.LENGTH_OFFSET * slotSize, index                    .getRegister());        } else {            os.writeCMP(r, VmArray.LENGTH_OFFSET * slotSize, index                    .getRegister());        }        os.writeJCC(ok, X86Constants.JA);        // Signal ArrayIndexOutOfBounds        os.writeINT(5);        os.setObjectRef(ok);    }