Skip to content

Comments

(refactor): rename internals to match evolved architecture#18

Merged
mgyoo86 merged 5 commits intomasterfrom
refac/renaming
Feb 18, 2026
Merged

(refactor): rename internals to match evolved architecture#18
mgyoo86 merged 5 commits intomasterfrom
refac/renaming

Conversation

@mgyoo86
Copy link
Collaborator

@mgyoo86 mgyoo86 commented Feb 18, 2026

Summary

Renames internal functions, struct fields, and magic numbers to accurately reflect their current behavior after the Phase 3 (dynamic-selective) and Phase 5 (typed-fallback) optimizations.

Before these optimizations, _mark_untracked! simply flagged that an acquire happened outside @with_pool visibility. Now it precisely records which type was touched (via per-type bitmask), enabling selective rewind of only the affected pools. The old names were misleading; this PR aligns naming with actual semantics.

Rename Map

Tier 1: Core Renames

Old New Rationale
_mark_untracked! _record_type_touch! Records per-type bitmask, not a boolean flag
_untracked_fixed_masks _touched_type_masks Tracks which types were touched at each depth
_untracked_has_others _touched_has_others Tracks whether non-fixed-slot types were touched

Tier 2: Mode Functions

Old New
_depth_only_checkpoint! _lazy_checkpoint!
_dynamic_selective_rewind! _lazy_rewind!
_typed_checkpoint_with_lazy! _typed_lazy_checkpoint!
_typed_selective_rewind! _typed_lazy_rewind!
_generate_dynamic_selective_*_call _generate_lazy_*_call

Tier 2: Named Constants (replacing magic hex literals)

const _LAZY_MODE_BIT   = UInt16(0x8000)  # bit 15
const _TYPED_LAZY_BIT  = UInt16(0x4000)  # bit 14
const _MODE_BITS_MASK  = UInt16(0xC000)  # bits 14-15
const _TYPE_BITS_MASK  = UInt16(0x00FF)  # bits 0-7

Scope

  • 13 files changed across src/, ext/, test/, docs/
  • Pure rename + constant extraction, no behavioral changes
  • All tests pass, 96% coverage maintained
  • CUDA extension fully mirrored

…d named constants

Tier 1 renames to match evolved architecture after Phase 3/5 optimizations:
- _mark_untracked! → _record_type_touch! (records per-type bitmask, not a boolean)
- _untracked_fixed_masks → _touched_type_masks (struct field)
- _untracked_has_others → _touched_has_others (struct field)

Add named constants replacing magic hex literals:
- _LAZY_MODE_BIT (0x8000), _TYPED_LAZY_BIT (0x4000)
- _MODE_BITS_MASK (0xC000), _TYPE_BITS_MASK (0x00FF)
Tier 2 renames for checkpoint/rewind mode functions:
- _depth_only_checkpoint! → _lazy_checkpoint!
- _dynamic_selective_rewind! → _lazy_rewind!
- _typed_checkpoint_with_lazy! → _typed_lazy_checkpoint!
- _typed_selective_rewind! → _typed_lazy_rewind!
- _generate_dynamic_selective_*_call → _generate_lazy_*_call

Replace magic hex (0x8000, 0x4000, 0xC000, 0x00FF) with named constants.
Apply Tier 1 + Tier 2 renames to CUDA extension:
- Struct fields, function overrides, imports, and magic numbers
- Float16 special handling preserved (bit 7 reassignment)
- Update imports, function calls, field refs, and string assertions in tests
- Update architecture docs with new function names and diagrams
- Add naming_refactor_proposal.md as design record
@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 97.02970% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.46%. Comparing base (59d002e) to head (e645a1c).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
src/acquire.jl 81.25% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #18   +/-   ##
=======================================
  Coverage   96.46%   96.46%           
=======================================
  Files           9        9           
  Lines        1273     1273           
=======================================
  Hits         1228     1228           
  Misses         45       45           
Files with missing lines Coverage Δ
src/convenience.jl 100.00% <100.00%> (ø)
src/macros.jl 92.78% <100.00%> (ø)
src/state.jl 98.70% <100.00%> (ø)
src/types.jl 100.00% <ø> (ø)
src/acquire.jl 95.23% <81.25%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors internal naming around the pool state machine to match the current “lazy first-touch + selective rewind” architecture, and replaces hard-coded mode/type bit literals with named constants across CPU and CUDA implementations.

Changes:

  • Renames the internal “untracked” terminology to “type touch” throughout state tracking, acquire wrappers, macros, and tests.
  • Renames dynamic-selective / typed-fallback mode helpers to the new “lazy” naming scheme and updates macro codegen accordingly.
  • Introduces _LAZY_MODE_BIT, _TYPED_LAZY_BIT, _MODE_BITS_MASK, and _TYPE_BITS_MASK and wires them through CPU + CUDA paths.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/types.jl Adds named mode/type bit constants; renames pool fields to _touched_*.
src/state.jl Renames lazy/typed-lazy helpers; updates rewind/checkpoint internals to use new fields/constants.
src/acquire.jl Renames _mark_untracked!_record_type_touch! and updates recording + lazy first-touch logic.
src/convenience.jl Updates convenience APIs to call _record_type_touch!.
src/macros.jl Updates macro codegen to emit _lazy_checkpoint!/_lazy_rewind! and typed-lazy fallback names.
ext/AdaptiveArrayPoolsCUDAExt/types.jl Mirrors CPU field renames in CUDA pool type.
ext/AdaptiveArrayPoolsCUDAExt/state.jl Mirrors CPU rename/constants in CUDA checkpoint/rewind and lazy helpers.
ext/AdaptiveArrayPoolsCUDAExt/acquire.jl Updates CUDA type-touch recording override and mode-bit checks.
test/test_state.jl Updates state tests for new field/function names and mode-bit expectations.
test/test_macro_internals.jl Updates macro internal/runtime-correctness tests to new helper names.
test/test_macro_expansion.jl Updates expansion-string assertions to new helper names.
test/test_backend_macro_expansion.jl Updates backend expansion tests to new helper names.
docs/src/architecture/macro-internals.md Updates architecture docs terminology and examples to new names.
docs/design/naming_refactor_proposal.md Adds RFC/proposal doc (currently contains pre-rename “current” names).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mgyoo86 mgyoo86 merged commit b098274 into master Feb 18, 2026
10 checks passed
@mgyoo86 mgyoo86 deleted the refac/renaming branch February 18, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant