Content deleted Content added
m →top: Fix determiners |
Added missing entries to Constant Pool table, as per already present reference. It was slightly inconsistent to list the full range of class file versions, but not all tag types for all these versions. |
||
Line 249:
The constant pool table is where most of the literal constant values are stored. This includes values such as numbers of all sorts, strings, identifier names, references to classes and methods, and type descriptors. All indexes, or references, to specific constants in the constant pool table are given by 16-bit (type u2) numbers, where index value 1 refers to the first constant in the table (index value 0 is invalid).
Due to historic choices made during the file format development, the number of constants in the constant pool table is not actually the same as the constant pool count which precedes the table. First, the table is indexed starting at 1 (rather than 0), but the count should actually be interpreted as the maximum index plus one.<ref name="jvms-4.4">http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.4</ref> Additionally, two types of constants (longs and doubles) take up two consecutive slots in the table, although the second such slot is a phantom index that is never directly used.
The type of each item (constant) in the constant pool is identified by an initial byte ''tag''. The number of bytes following this tag and their interpretation are then dependent upon the tag value. The valid constant types and their tag values are:
Line 302:
| 4 bytes
| Name and type descriptor: two indexes to UTF-8 strings within the constant pool, the first representing a name (identifier) and the second a specially encoded type descriptor.
|-
| 15
| 3 bytes
| Method handle: this structure is used to represent a method handle and consists of one byte of type descriptor, followed by an index within the constant pool.<ref name="jvms-4.4" />
|-
| 16
| 2 bytes
| Method type: this structure is used to represent a method type, and consists of an index within the constant pool.<ref name="jvms-4.4" />
|-
| 18
| 4 bytes
| InvokeDynamic: this is used by an ''invokedynamic'' instruction to specify a bootstrap method, the dynamic invocation name, the argument and return types of the call, and optionally, a sequence of additional constants called static arguments to the bootstrap method.<ref name="jvms-4.4" />
|}
|