HANDLE_OPCODE(OP_APUT_OBJECT)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 dvmThrowException("Ljava/lang/ArrayIndexOutOfBoundsException;",
17 NULL);
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->obj.clazz)) {
25 LOGV("Can't put a '%s'(%p) into array type='%s'(%p)\n",
26 obj->clazz->descriptor, obj,
27 arrayObj->obj.clazz->descriptor, arrayObj);
28 //dvmDumpClass(obj->clazz);
29 //dvmDumpClass(arrayObj->obj.clazz);
30 dvmThrowException("Ljava/lang/ArrayStoreException;", NULL);
31 GOTO_exceptionThrown();
32 }
33 }
34 ILOGV("+ APUT[%d]=0x%08x", GET_REGISTER(vsrc2), GET_REGISTER(vdst));
35 ((u4*) arrayObj->contents)[GET_REGISTER(vsrc2)] =
36 GET_REGISTER(vdst);
37 }
38 FINISH(2);
39 OP_END
40