PHD array records
PHD array records can cover primitive arrays and object arrays.
Primitive array record
The primitive array
record contains:
- The 1 byte tag. The third bit (0x20) is set and the following
5 bits in descending order contain:
- 3 bits containing the array type. The array type values are:
0= bool1= char2= float3= double4= byte5= short6= int7= long
- 2 bits indicating the length of the array size and also the length
of the gap. These values apply:
0indicates abyte
.1indicates ashort
.2indicates anint
.3indicates along
.
- 3 bits containing the array type. The array type values are:
byte
,short
,int
orlong
containing the gap between the address of this object and the address of the preceding object. For more information, see the description in the short object record format.byte
,short
,int
orlong
containing the array length.- If all objects are hashed, a
short
containing the hashcode. - An unsigned
int
containing the size of the instance of the array on the heap, including header and padding. The size is measured in 32-bit words, which you can multiply by four to obtain the size in bytes. This format allows encoding of lengths up to 16GB in an unsignedint
. (PHD V6 and later)
Long primitive array record
The long primitive
array record is used when a primitive array has been hashed. The format
is:
- The 1 byte tag containing the value
7. - A
byte
containing flags, with these bits in descending order:- 3 bits containing the array type. For more information, see the description of the primitive array record.
- 1 bit indicating the length of the array size and also the length
of the gap. The range for this value includes:
0indicating abyte
.1indicating aword
.
- 2 unused bits.
- 1 bit indicating if the object was hashed and moved. If this bit is set, the record includes the hashcode.
- 1 bit indicating if the object was hashed.
- a
byte
orword
containing the gap between the address of this object and the address of the preceding object. For more information, see the description in the short object record format. - a
byte
orword
containing the array length. - If all objects are hashed, a
short
containing the hashcode. Otherwise, an optionalint
containing the hashcode if the hashed and moved bit is set in the record flag byte. - An unsigned
int
containing the size of the instance of the array on the heap, including header and padding. The size is measured in 32-bit words, which you can multiply by four to obtain the size in bytes. This format allows encoding of lengths up to 16GB in an unsignedint
. (PHD V6 and later)
Object array record
The object array record
format is:
- The 1 byte tag containing the value
5. - A
byte
containing flags with these bits in descending order:- 2 bits to indicate whether the gap is
byte
,short
,int
orlong
. - 2 bits indicating the size of each reference. For more information, see the description in the short record format.
- 2 unused bits.
- 1 bit indicating if the object was hashed and moved. If this bit is set, the record includes the hashcode.
- 1 bit indicating if the object was hashed.
- 2 bits to indicate whether the gap is
- A
byte
,short
,int
orlong
containing the gap between the address of this object and the address of the preceding object. For more information, see the description in the short record format. - A
word
containing the address of the class of the objects in the array. Object array records do not update the class cache. - If all objects are hashed, a
short
containing the hashcode. If the hashed and moved bit is set in the records flag, this field contains anint
. - An
int
containing the length of the array of references. - The array of references. For more information, see the description in the short record format.
- An unsigned
int
containing the size of the instance of the array on the heap, including header and padding. The size is measured in 32-bit words, which you can multiply by four to obtain the size in bytes. This format allows encoding of lengths up to 16GB in an unsignedint
(PHD V6 and later).
Object array record (revised) - from PHD version 5
This
array record is similar to the previous array record with two key
differences:
- The tag value is
8. - An extra
int
value is shown at the end. This int contains the true array length, shown as a number of array elements. The true array length might differ from the length of the array of references because null references are excluded.
This record type was added in PHD version 5.