os.writeMOV(INTSIZE, Register.EBX, Register.EBX, ObjectLayout.TIB_SLOT * slotSize);  os.writeMOV(INTSIZE, Register.ESI, Register.EBX, (VmArray.DATA_OFFSET + TIBLayout.IMTCOLLISIONS_INDEX) * slotSize);  os.writeMOV(INTSIZE, Register.EAX, Register.ESI, Register.EDX, 1, VmArray.DATA_OFFSET * slotSize); os.writeTEST_AL(0xFF);  os.writeMOV(INTSIZE, Register.ESI, Register.EBX, (VmArray.DATA_OFFSET + TIBLayout.IMT_INDEX) * slotSize);  os.writeMOV(INTSIZE, Register.EBX, Register.ECX);
os.writeMOV(INTSIZE, Register.EBX, Register.EBX, tibOffset);  os.writeMOV(INTSIZE, Register.ESI, Register.EBX, arrayDataOffset + (TIBLayout.IMTCOLLISIONS_INDEX * slotSize));  os.writeMOV(INTSIZE, Register.EAX, Register.ESI, Register.EDX, 1, arrayDataOffset); os.writeTEST_AL(0xFF);  os.writeMOV(INTSIZE, Register.ESI, Register.EBX, arrayDataOffset + (TIBLayout.IMT_INDEX * slotSize));  os.writeMOV(INTSIZE, Register.EBX, Register.ECX);
    public final void visit_invokeinterface(VmConstIMethodRef methodRef,            int count) {        //TODO: port to orp-style        vstack.push(eContext);        methodRef.resolve(loader);        /*         * if (!methodRef.getConstClass().isResolved()) { Label startClassLabel =         * new Label(this.curInstrLabel + "startClass");         * os.setObjectRef(startClassLabel);         * resolveClass(methodRef.getConstClass()); patch_NOP(startClassLabel); }         *          * if (!methodRef.isResolved()) { Label startLabel = new         * Label(this.curInstrLabel + "start"); os.setObjectRef(startLabel);         * resolveMethod(methodRef); patch_NOP(startLabel);         */        final VmMethod method = methodRef.getResolvedVmMethod();        final int selector = method.getSelector();        final int imtIndex = selector % ObjectLayout.IMT_LENGTH;        final int argSlotCount = count - 1;        final Label noCollLabel = new Label(this.curInstrLabel + "NoCollision");        final Label findSelectorLabel = new Label(this.curInstrLabel                + "FindSelector");        final Label endLabel = new Label(this.curInstrLabel + "End");        // remove parameters from vstack        dropParameters(method, true);        // Get objectref -> EBX        os.writeMOV(INTSIZE, Register.EBX, SP, argSlotCount * slotSize);        /*         * // methodRef -> EDX os.writeMOV_Const(Register.EDX, methodRef); //         * methodRef.selector -> ecx os.writeMOV(INTSIZE, Register.ECX,         * Register.EDX,         * context.getVmConstIMethodRefSelectorField().getOffset()); //         * methodRef.selector -> eax os.writeMOV(INTSIZE, Register.EAX,         * Register.ECX); // Clear edx os.writeXOR(Register.EDX, Register.EDX); //         * IMT_LENGTH -> ESI os.writeMOV_Const(Register.ESI,         * ObjectLayout.IMT_LENGTH); // selector % IMT_LENGTH -> edx         */        os.writeMOV_Const(ECX, selector);        os.writeMOV_Const(EDX, imtIndex);        // Output: EBX=objectref, ECX=selector, EDX=imtIndex        /* objectref.TIB -> ebx */        os.writeMOV(INTSIZE, Register.EBX, Register.EBX, ObjectLayout.TIB_SLOT                * slotSize);        /* boolean[] imtCollisions -> esi */        os.writeMOV(INTSIZE, Register.ESI, Register.EBX,                (VmArray.DATA_OFFSET + TIBLayout.IMTCOLLISIONS_INDEX)                        * slotSize);        /* Has collision at imt[index] ? */        os.writeMOV(INTSIZE, Register.EAX, Register.ESI, Register.EDX, 1,                VmArray.DATA_OFFSET * slotSize);        os.writeTEST_AL(0xFF);        /* Object[] imt -> esi */        os.writeMOV(INTSIZE, Register.ESI, Register.EBX,                (VmArray.DATA_OFFSET + TIBLayout.IMT_INDEX) * slotSize);        /* selector -> ebx */        os.writeMOV(INTSIZE, Register.EBX, Register.ECX);        os.writeJCC(noCollLabel, X86Constants.JZ);        // We have a collision        /* imt[index] (=collisionList) -> esi */        os.writeMOV(INTSIZE, Register.ESI, Register.ESI, Register.EDX, 4,                VmArray.DATA_OFFSET * slotSize);        /* collisionList.length -> ecx */        os.writeMOV(INTSIZE, Register.ECX, Register.ESI, VmArray.LENGTH_OFFSET                * slotSize);        /* &collisionList[0] -> esi */        os.writeLEA(Register.ESI, Register.ESI, VmArray.DATA_OFFSET * slotSize);        os.setObjectRef(findSelectorLabel);        /* collisionList[index] -> eax */        os.writeLODSD();        /* collisionList[index].selector == selector? */        os.writeMOV(INTSIZE, Register.EDX, Register.EAX, context                .getVmMethodSelectorField().getOffset());        os.writeCMP(Register.EBX, Register.EDX);        os.writeJCC(endLabel, X86Constants.JE);        try {            os.writeLOOP(findSelectorLabel);        } catch (UnresolvedObjectRefException ex) {            throw new CompileError(ex);        }        /* Force a NPE further on */        os.writeXOR(Register.EAX, Register.EAX);        os.writeJMP(endLabel);        os.setObjectRef(noCollLabel);        /* imt[index] -> eax */        os.writeMOV(INTSIZE, Register.EAX, Register.ESI, Register.EDX, 4,                VmArray.DATA_OFFSET * slotSize);        os.setObjectRef(endLabel);        /** Now invoke the method */        helper.invokeJavaMethod(methodRef.getSignature());        // Result is already on the stack.    }