Fixes missing checks to body arguments. Do not create debug declaration for value-only parameter. Bug in alignment for atomics. Macro ref parameters are pointers.

This commit is contained in:
Christoffer Lerno
2023-07-15 13:52:00 +02:00
committed by Christoffer Lerno
parent 90d91b4891
commit 34306cbf5d
55 changed files with 1405 additions and 1455 deletions

View File

@@ -64,7 +64,7 @@ fault AllocationFailure
macro void*! Allocator.alloc(&allocator, usz size)
{
return allocator.function(&allocator, size, 0, 0, null, ALLOC);
return allocator.function(allocator, size, 0, 0, null, ALLOC);
}
/**
@@ -72,12 +72,12 @@ macro void*! Allocator.alloc(&allocator, usz size)
*/
macro void*! Allocator.alloc_aligned(&allocator, usz size, usz alignment, usz offset = 0)
{
return allocator.function(&allocator, size, alignment, offset, null, ALIGNED_ALLOC);
return allocator.function(allocator, size, alignment, offset, null, ALIGNED_ALLOC);
}
macro void*! Allocator.realloc(&allocator, void* old_pointer, usz size)
{
return allocator.function(&allocator, size, 0, 0, old_pointer, REALLOC);
return allocator.function(allocator, size, 0, 0, old_pointer, REALLOC);
}
/**
@@ -85,18 +85,18 @@ macro void*! Allocator.realloc(&allocator, void* old_pointer, usz size)
*/
macro void*! Allocator.realloc_aligned(&allocator, void* old_pointer, usz size, usz alignment, usz offset = 0)
{
return allocator.function(&allocator, size, alignment, offset, old_pointer, ALIGNED_REALLOC);
return allocator.function(allocator, size, alignment, offset, old_pointer, ALIGNED_REALLOC);
}
macro usz Allocator.mark(&allocator)
{
return (usz)(uptr)allocator.function(&allocator, 0, 0, 0, null, MARK) ?? 0;
return (usz)(uptr)allocator.function(allocator, 0, 0, 0, null, MARK) ?? 0;
}
macro void*! Allocator.calloc(&allocator, usz size)
{
return allocator.function(&allocator, size, 0, 0, null, CALLOC);
return allocator.function(allocator, size, 0, 0, null, CALLOC);
}
/**
@@ -104,22 +104,22 @@ macro void*! Allocator.calloc(&allocator, usz size)
*/
macro void*! Allocator.calloc_aligned(&allocator, usz size, usz alignment, usz offset = 0)
{
return allocator.function(&allocator, size, alignment, offset, null, ALIGNED_CALLOC);
return allocator.function(allocator, size, alignment, offset, null, ALIGNED_CALLOC);
}
macro void! Allocator.free(&allocator, void* old_pointer)
{
allocator.function(&allocator, 0, 0, 0, old_pointer, FREE)!;
allocator.function(allocator, 0, 0, 0, old_pointer, FREE)!;
}
macro void! Allocator.free_aligned(&allocator, void* old_pointer)
{
allocator.function(&allocator, 0, 0, 0, old_pointer, ALIGNED_FREE)!;
allocator.function(allocator, 0, 0, 0, old_pointer, ALIGNED_FREE)!;
}
macro void Allocator.reset(&allocator, usz mark = 0)
{
(void)allocator.function(&allocator, mark, 0, 0, null, RESET);
(void)allocator.function(allocator, mark, 0, 0, null, RESET);
}
fn usz alignment_for_allocation(usz alignment) @inline @private