[PA] Refactor to use a typed SlotStart to replace uintptr_t
This CL refactors PartitionAlloc to use a new SlotStart type instead of
raw `uintptr_t` to represent the start of a slot. This improves type
safety and makes the code easier to understand and maintain.
The new SlotStart class has two variants: SlotStart (tagged) and
UntaggedSlotStart. It also provides Checked and Unchecked factory
methods. The Checked variant performs a runtime check to ensure that the
given address is indeed a slot start, which helps catch memory
corruption bugs earlier.
The following changes were made:
- Introduced SlotStart, UntaggedSlotStart, and SlotSpanStart classes.
- Replaced most usages of raw uintptr_t for slot starts with the new
types.
- Replaced PartitionRoot::ObjectToSlotStart and
PartitionRoot::SlotStartToObject with `SlotStart::Checked` and
`SlotStart::ToObject`.
- Updated numerous call sites to use the new SlotStart API family.
This change is a pure refactoring and should not have any functional
impact.
Cq-Include-Trybots: luci.chromium.try:android-mte-arm64-rel
Change-Id: Ide9c8ff7dfd77d226ba806fa0f6f4a75f2e30ff9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7125918
Reviewed-by: Sergei Glazunov <glazunov@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Auto-Submit: Mikihito Matsuura <mikt@google.com>
Commit-Queue: Sergei Glazunov <glazunov@google.com>
Reviewed-by: Takashi Sakamoto <tasak@google.com>
Cr-Commit-Position: refs/heads/main@{#1543027}
NOKEYCHECK=True
GitOrigin-RevId: 2b12f09a50acd7d19a7cd07db00a10c00c1297c1
1 file changed