&self not runtime null-checked in macro #1827. Regression in temp allocators.

This commit is contained in:
Christoffer Lerno
2025-03-23 22:50:09 +01:00
parent b48588ca8f
commit 82f1b543ed
14 changed files with 335 additions and 224 deletions

View File

@@ -203,10 +203,11 @@ fn void*? TempAllocator.resize(&self, void* pointer, usz size, usz alignment) @d
}
}
void* data = self.acquire(size, NO_ZERO, alignment)!;
mem::copy(data, pointer, chunk.size, mem::DEFAULT_MEM_ALIGNMENT, mem::DEFAULT_MEM_ALIGNMENT);
usz len_to_copy = chunk.size > size ? size : chunk.size;
mem::copy(data, pointer, len_to_copy, mem::DEFAULT_MEM_ALIGNMENT, mem::DEFAULT_MEM_ALIGNMENT);
if (is_realloc_of_last)
{
self.used = ((void*)chunk - &self.data);
self.used = (uptr)chunk - (uptr)&self.data;
$if env::ADDRESS_SANITIZER:
asan::poison_memory_region(chunk, TempAllocatorChunk.sizeof + chunk.size);
$endif