• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1%verify "executed"
2%verify "negative array length"
3%verify "allocation fails"
4    /*
5     * Allocate an array of objects, specified with the array class
6     * and a count.
7     *
8     * The verifier guarantees that this is an array class, so we don't
9     * check for it here.
10     */
11    /* new-array/jumbo vBBBB, vCCCC, class@AAAAAAAA */
12    movl    rSELF,%ecx
13    EXPORT_PC
14    movl    offThread_methodClassDex(%ecx),%ecx # ecx<- pDvmDex
15    movl    2(rPC),%eax                       # eax<- AAAAAAAA
16    movl    offDvmDex_pResClasses(%ecx),%ecx  # ecx<- pDvmDex->pResClasses
17    SPILL(rIBASE)
18    movl    (%ecx,%eax,4),%ecx                # ecx<- resolved class
19    movzwl  8(rPC),%eax                       # eax<- CCCC
20    GET_VREG_R %eax %eax                      # eax<- vCCCC (array length)
21    testl   %eax,%eax
22    js      common_errNegativeArraySize       # bail, passing len in eax
23    testl   %ecx,%ecx                         # already resolved?
24    jne     .L${opcode}_finish                # yes, fast path
25    /*
26     * Resolve class.  (This is an uncommon case.)
27     *  ecx holds class (null here)
28     *  eax holds array length (vCCCC)
29     */
30    movl    rSELF,%ecx
31    SPILL_TMP1(%eax)                   # save array length
32    movl    offThread_method(%ecx),%ecx  # ecx<- self->method
33    movl    2(rPC),%eax                # eax<- AAAAAAAA
34    movl    offMethod_clazz(%ecx),%ecx # ecx<- method->clazz
35    movl    %eax,OUT_ARG1(%esp)
36    movl    $$0,OUT_ARG2(%esp)
37    movl    %ecx,OUT_ARG0(%esp)
38    call    dvmResolveClass            # eax<- call(clazz,ref,flag)
39    movl    %eax,%ecx
40    UNSPILL_TMP1(%eax)
41    testl   %ecx,%ecx                  # successful resolution?
42    je      common_exceptionThrown     # no, bail.
43# fall through to ${opcode}_finish
44
45    /*
46     * Finish allocation
47     *
48     * ecx holds class
49     * eax holds array length (vCCCC)
50     */
51.L${opcode}_finish:
52    movl    %ecx,OUT_ARG0(%esp)
53    movl    %eax,OUT_ARG1(%esp)
54    movl    $$ALLOC_DONT_TRACK,OUT_ARG2(%esp)
55    call    dvmAllocArrayByClass    # eax<- call(clazz,length,flags)
56    UNSPILL(rIBASE)
57    FETCH_INST_OPCODE 5 %ecx
58    testl   %eax,%eax               # failed?
59    je      common_exceptionThrown  # yup - go handle
60    SET_VREG %eax rINST
61    ADVANCE_PC 5
62    GOTO_NEXT_R %ecx
63