Compare commits

...

7 Commits

Author SHA1 Message Date
Ed_
e2aba6db5f adjustments based on superluminal 2025-10-03 23:13:04 -04:00
Ed_
af38cda276 C-- lottes: drafting pass: removed all usages of star "*" dereference operator 2025-10-03 22:46:21 -04:00
Ed_
8df492399f Got lottes c-- version working 2025-10-03 22:09:11 -04:00
Ed_
2c0539e235 finish draft of lottes c-- veersion 2025-10-03 19:59:15 -04:00
Ed_
3223c0a0e1 Lottes C--: key tables... 2025-10-03 17:03:33 -04:00
Ed_
0bd68bccf0 lottes c--: arena impl 2025-10-03 16:18:03 -04:00
Ed_
5f03118a0d got to varenas (lottes c--)
Still not sure how hybrid I'm going to go (away from his more purist stance on typed info embedding).

If I were to codegen this and wanted typeless vs typed for debug it would be easier to malleablly switch between...
If I decide for this sample to go full asm (no C features almost we can still keep the type info for debug...
2025-10-03 15:56:42 -04:00
5 changed files with 1690 additions and 170 deletions

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@ C/watl.v0.msvc.c.listing.txt
watl_exercise.user
watl_exercise.proj
Odin/watl.v0.win32.odin.listing.txt
C/watl.v0.lottes.c.listing.txt

File diff suppressed because it is too large Load Diff

View File

@@ -1367,19 +1367,19 @@ void arena_allocator_proc(AllocatorProc_In in, AllocatorProc_Out* out)
#pragma endregion Arena
#pragma region Key Table 1-Layer Linear (KT1L)
void kt1l__populate_slice_a2(KT1L_Byte* kt, AllocatorInfo backing, KT1L_Meta m, Slice_Byte values, SSIZE num_values ) {
void kt1l__populate_slice_a2(KT1L_Byte*restrict kt, AllocatorInfo backing, KT1L_Meta m, Slice_Byte values, SSIZE num_values ) {
assert(kt != nullptr);
if (num_values == 0) { return; }
* kt = alloc_slice(backing, Byte, m.slot_size * num_values );
slice_assert(* kt);
for (span_iter(SSIZE, iter, 0, <, num_values)) {
SSIZE slot_offset = iter.cursor * m.slot_size; // slot id
Byte* slot_cursor = & kt->ptr[slot_offset]; // slots[id] type: KT1L_<Type>
U64* slot_key = (U64*)slot_cursor; // slots[id].key type: U64
Byte*restrict slot_cursor = & kt->ptr[slot_offset]; // slots[id] type: KT1L_<Type>
U64*restrict slot_key = (U64*restrict)slot_cursor; // slots[id].key type: U64
Slice_Byte slot_value = { slot_cursor + m.kt_value_offset, m.type_width }; // slots[id].value type: <Type>
SSIZE a2_offset = iter.cursor * m.type_width * 2; // a2 entry id
Byte* a2_cursor = & values.ptr[a2_offset]; // a2_entries[id] type: A2_<Type>
Slice_Byte a2_key = * cast(Slice_Byte*, a2_cursor); // a2_entries[id].key type: <Type>
Byte*restrict a2_cursor = & values.ptr[a2_offset]; // a2_entries[id] type: A2_<Type>
Slice_Byte a2_key = * cast(Slice_Byte*restrict, a2_cursor); // a2_entries[id].key type: <Type>
Slice_Byte a2_value = { a2_cursor + m.type_width, m.type_width }; // a2_entries[id].value type: <Type>
slice_copy(slot_value, a2_value); // slots[id].value = a2_entries[id].value
* slot_key = 0; hash64_djb8(slot_key, a2_key); // slots[id].key = hash64_djb8(a2_entries[id].key)

View File

@@ -115,10 +115,10 @@ $compiler_args += $flag_full_src_path
# $compiler_args += $flag_asm_listing_file
# $compiler_args += $flag_optimize_speed_max
$compiler_args += $flag_optimize_fast
# $compiler_args += $flag_optimize_fast
# $compiler_args += $flag_optimize_size
# $compiler_args += $flag_optimize_intrinsics
# $compiler_args += $flag_no_optimization
$compiler_args += $flag_no_optimization
# Debug setup
$compiler_args += ($flag_define + 'BUILD_DEBUG')

View File

@@ -93,7 +93,7 @@ $compiler_args += $flag_c11
# Constraints on C program code-gen
$compiler_args += $flag_exceptions_disabled
$compiler_args += $flag_RTTI_disabled
$compiler_args += $flag_preprocess_conform
# $compiler_args += $flag_preprocess_conform
# $compiler_args += $flag_sanitize_address
$compiler_args += $flag_wall
@@ -103,7 +103,7 @@ $compiler_args += $flag_charset_utf8
# Specifing output pathing
$compiler_args += ( $flag_path_interm + $path_build + '\' )
$compiler_args += ( $flag_path_output + $path_build + '\' )
# $compiler_args += ( $flag_path_output + $path_build + '\' )
# Dump preprocess file
if ($false) {
@@ -141,7 +141,10 @@ $compiler_args += $flag_compile, $unit
$compiler_args | ForEach-Object { Write-Host $_ }
# Compile the unit
$compilation_time = Measure-Command {
& $compiler $compiler_args
}
write-host "Compilation took $($compilation_time.TotalMilliseconds)ms"
write-host
$binary = join-path $path_build "$unit_name.exe"
@@ -174,8 +177,9 @@ if ($true) {
# Diagnoistc print for the args
$linker_args | ForEach-Object { Write-Host $_ }
& $linker $linker_args
$linking_time = Measure-Command { & $linker $linker_args }
# & $radlink $linker_args
write-host "Linking took $($linking_time.TotalMilliseconds)ms"
write-host
}