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>array-length</title>
      7 <link rel=stylesheet href="opcode.css">
      8 </head>
      9 
     10 <body>
     11 
     12 <h1>array-length</h1>
     13 
     14 <h2>Purpose</h2>
     15 
     16 <p>
     17 Store in the given destination register the length of the indicated array,
     18 in entries.
     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>21 12x</td>
     34   <td>array-length vA, vB</td>
     35   <td><code>A:</code> destination register (4 bits)<br/>
     36     <code>B:</code> array reference-bearing register (4 bits)</td>
     37 </tr>
     38 </tbody>
     39 </table>
     40 
     41 <h2>Constraints</h2>
     42 
     43 <ul>
     44   <li>
     45     Both A and B must be valid register indices for the current stack frame.
     46   </li>
     47   <li>
     48     Register vB must contain a reference to an array.
     49   </li>
     50 </ul>
     51 
     52 <h2>Behavior</h2>
     53 
     54 <ul>
     55   <li>
     56     The length of the array referenced by vB is stored in vA, that is
     57     vA' = length(vB).
     58   </li>
     59   <li>
     60     If register v(A-1) is the lower half of a register pair, register v(A-1)'
     61     becomes undefined.
     62   </li>
     63   <li>
     64     If register v(A+1) is the upper half of a register pair, register v(A+1)'
     65     becomes undefined.
     66   </li>
     67 </ul>
     68 
     69 <h2>Exceptions</h2>
     70 
     71 <ul>
     72   <li>
     73     NullPointerException is thrown if the value of register vB is null.
     74   </li>
     75 </ul>
     76 
     77 </body>
     78 </html>
     79