Allow (int[*]) { 1, 2 } cast style initialization. Experimental change from [*] to [?]. Fix issue where compile time declarations in expression list would not be handled properly.

This commit is contained in:
Christoffer Lerno
2025-01-25 22:10:12 +01:00
parent ca91ad4097
commit e40bab2d30
93 changed files with 529 additions and 466 deletions

View File

@@ -28,7 +28,7 @@ fn void ArenaAllocator.clear(&self)
struct ArenaAllocatorHeader @local
{
usz size;
char[*] data;
char[?] data;
}
<*

View File

@@ -52,7 +52,7 @@ fn void OnStackAllocator.free(&self)
struct OnStackAllocatorHeader
{
usz size;
char[*] data;
char[?] data;
}
<*

View File

@@ -4,7 +4,7 @@ import std::io, std::math;
struct TempAllocatorChunk @local
{
usz size;
char[*] data;
char[?] data;
}
struct TempAllocator (Allocator)
@@ -13,7 +13,7 @@ struct TempAllocator (Allocator)
TempAllocatorPage* last_page;
usz used;
usz capacity;
char[*] data;
char[?] data;
}
const usz PAGE_IS_ALIGNED @private = (usz)isz.max + 1u;
@@ -26,7 +26,7 @@ struct TempAllocatorPage
usz mark;
usz size;
usz ident;
char[*] data;
char[?] data;
}
macro usz TempAllocatorPage.pagesize(&self) => self.size & ~PAGE_IS_ALIGNED;

View File

@@ -660,5 +660,5 @@ struct StringData @private
Allocator allocator;
usz len;
usz capacity;
char[*] chars;
char[?] chars;
}

View File

@@ -25,7 +25,7 @@ macro bool @constant_is_power_of_2($x) @const @private
@return "A vector with the loaded values where the mask is true, passthru where the mask is false"
*>
macro masked_load(ptr, bool[<*>] mask, passthru)
macro masked_load(ptr, bool[<?>] mask, passthru)
{
return $$masked_load(ptr, mask, passthru, 0);
}
@@ -45,7 +45,7 @@ macro masked_load(ptr, bool[<*>] mask, passthru)
@return "A vector with the loaded values where the mask is true, passthru where the mask is false"
*>
macro @masked_load_aligned(ptr, bool[<*>] mask, passthru, usz $alignment)
macro @masked_load_aligned(ptr, bool[<?>] mask, passthru, usz $alignment)
{
return $$masked_load(ptr, mask, passthru, $alignment);
}
@@ -65,7 +65,7 @@ macro @masked_load_aligned(ptr, bool[<*>] mask, passthru, usz $alignment)
@return "A vector with the loaded values where the mask is true, passthru where the mask is false"
*>
macro gather(ptrvec, bool[<*>] mask, passthru)
macro gather(ptrvec, bool[<?>] mask, passthru)
{
return $$gather(ptrvec, mask, passthru, 0);
}
@@ -88,7 +88,7 @@ macro gather(ptrvec, bool[<*>] mask, passthru)
@return "A vector with the loaded values where the mask is true, passthru where the mask is false"
*>
macro @gather_aligned(ptrvec, bool[<*>] mask, passthru, usz $alignment)
macro @gather_aligned(ptrvec, bool[<?>] mask, passthru, usz $alignment)
{
return $$gather(ptrvec, mask, passthru, $alignment);
}
@@ -105,7 +105,7 @@ macro @gather_aligned(ptrvec, bool[<*>] mask, passthru, usz $alignment)
@require @typekind(value) == VECTOR : "Expected value to be a vector"
@require value.len == mask.len : "Mask and value must have the same length"
*>
macro masked_store(ptr, value, bool[<*>] mask)
macro masked_store(ptr, value, bool[<?>] mask)
{
return $$masked_store(ptr, value, mask, 0);
}
@@ -122,7 +122,7 @@ macro masked_store(ptr, value, bool[<*>] mask)
@require @constant_is_power_of_2($alignment) : "The alignment must be a power of two"
*>
macro @masked_store_aligned(ptr, value, bool[<*>] mask, usz $alignment)
macro @masked_store_aligned(ptr, value, bool[<?>] mask, usz $alignment)
{
return $$masked_store(ptr, value, mask, $alignment);
}
@@ -138,7 +138,7 @@ macro @masked_store_aligned(ptr, value, bool[<*>] mask, usz $alignment)
@require mask.len == ptrvec.len : "Mask and ptrvec must have the same length"
*>
macro scatter(ptrvec, value, bool[<*>] mask)
macro scatter(ptrvec, value, bool[<?>] mask)
{
return $$scatter(ptrvec, value, mask, 0);
}
@@ -156,7 +156,7 @@ macro scatter(ptrvec, value, bool[<*>] mask)
@require mask.len == ptrvec.len : "Mask and ptrvec must have the same length"
@require @constant_is_power_of_2($alignment) : "The alignment must be a power of two"
*>
macro @scatter_aligned(ptrvec, value, bool[<*>] mask, usz $alignment)
macro @scatter_aligned(ptrvec, value, bool[<?>] mask, usz $alignment)
{
return $$scatter(ptrvec, value, mask, $alignment);
}

View File

@@ -214,7 +214,7 @@ struct TypeId
usz sizeof;
TypeId* inner;
usz len;
typeid[*] additional;
typeid[?] additional;
}
fn void dl_reg_callback(MachHeader* mh, isz vmaddr_slide)

View File

@@ -40,7 +40,7 @@ macro double! decfloat(char[] chars, int $bits, int $emin, int sign)
const uint[2] TH = B1B_MAX;
int emax = - $emin - $bits + 3;
const int[*] P10S = { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 };
const int[?] P10S = { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 };
usz index;
bool got_digit = chars[0] == '0';
bool got_rad;