ytliu
ytliu

Reputation: 589

In android dalvik invoke-xxx opcode, what if the argument size is more than 5

in the davik vm/mterp/out/InterpC-portable.cpp code, when interpret invokeMethod, I find it can only handle the case when count is less or equal than 5:

        switch (count) {
        case 5:
            outs[4] = GET_REGISTER(vsrc1 & 0x0f);
        case 4:
            outs[3] = GET_REGISTER(vdst >> 12);
        case 3:
            outs[2] = GET_REGISTER((vdst & 0x0f00) >> 8);
        case 2:
            outs[1] = GET_REGISTER((vdst & 0x00f0) >> 4);
        case 1:
            outs[0] = GET_REGISTER(vdst & 0x0f);
        default:
            ;
        }

then what about the case when the argument size is more than 5?

Upvotes: 1

Views: 177

Answers (1)

ytliu
ytliu

Reputation: 589

Sorry I miss something, that the senario I mentioned is the case of non-range call, there is a range call that I missed:

     */
    if (methodCallRange) {
        // could use memcpy or a "Duff's device"; most functions have
        // so few args it won't matter much
        assert(vsrc1 <= curMethod->outsSize);
        assert(vsrc1 == methodToCall->insSize);
        outs = OUTS_FROM_FP(fp, vsrc1);

        for (i = 0; i < vsrc1; i++)
            outs[i] = GET_REGISTER(vdst+i);

        ....

so it's handled here!

Upvotes: 1

Related Questions