1HANDLE_OPCODE(OP_NEW_INSTANCE /*vAA, class@BBBB*/)
2    {
3        ClassObject* clazz;
4        Object* newObj;
5
6        EXPORT_PC();
7
8        vdst = INST_AA(inst);
9        ref = FETCH(1);
10        ILOGV("|new-instance v%d,class@0x%04x", vdst, ref);
11        clazz = dvmDexGetResolvedClass(methodClassDex, ref);
12        if (clazz == NULL) {
13            clazz = dvmResolveClass(curMethod->clazz, ref, false);
14            if (clazz == NULL)
15                GOTO_exceptionThrown();
16        }
17
18        if (!dvmIsClassInitialized(clazz) && !dvmInitClass(clazz))
19            GOTO_exceptionThrown();
20
21        /*
22         * Verifier now tests for interface/abstract class.
23         */
24        //if (dvmIsInterfaceClass(clazz) || dvmIsAbstractClass(clazz)) {
25        //    dvmThrowExceptionWithClassMessage("Ljava/lang/InstantiationError;",
26        //        clazz->descriptor);
27        //    GOTO_exceptionThrown();
28        //}
29        newObj = dvmAllocObject(clazz, ALLOC_DONT_TRACK);
30        if (newObj == NULL)
31            GOTO_exceptionThrown();
32        SET_REGISTER(vdst, (u4) newObj);
33    }
34    FINISH(2);
35OP_END
36