Home | History | Annotate | Download | only in opcodes
      1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      2 
      3 <html>
      4 
      5 <head>
      6 <title>filled-new-array</title>
      7 <link rel=stylesheet href="opcode.css">
      8 </head>
      9 
     10 <body>
     11 
     12 <h1>filled-new-array</h1>
     13 
     14 <h2>Purpose</h2>
     15 
     16 <p>
     17 Construct an array of the given type and size, filling it with the supplied
     18 contents. The type must be an array type. The array's contents must be
     19 single-word (that is, no arrays of long or double). The constructed instance is
     20 stored as a "result" in the same way that the method invocation instructions
     21 store their results, so the constructed instance must be moved to a register
     22 with a subsequent move-result-object instruction (if it is to be used).
     23 </p>
     24 
     25 <h2>Details</h2>
     26 
     27 <table class="instruc">
     28 <thead>
     29 <tr>
     30   <th>Op &amp; Format</th>
     31   <th>Mnemonic / Syntax</th>
     32   <th>Arguments</th>
     33 </tr>
     34 </thead>
     35 <tbody>
     36 <tr>
     37   <td>24 35c</td>
     38   <td>filled-new-array {vD, vE, vF, vG, vA}, type@CCCC</td>
     39   <td><code>B:</code> array size and argument word count (4 bits)<br/>
     40     <code>C:</code> type index (16 bits)<br/>
     41     <code>D..G, A:</code> argument registers (4 bits each)</td>
     42 </tr>
     43 </tbody>
     44 </table>
     45 
     46 <h2>Constraints</h2>
     47 
     48 <ul>
     49   <li>
     50     The value B must not be greater than 5.
     51   </li>
     52   <li>
     53     If B > 0, then D must be a valid register index in the current stack frame.
     54   </li>
     55   <li>
     56     If B > 1, then E must be a valid register index in the current stack frame.
     57   </li>
     58   <li>
     59     If B > 2, then F must be a valid register index in the current stack frame.
     60   </li>
     61   <li>
     62     If B > 3, then G must be a valid register index in the current stack frame.
     63   </li>
     64   <li>
     65     If B > 4, then A must be a valid register index in the current stack frame.
     66   </li>
     67   <li>
     68     C must be a valid index into the type pool.
     69   </li>
     70   <li>
     71     The type denoted by C must be a valid array type descriptor.
     72   </li>
     73   <li>
     74     The element size of the type denoted by C must be no larger than 32 bits.
     75   </li>
     76   <li>
     77     If the element type is a primitive type, then all actual arguments
     78     (vD .. vA, depending on B) must be primitive, too.
     79   </li>
     80   <li>
     81     If the element type is a reference type, then all actual arguments
     82     (vD .. vA, depending on B) must be references, too.
     83   </li>
     84 </ul>
     85 
     86 <h2>Behavior</h2>
     87 
     88 <ul>
     89   <li>
     90     An attempt is made to get a reference to the type T the name of which is
     91     contained in type pool entry C.
     92   </li>
     93   <li>
     94     If T is a reference type and it has not been loaded and resolved before, it
     95     is being loaded and resolved. All exceptions that are possible during class
     96     loading can occur at this point.
     97   </li>
     98   <li>
     99     An attempt is made to create a new array R of type T and length B. All
    100     exceptions that are possible during instantiation can occur at this point.
    101   </li>
    102   <li>
    103     The elements of R are filled according to the following rules:
    104     <ul>
    105       <li>
    106         If B > 0 then R[0] = vD
    107       </li>
    108       <li>
    109         If B > 1 then R[1] = vE
    110       </li>
    111       <li>
    112         If B > 2 then R[2] = vF
    113       </li>
    114       <li>
    115         If B > 3 then R[3] = vG
    116       </li>
    117       <li>
    118         If B > 4 then R[4] = vA
    119       </li>
    120     </ul>
    121   </li>
    122   <li>
    123     No reference to R is stored in any register. Instead, R can be accessed by a
    124     move-result-object instruction immediately following this filled-new-array
    125     instruction.
    126   </li>
    127 </ul>
    128 
    129 <h2>Exceptions</h2>
    130 
    131 <ul>
    132   <li>
    133     NegativeArraySizeException if vB < 0
    134   </li>
    135   <li>
    136     All exceptions that are possible during class loading can occur.
    137   </li>
    138   <li>
    139     All exceptions that are possible during instantiation can occur.
    140   </li>
    141 </ul>
    142 
    143 </body>
    144 </html>
    145