Home | History | Annotate | Download | only in c
      1 HANDLE_OPCODE(OP_APUT_OBJECT /*vAA, vBB, vCC*/)
      2     {
      3         ArrayObject* arrayObj;
      4         Object* obj;
      5         u2 arrayInfo;
      6         EXPORT_PC();
      7         vdst = INST_AA(inst);       /* AA: source value */
      8         arrayInfo = FETCH(1);
      9         vsrc1 = arrayInfo & 0xff;   /* BB: array ptr */
     10         vsrc2 = arrayInfo >> 8;     /* CC: index */
     11         ILOGV("|aput%s v%d,v%d,v%d", "-object", vdst, vsrc1, vsrc2);
     12         arrayObj = (ArrayObject*) GET_REGISTER(vsrc1);
     13         if (!checkForNull((Object*) arrayObj))
     14             GOTO_exceptionThrown();
     15         if (GET_REGISTER(vsrc2) >= arrayObj->length) {
     16             dvmThrowArrayIndexOutOfBoundsException(
     17                 arrayObj->length, GET_REGISTER(vsrc2));
     18             GOTO_exceptionThrown();
     19         }
     20         obj = (Object*) GET_REGISTER(vdst);
     21         if (obj != NULL) {
     22             if (!checkForNull(obj))
     23                 GOTO_exceptionThrown();
     24             if (!dvmCanPutArrayElement(obj->clazz, arrayObj->clazz)) {
     25                 LOGV("Can't put a '%s'(%p) into array type='%s'(%p)",
     26                     obj->clazz->descriptor, obj,
     27                     arrayObj->obj.clazz->descriptor, arrayObj);
     28                 dvmThrowArrayStoreExceptionIncompatibleElement(obj->clazz, arrayObj->clazz);
     29                 GOTO_exceptionThrown();
     30             }
     31         }
     32         ILOGV("+ APUT[%d]=0x%08x", GET_REGISTER(vsrc2), GET_REGISTER(vdst));
     33         dvmSetObjectArrayElement(arrayObj,
     34                                  GET_REGISTER(vsrc2),
     35                                  (Object *)GET_REGISTER(vdst));
     36     }
     37     FINISH(2);
     38 OP_END
     39