The CONSTANT_Long_info and CONSTANT_Double_info represent 8-byte numeric (long and double) constants:
CONSTANT_Long_info {
u1 tag;
u4 high_bytes;
u4 low_bytes;
}
CONSTANT_Double_info {
u1 tag;
u4 high_bytes;
u4 low_bytes;
}
All 8-byte constants take up two entries in the constant_pool table of the class file. If a CONSTANT_Long_info or CONSTANT_Double_info structure is the entry at index n in the constant_pool table, then the next usable entry in the table is located at index n+2. The constant_pool index n+1 must be valid but is considered unusable.
In retrospect, making 8-byte constants take two constant pool entries was a poor choice.
The items of these structures are as follows:
-
tag
The
tagitem of theCONSTANT_Long_infostructure has the valueCONSTANT_Long(5).The
tagitem of theCONSTANT_Double_infostructure has the valueCONSTANT_Double(6). -
high_bytes, low_bytes
The unsigned
high_bytesandlow_bytesitems of theCONSTANT_Long_infostructure together represent the value of thelongconstant((long) high_bytes << 32) + low_byteswhere the bytes of each of
high_bytesandlow_bytesare stored in big-endian (high byte first) order.The
high_bytesandlow_bytesitems of theCONSTANT_Double_infostructure together represent thedoublevalue in IEEE 754 floating-point double format (§2.3.2). The bytes of each item are stored in big-endian (high byte first) order.The value represented by the
CONSTANT_Double_infostructure is determined as follows. Thehigh_bytesandlow_bytesitems are converted into thelongconstant bits, which is equal to((long) high_bytes << 32) + low_bytesThen:
-
If bits is
0x7ff0000000000000L, thedoublevalue will be positive infinity. -
If bits is
0xfff0000000000000L, thedoublevalue will be negative infinity. -
If bits is in the range
0x7ff0000000000001Lthrough0x7fffffffffffffffLor in the range0xfff0000000000001Lthrough0xffffffffffffffffL, the double value will be NaN. -
In all other cases, let
s,e, andmbe three values that might be computed from bits:int s = ((bits >> 63) == 0) ? 1 : -1; int e = (int)((bits >> 52) & 0x7ffL); long m = (e == 0) ? (bits & 0xfffffffffffffL) << 1 : (bits & 0xfffffffffffffL) | 0x10000000000000L;
Then the floating-point value equals the
doublevalue of the mathematical expressions · m · 2^{e-1075}. -