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>aget&lt;kind&gt;</title>
      7 <link rel=stylesheet href="opcode.css">
      8 </head>
      9 
     10 <body>
     11 
     12 <h1>aget&lt;kind&gt;</h1>
     13 
     14 <h2>Purpose</h2>
     15 
     16 <p>
     17 Perform the identified array operation at the identified index of the given
     18 array, storing into the value register.
     19 </p>
     20 
     21 <h2>Details</h2>
     22 
     23 <table class="instruc">
     24 <thead>
     25 <tr>
     26   <th>Op &amp; Format</th>
     27   <th>Mnemonic / Syntax</th>
     28   <th>Arguments</th>
     29 </tr>
     30 </thead>
     31 <tbody>
     32 <tr>
     33   <td>44..51 23x</td>
     34   <td><i>arrayop</i> vAA, vBB, vCC<br/>
     35     44: aget<br/>
     36     45: aget-wide<br/>
     37     46: aget-object<br/>
     38     47: aget-boolean<br/>
     39     48: aget-byte<br/>
     40     49: aget-char<br/>
     41     4a: aget-short<br/>
     42   </td>
     43   <td><code>A:</code> dest value register or pair; (8 bits)<br/>
     44     <code>B:</code> array register (8 bits)<br/>
     45     <code>C:</code> index register (8 bits)</td>
     46 </tr>
     47 </tbody>
     48 </table>
     49 
     50 <h2>Constraints</h2>
     51 
     52 <ul>
     53   <li>
     54     A, B and C must be valid register indices in the current stackframe.
     55   </li>
     56   <li>
     57     For the aget-wide variant, also A+1 must be a valid register index in the
     58     current stackframe.
     59   </li>
     60   <li>
     61     Register vB must contain an array reference. The component type of the
     62     array must match the variant of the instruction.
     63   </li>
     64   <li>
     65     Register vC must contain an integer value.
     66   </li>
     67 </ul>
     68 
     69 <h2>Behavior</h2>
     70 
     71 <ul>
     72   <li>
     73     For all but the -wide variant, the array element at the given index is moved
     74     into register vA, that is, vA'=array[index].
     75   </li>
     76   <li>
     77     For the -wide variant, the array element at the given index is moved into
     78     registers vA and v(A+1) as follows:
     79     <ul>
     80       <li>
     81         vA'=array[index] >> 0x20
     82       </li>
     83       <li>
     84         v(A+1)'=array[index] & 0xffffffff;
     85       </li>
     86     </ul>
     87   </li>
     88   <li>
     89     If v(A-1) is the lower half of a register pair, v(A-1)' becomes undefined.
     90   </li>
     91   <li>
     92     For all but the -wide variant, if v(A+1) is the upper half of a register
     93     pair, v(A+1)' becomes undefined.
     94   </li>
     95   <li>
     96     For the -wide variant, if v(A+2) is the upper half of a register pair,
     97     v(A+2)' becomes undefined.
     98   </li>
     99 </ul>
    100 
    101 <h2>Exceptions</h2>
    102 
    103 <ul>
    104   <li>
    105     NullPointerException if vB=null.
    106   </li>
    107   <li>
    108     ArrayIndexOutOfBoundsException if vC < 0 or vC >= array.length.
    109   </li>
    110 </ul>
    111 
    112 </body>
    113 </html>
    114