jon.recoil.org

Module Mixed_product_bytes.Wrt_path

A path into a mixed block element (identifying some subelement) can be considered to partition the mixed block element into three parts: to the left, at subelement, and to the right.

This module counts the number of value and flat bytes in each part, for the purpose of computing block indices to the subelement. Also see jane/doc/extensions/_03-unboxed-types/03-block-indices.md.

Given an outer mixed block element, and a path into that as a list of positions, count value/flat bytes to the left, at, and to the right that subelement

val count_shape : Lambda.mixed_block_shape -> int -> int list -> Mixed_product_bytes.Wrt_path.t

Similar to the above, except for a mixed_block_shape (which corresponds to a boxed record, while a unit mixed_block_element corresponds to an unboxed record (within an array or boxed record).

type offset_and_gap_bytes = {
  1. offset_bytes : Mixed_product_bytes.Byte_count.t;
  2. gap_bytes : Mixed_product_bytes.Byte_count.t;
}

Compute the offset and gap in bytes for an index to here. Returns None if the index could lead to an "illegal" gap of 2^16 or greater bytes, which is the case if either:

  • An index to here would have an illegal gap.
  • Conservatively, whether an index to here could be deepened to have an illegal gap.