| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| |
| <html> |
| |
| <head> |
| <title>new-instance</title> |
| <link rel=stylesheet href="opcode.css"> |
| </head> |
| |
| <body> |
| |
| <h1>new-instance</h1> |
| |
| <h2>Purpose</h2> |
| |
| <p> |
| Construct a new instance of the indicated type, storing a reference to it in the |
| destination. The type must refer to a non-array class. |
| </p> |
| |
| <h2>Details</h2> |
| |
| <table class="instruc"> |
| <thead> |
| <tr> |
| <th>Op & Format</th> |
| <th>Mnemonic / Syntax</th> |
| <th>Arguments</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td>22 21c</td> |
| <td>new-instance vAA, type@BBBB</td> |
| <td><code>A:</code> destination register (8 bits)<br/> |
| <code>B:</code> type index</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2>Constraints</h2> |
| |
| <ul> |
| <li> |
| A must be a valid register index for the current stack frame. |
| </li> |
| <li> |
| B must be a valid index into the type pool. |
| </li> |
| <li> |
| Type constant pool entry B must contain a valid type descriptor for a |
| non-array class. |
| </li> |
| </ul> |
| |
| <h2>Behavior</h2> |
| |
| <ul> |
| <li> |
| An attempt is made to get a reference to the class C the name of which is |
| contained in type pool entry B. |
| </li> |
| <li> |
| If C has not been loaded and resolved before, it is being loaded and |
| resolved. All exceptions that are possible during class loading can occur at |
| this point. |
| </li> |
| <li> |
| An attempt is made to create a new instance I of C. All exceptions that are |
| possible during instantiation can occur at this point. |
| </li> |
| <li> |
| A reference to the new instance is stored in register vA, that is vA' = I. |
| </li> |
| <li> |
| If v(A-1) is the lower part of a register pair, v(A-1)' becomes undefined. |
| </li> |
| <li> |
| If v(A+1) is the upper part of a register pair, v(A+1)' becomes undefined. |
| </li> |
| </ul> |
| |
| <h2>Exceptions</h2> |
| |
| <ul> |
| <li> |
| All exceptions that are possible during class loading can occur. |
| </li> |
| <li> |
| All exceptions that are possible during instantiation can occur. |
| </li> |
| </ul> |
| |
| </body> |
| </html> |