2 %verify "negative array length"
3 %verify "allocation fails"
5 * Allocate an array of objects, specified with the array class
8 * The verifier guarantees that this is an array class, so we don't
11 /* new-array/jumbo vBBBB, vCCCC, class@AAAAAAAA */
12 FETCH(a2, 1) # a2<- aaaa (lo)
13 FETCH(a3, 2) # a3<- AAAA (hi)
14 FETCH(a0, 4) # a0<- vCCCC
16 or a2, a2, a3 # a2<- AAAAaaaa
18 LOAD_rSELF_methodClassDex(a3) # a3 <- pDvmDex
19 GET_VREG(a1, a0) # a1 <- vCCCC (array length)
20 LOAD_base_offDvmDex_pResClasses(a3, a3) # a3 <- pDvmDex->pResClasses
21 LOAD_eas2(a0, a3, a2) # a0 <- resolved class
23 bltz a1, common_errNegativeArraySize # negative length, bail - len in a1
24 EXPORT_PC() # req'd for resolve, alloc
26 beqz a0, .L${opcode}_resolve # not resolved,
34 * a1 holds array length
37 li a2, ALLOC_DONT_TRACK # don't track in local refs table
38 JAL(dvmAllocArrayByClass) # v0 <- call(clazz, length, flags)
39 FETCH(a2, 3) # r2<- vBBBB
41 beqz v0, common_exceptionThrown # yes, handle the exception
42 FETCH_ADVANCE_INST(5) # advance rPC, load rINST
43 GET_INST_OPCODE(t0) # extract opcode from rINST
44 SET_VREG(v0, a2) # vBBBB <- v0
45 GOTO_OPCODE(t0) # jump to next instruction
51 * Resolve class. (This is an uncommon case.)
53 * a1 holds array length
54 * a2 holds class ref AAAAAAAA
57 LOAD_rSELF_method(a3) # a3 <- self->method
58 move rOBJ, a1 # rOBJ <- length (save)
59 move a1, a2 # a1 <- AAAAAAAA
60 li a2, 0 # a2 <- false
61 LOAD_base_offMethod_clazz(a0, a3) # a0 <- method->clazz
62 JAL(dvmResolveClass) # v0 <- call(clazz, ref)
63 move a1, rOBJ # a1 <- length (restore)
65 beqz v0, common_exceptionThrown # yes, handle exception
67 b .L${opcode}_finish # continue with to ${opcode}_finish