Joshua Simmons [Sat, 8 Oct 2022 11:03:44 +0000 (13:03 +0200)]
Improve pool implementation
Move virtual memory failures into the `virtual_reserve` and
`virtual_commit` signatures so we can give better assert messages on
failure.
Handle growth more accurately, allowing us to use the entire table
capacity before asserting.
Reserve a bit in the generation counter to keep track of whether a slot
is full by incrementing the counter on both allocation and deallocation.
This means exported handles can only ever have an odd generation
counter.
Assert when given a handle that has an invalid generation counter
(where the counter implies it would be pointing to an empty slot).
Both above changes together means it's no longer possible to create a
reference to an uninitialized slot, even when manually messing with the
handle or mixing handles between different pools.
Joshua Simmons [Thu, 6 Oct 2022 20:59:29 +0000 (22:59 +0200)]
Replace magic value in pool with random mixer
Instead of using a 4 bit magic number, and consequently restricting the
size of the pool, instead mix handles with a per-pool random integer
based on the pool's base memory address.
The associated tests will perhaps be a bit flaky, so disable them by
default.
Joshua Simmons [Sun, 2 Oct 2022 11:26:06 +0000 (13:26 +0200)]
Improve API of `ManualArc`
Consume the ManualArc when calling `release` to avoid needing to handle
double-free. Avoids unsafety in user code (was only protected by a debug
assert before)
Try to improve compile times by copy-pasting the handful of libc
definitions that we actually need. This is going to be a bit broken for
non-x86_64 platforms for now.
Improve `min`, `max` on ARM, and fix documentation
Use regular `f32::min` and `f32::max` for non-x86 platforms. Allows arm
to generate `fminnm`.
Improve documentation of platform specific behavior of `min` and `max`.
Add note about `sqrt` operation to `_sq` functions.
Split into multiple files.
Add `Affine2` and `Affine3` transformation types.
Add `Point2` and `Point3` types.
Use macro instead of repeating basic `Point` and `Vec` implementation.
Change `Mat4 * Point` to use homogeneous coordinates where `w=1`.
Change `Mat4 * Vec` to use homogeneous coordinates where `w=0`.