Refactor core APIs, fix bugs, and improve safety

- Make image result/info structs readonly; improve error handling and memory safety in image library
- Introduce IJobScheduler interface; move job scheduling docs to interface
- Remove "index 0 invalid" convention from slot/sparse maps; fix Count logic
- Add Owner<T> for disposable value types in low-level utilities
- Improve ObjectPool<T> thread safety and logic
- Change List<T>.RemoveAndSwapBack to return bool
- Remove unsafe methods from generated math types; add debug range checks
- Update benchmarks and enable collection checks in tests
- Improve documentation, comments, and error messages
- Bump assembly versions across all projects
This commit is contained in:
2025-12-21 16:08:10 +09:00
parent a1ad0bd2da
commit 1fee890329
38 changed files with 1967 additions and 350 deletions

View File

@@ -24,7 +24,9 @@ internal static unsafe class CRuntime
public static void free(void* ptr)
{
if (ptr == null)
{
return;
}
NativeMemory.Free(ptr);
MemoryStats.Freed();
@@ -54,7 +56,9 @@ internal static unsafe class CRuntime
finally
{
if (temp != null)
{
free(temp);
}
}
}
@@ -66,7 +70,9 @@ internal static unsafe class CRuntime
for (long i = 0; i < size; ++i)
{
if (*ap != *bp)
{
result += 1;
}
ap++;
bp++;
@@ -80,7 +86,9 @@ internal static unsafe class CRuntime
var bptr = (byte*)ptr;
var bval = (byte)value;
for (long i = 0; i < size; ++i)
{
*bptr++ = bval;
}
}
public static void memset(void* ptr, int value, ulong size)
@@ -96,7 +104,9 @@ internal static unsafe class CRuntime
public static void* realloc(void* ptr, long newSize)
{
if (ptr == null)
{
return malloc(newSize);
}
var result = NativeMemory.Realloc(ptr, (nuint)newSize);