1%default { "isrange":"0" } 2%verify "executed" 3%verify "unimplemented array type" 4 /* 5 * Create a new array with elements filled from registers. 6 * 7 * TODO: convert most of this into a common subroutine, shared with 8 * OP_FILLED_NEW_ARRAY.S. 9 */ 10 /* filled-new-array/jumbo {vCCCC..v(CCCC+BBBB-1)}, type@AAAAAAAA */ 11 12 LOAD_rSELF_methodClassDex(a3) # a3 <- pDvmDex 13 FETCH(a0, 1) # r0<- aaaa (lo) 14 FETCH(a1, 2) # r1<- AAAA (hi) 15 LOAD_base_offDvmDex_pResClasses(a3, a3) # a3 <- pDvmDex->pResClasses 16 sll a1,a1,16 17 or a1, a0, a1 # a1<- AAAAaaaa 18 LOAD_eas2(a0, a3, a1) # a0 <- resolved class 19 GET_OPA(rOBJ) # rOBJ <- AA or BA 20 EXPORT_PC() # need for resolve and alloc 21 # already resolved? 22 bnez a0, .L${opcode}_continue # yes, continue on 23 LOAD_rSELF_method(a3) # a3 <- self->method 24 li a2, 0 # a2 <- false 25 LOAD_base_offMethod_clazz(a0, a3) # a0 <- method->clazz 26 JAL(dvmResolveClass) # v0 <- call(clazz, ref) 27 move a0, v0 28 # got null? 29 beqz v0, common_exceptionThrown # yes, handle exception 30 b .L${opcode}_continue 31%break 32 33 /* 34 * On entry: 35 * a0 holds array class 36 * rOBJ holds AA or BA 37 */ 38.L${opcode}_continue: 39 LOAD_base_offClassObject_descriptor(a3, a0) # a3 <- arrayClass->descriptor 40 li a2, ALLOC_DONT_TRACK # a2 <- alloc flags 41 lbu rINST, 1(a3) # rINST <- descriptor[1] 42 FETCH(a1, 3) # a1<- BBBB (length) 43 seq t0, rINST, 'I' # array of ints? 44 seq t1, rINST, 'L' # array of objects? 45 or t0, t1 46 seq t1, rINST, '[' # array of arrays? 47 or t0, t1 48 move rBIX, a1 # save length in rBIX 49 beqz t0, .L${opcode}_notimpl # no, not handled yet 50 JAL(dvmAllocArrayByClass) # v0 <- call(arClass, length, flags) 51 # null return? 52 beqz v0, common_exceptionThrown # alloc failed, handle exception 53 54 FETCH(a1, 4) # a1 CCCC 55 sw v0, offThread_retval(rSELF) # retval.l <- new array 56 sw rINST, (offThread_retval+4)(rSELF) # retval.h <- type 57 addu a0, v0, offArrayObject_contents # a0 <- newArray->contents 58 subu rBIX, rBIX, 1 # length--, check for neg 59 FETCH_ADVANCE_INST(5) # advance to next instr, load rINST 60 bltz rBIX, 2f # was zero, bail 61 62 # copy values from registers into the array 63 # a0=array, a1=CCCC, t0=BBBB(length) 64 move t0, rBIX 65 EAS2(a2, rFP, a1) # a2 <- &fp[CCCC] 661: 67 lw a3, 0(a2) # a3 <- *a2++ 68 addu a2, 4 69 subu t0, t0, 1 # count-- 70 sw a3, (a0) # *contents++ = vX 71 addu a0, 4 72 bgez t0, 1b 73 742: 75 lw a0, offThread_retval(rSELF) # a0 <- object 76 lw a1, (offThread_retval+4)(rSELF) # a1 <- type 77 seq t1, a1, 'I' # Is int array? 78 bnez t1, 3f 79 lw a2, offThread_cardTable(rSELF) # a2 <- card table base 80 srl t3, a0, GC_CARD_SHIFT 81 addu t2, a2, t3 82 sb a2, (t2) 833: 84 GET_INST_OPCODE(t0) # ip <- opcode from rINST 85 GOTO_OPCODE(t0) # execute it 86 87 88 /* 89 * Throw an exception indicating that we have not implemented this 90 * mode of filled-new-array. 91 */ 92.L${opcode}_notimpl: 93 la a0, .LstrFilledNewArrayNotImpl 94 JAL(dvmThrowInternalError) 95 b common_exceptionThrown 96