blob: 88076d84d29cb90183567e2bdaff386b1584cb16 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>instance-of</title>
<link rel=stylesheet href="opcode.css">
</head>
<body>
<h1>instance-of</h1>
<h2>Purpose</h2>
<p>
Store in the given destination register 1 if the indicated reference is an
instance of the given type, or 0 if not. The type must be a reference type (not
a primitive type).
</p>
<h2>Details</h2>
<table class="instruc">
<thead>
<tr>
<th>Op &amp; Format</th>
<th>Mnemonic / Syntax</th>
<th>Arguments</th>
</tr>
</thead>
<tbody>
<tr>
<td>20 22c</td>
<td>instance-of vA, vB, type@CCCC</td>
<td><code>A:</code> destination register (4 bits)<br/>
<code>B:</code> reference-bearing register (4 bits)<br/>
<code>C:</code> type index (16 bits)</td>
</tr>
</tbody>
</table>
<h2>Constraints</h2>
<ul>
<li>
Both A and B must be a valid register indices for the current stack frame.
</li>
<li>
Register vB must contain a reference value.
</li>
<li>
C must be a valid index into the type constant pool.
</li>
<li>
Type constant pool entry C must contain a valid type descriptor for a
reference type.
</li>
</ul>
<h2>Behavior</h2>
<ul>
<li>
An attempt is made to get a reference to the class K the name of which is
contained in type pool entry C.
</li>
<li>
If K 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>
The run-time type of the object reference vB is compared against K. The
register vA reflects the result:
<ul>
<li>
vA' = 1 if (and only if) vB is not null and vB is assignment compatible
with K according to the usual rules of the Java programming language.
</li>
<li>
vA' = 0 otherwise
</li>
</ul>
</li>
<li>
If v(A-1) is the lower half of a register pair, v(A-1)' becomes undefined.
</li>
<li>
If v(A+1) is the upper half of a register pair, v(A+1)' becomes undefined.
</li>
<h2>Exceptions</h2>
<p>
None.
</p>
</body>
</html>