Skip to content

Feat: aligned allocation#4886

Draft
lum1n0us wants to merge 14 commits intobytecodealliance:mainfrom
lum1n0us:feat/aligned-allocation
Draft

Feat: aligned allocation#4886
lum1n0us wants to merge 14 commits intobytecodealliance:mainfrom
lum1n0us:feat/aligned-allocation

Conversation

@lum1n0us
Copy link
Contributor

No description provided.

lum1n0us and others added 14 commits March 20, 2026 15:26
Add mem_allocator_malloc_aligned() API with support for both
GC_VERIFY enabled and disabled modes.

Related to DESIGN_ALIGNED_ALLOC.md
Add MEM_ALLOC_API_INTER macro for exposing internal functions
in test builds and magic value constants for aligned allocation
detection.
Convert obj_to_hmu to function that detects aligned allocations
via magic value and calculates correct HMU offset.
Add CMocka support and mem-alloc test subdirectory.
Create basic test infrastructure with helper functions.
Fix INTERP setting and add include directories for ems headers.
Verify existing mem_allocator_malloc still works correctly.
Add aligned allocation with over-allocation and metadata storage.
Supports alignments from 8 bytes to page size.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Verify aligned allocations work for powers of 2.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
gc_realloc_vo now detects and rejects aligned allocations
per POSIX behavior.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Verify realloc correctly rejects aligned allocations and
still works for normal allocations.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Verify invalid alignments and size requirements are enforced.
Fix alignment validation to reject zero.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Verify normal and aligned allocations can coexist and
obj_to_hmu works correctly for both.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Test many allocations and mixed allocation patterns.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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