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 = bool
      • 1 = char
      • 2 = float
      • 3 = double
      • 4 = byte
      • 5 = short
      • 6 = int
      • 7 = long
    • 2 bits indicating the length of the array size and also the length of the gap. These values apply:
      • 0 indicates a byte.
      • 1 indicates a short.
      • 2 indicates an int.
      • 3 indicates a long.
  • byte, short, int or long 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 or long 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 unsigned int. (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:
      • 0 indicating a byte.
      • 1 indicating a word.
    • 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 or word 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 or word containing the array length.
  • If all objects are hashed, a short containing the hashcode. Otherwise, an optional int 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 unsigned int. (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 or long.
    • 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.
  • A byte, short, int or long 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 an int.
  • 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 unsigned int (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:
  1. The tag value is 8.
  2. 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.