This introduces a debugging data formatter for RigidArray using a new feature of LLDB:
[Formatter Bytecode][1]. The scope of this PR is a single initial data type, with the
short and long term plan being to support all types vended by Swift Collections.
The bytecode for this implementation is produced using a Python -> Formatter Bytecode
compiler, contained in the [`formatter_bytecode`][2] module.
The workflow for authoring and shipping the formatter is:
1. Update RigidArray.py as needed
2. Compile RigidArray.py to RigidArray+Formatter.swift (again, `formatter_bytecode`)
3. Compile RigidArray+Formatter.swift as part of the BasicContainers module
By including the bytecode in the binary, lldb can load RigidArray's data formatter
automatically, without any friction that comes with installation, setup, config,
updating, or versioning.
[1]: https://lldb.llvm.org/resources/formatterbytecode.html
[2]: https://github.com/llvm/llvm-project/blob/main/lldb/examples/python/formatter_bytecode.py
DocC keeps changing its link syntax. The latest iteration appears to have trouble dealing with `Self`-taking or `Self`-returning methods, so change our API to replace `Self` with a direct mention of the concrete type. ¯\\\_(ツ)\_/¯
That said, the new compiler also found a large number of mismatching parameter names, and that was really helpful.
- Fix issues with the main package no longer exposing internal helper functions
- Move Rust benchmarks behind an EnableRustBenchmarks trait
- Allow traits to be enabled in `Utils/run-benchmarks.sh` through the BENCHMARK_TRAITS environment variable.
- Switch to using `ManagedBuffer` to represent node storage. This has
useful performance benefits, but it significantly complicates access
to node data. We no longer have direct access to the underlying raw
storage: everything needs to go through closures passed to
`ManagedBuffer.withUnsafeMutablePointers`.
- Introduce `struct _Node` and `struct _Node.UnsafeHandle` to
represent a (strong) reference to a hash tree node, and a
convenient handle for node storage, respectively. Use these instead
of directly accessing the ManagedBuffer object, whenever feasible.
- Implement separate paths for in-place mutations vs copy-on-write
operation, optimizing both flavors.
- Go to great lengths to eliminate unnecessary retain-release traffic,
whenever possible.
- Push subtree counts into parent nodes by moving the corresponding
field from the node header into the `_Node` struct. (This results in
a cool ~20x speedup for jumping around in the tree by integer
offsets.)
- Implement a type-punned empty root singleton, to allow creating
empty trees without allocating anything.
These provide nicer tools for slicing up hash values and dealing with node bitmaps.
_Bucket is a logical entry in the hash table inside a node.
_Bitmap is a set of bucket values, represented by a bitset.
_HashPath facilitates slicing up a hash value into a series of bucket values.
_HashValue represents a hash value.
This is still just mostly superficial refactoring, with little to no functional changes.