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>new-instance</title> 7 <link rel=stylesheet href="opcode.css"> 8 </head> 9 10 <body> 11 12 <h1>new-instance</h1> 13 14 <h2>Purpose</h2> 15 16 <p> 17 Construct a new instance of the indicated type, storing a reference to it in the 18 destination. The type must refer to a non-array class. 19 </p> 20 21 <h2>Details</h2> 22 23 <table class="instruc"> 24 <thead> 25 <tr> 26 <th>Op & Format</th> 27 <th>Mnemonic / Syntax</th> 28 <th>Arguments</th> 29 </tr> 30 </thead> 31 <tbody> 32 <tr> 33 <td>22 21c</td> 34 <td>new-instance vAA, type@BBBB</td> 35 <td><code>A:</code> destination register (8 bits)<br/> 36 <code>B:</code> type index</td> 37 </tr> 38 </tbody> 39 </table> 40 41 <h2>Constraints</h2> 42 43 <ul> 44 <li> 45 A must be a valid register index for the current stack frame. 46 </li> 47 <li> 48 B must be a valid index into the type pool. 49 </li> 50 <li> 51 Type constant pool entry B must contain a valid type descriptor for a 52 non-array class. 53 </li> 54 </ul> 55 56 <h2>Behavior</h2> 57 58 <ul> 59 <li> 60 An attempt is made to get a reference to the class C the name of which is 61 contained in type pool entry B. 62 </li> 63 <li> 64 If C has not been loaded and resolved before, it is being loaded and 65 resolved. All exceptions that are possible during class loading can occur at 66 this point. 67 </li> 68 <li> 69 An attempt is made to create a new instance I of C. All exceptions that are 70 possible during instantiation can occur at this point. 71 </li> 72 <li> 73 A reference to the new instance is stored in register vA, that is vA' = I. 74 </li> 75 <li> 76 If v(A-1) is the lower part of a register pair, v(A-1)' becomes undefined. 77 </li> 78 <li> 79 If v(A+1) is the upper part of a register pair, v(A+1)' becomes undefined. 80 </li> 81 </ul> 82 83 <h2>Exceptions</h2> 84 85 <ul> 86 <li> 87 All exceptions that are possible during class loading can occur. 88 </li> 89 <li> 90 All exceptions that are possible during instantiation can occur. 91 </li> 92 </ul> 93 94 </body> 95 </html> 96