General codebase refactor & cleanup

Renamed HashTable to HMapZPL, with procs having the zpl_ namespace prefix.
(I want to eventually get away from using it)

Started to use the grime pattern for library aliasing better.
This commit is contained in:
2024-02-27 07:50:57 -05:00
parent c9dc5fe54a
commit 4deee942a8
28 changed files with 752 additions and 613 deletions

View File

@ -10,14 +10,34 @@ $path_scripts = join-path $path_root 'scripts'
$path_thirdparty = join-path $path_root 'thirdparty'
$path_odin = join-path $path_thirdparty 'odin'
if ( $IsWindows ) {
$CPU_Info = Get-CimInstance ClassName Win32_Processor | Select-Object -Property NumberOfCores, NumberOfLogicalProcessors
$CoreCount_Physical, $CoreCount_Logical = $CPU_Info.NumberOfCores, $CPU_Info.NumberOfLogicalProcessors
}
# Odin Compiler Flags
$flag_build = 'build'
$flag_run = 'run'
$flag_check = 'check'
$flag_query = 'query'
$flag_report = 'report'
$command_build = 'build'
$command_check = 'check'
$command_query = 'query'
$command_report = 'report'
$command_run = 'run'
$flag_build_mode = '-build-mode:'
$flag_build_mode_dll = '-build-mode:dll'
$flag_collection = '-collection:'
$flag_debug = '-debug'
$flag_define = '-define:'
$flag_disable_assert = '-disable-assert'
$flag_extra_assembler_flags = '-extra_assembler-flags:'
$flag_extra_linker_flags = '-extra-linker-flags:'
$flag_ignore_unknown_attributes = '-ignore-unknown-attributes'
$flag_keep_temp_files = '-keep-temp-files'
$flag_no_bounds_check = '-no-bounds-check'
$flag_no_crt = '-no-crt'
$flag_no_entrypoint = '-no-entry-point'
$flag_no_thread_local = '-no-thread-local'
$flag_no_thread_checker = '-no-thread-checker'
$flag_output_path = '-out='
$flag_optimization_level = '-opt:'
$flag_optimize_none = '-o:none'
@ -25,40 +45,31 @@ $flag_optimize_minimal = '-o:minimal'
$flag_optimize_size = '-o:size'
$flag_optimize_speed = '-o:speed'
$falg_optimize_aggressive = '-o:aggressive'
$flag_pdb_name = '-pdb-name:'
$flag_sanitize = '-sanitize:'
$flag_subsystem = '-subsystem:'
$flag_show_timings = '-show-timings'
$flag_show_more_timings = '-show-more-timings'
$flag_show_system_calls = '-show-system-calls'
$flag_target = '-target:'
$flag_thread_count = '-thread-count:'
$flag_collection = '-collection:'
$flag_build_mode = '-build-mode:'
$flag_build_mode_dll = '-build-mode:dll'
$flag_no_bounds_check = '-no-bounds-check'
$flag_disable_assert = '-disable-assert'
$flag_no_thread_local = '-no-thread-local'
$flag_no_thread_checker = '-no-thread-checker'
$flag_use_lld = '-lld'
$flag_use_separate_modules = '-use-separate-modules'
$flag_vet_all = '-vet'
$flag_vet_unused_entities = '-vet-unused'
$flag_vet_semicolon = '-vet-semicolon'
$flag_vet_shadow_vars = '-vet-shadowing'
$flag_vet_using_stmt = '-vet-using-stmt'
$flag_use_separate_modules = '-use-separate-modules'
$flag_define = '-define:'
$flag_extra_assembler_flags = '-extra_assembler-flags:'
$flag_extra_linker_flags = '-extra-linker-flags:'
$flag_ignore_unknown_attributes = '-ignore-unknown-attributes'
$flag_keep_temp_files = '-keep-temp-files'
$flag_no_crt = '-no-crt'
$flag_no_entrypoint = '-no-entry-point'
$flag_pdb_name = '-pdb-name:'
$flag_sanitize = '-sanitize:'
$flag_subsystem = '-subsystem:'
$flag_target = '-target:'
$flag_use_lld = '-lld'
$flag_msvc_link_disable_dynamic_base = '/DYNAMICBASE:NO'
$flag_msvc_link_base_address = '/BASE:'
$flag_msvc_link_fixed_base_address = '/FIXED'
$msvc_link_default_base_address = 0x180000000
push-location $path_root
$update_deps = join-path $path_scripts 'update_deps.ps1'
$odin = join-path $path_odin 'odin.exe'
$update_deps = join-path $path_scripts 'update_deps.ps1'
$odin_compiler = join-path $path_odin 'odin.exe'
if ( -not( test-path 'build') ) {
new-item -ItemType Directory -Path 'build'
}
@ -68,12 +79,19 @@ push-location $path_root
push-location $path_code
$project_name = 'sectr'
write-host "`nBuilding Sectr Prototype"
write-host "`nBuilding Sectr Prototype`n"
$module_host = join-path $path_code 'host'
$module_sectr = $path_code
& $update_deps
$pkg_collection_thirdparty = 'thirdparty=' + $path_thirdparty
$host_process_active = Get-Process | Where-Object {$_.Name -like 'sectr_host*'}
if ( -not $host_process_active ) {
& $update_deps
write-host
}
function build-sectr
{
@ -86,17 +104,30 @@ push-location $path_root
$module_dll = join-path $path_build ( $project_name + '.dll' )
$pdb = join-path $path_build ( $project_name + '.pdb' )
$linker_args = ""
$linker_args += ( $flag_msvc_link_disable_dynamic_base + ' ' )
$linker_args += ( $flag_msvc_link_fixed_base_address + ' ' )
$linker_args += ( $flag_msvc_link_base_address + '0x20000000000' )
# $linker_args += ( $flag_msvc_link_base_address + '0x200000000' )
$build_args = @()
$build_args += $flag_build
$build_args += $command_build
$build_args += '.'
$build_args += $flag_build_mode_dll
$build_args += $flag_output_path + $module_dll
$build_args += ($flag_collection + $pkg_collection_thirdparty)
$build_args += $flag_use_separate_modules
$build_args += $flag_optimize_none
$build_args += $flag_debug
$build_args += $flag_pdb_name + $pdb
$build_args += ($flag_extra_linker_flags + $linker_args )
$build_args += $flag_subsystem + 'windows'
# $build_args += $flag_show_system_calls
# $build_args += $flag_show_timings
write-host 'Building Sectr Module'
& $odin $build_args
& $odin_compiler $build_args
write-host
}
build-sectr
@ -105,7 +136,6 @@ push-location $path_root
$executable = join-path $path_build ($project_name + '_host.exe')
$pdb = join-path $path_build ($project_name + '_host.pdb')
$host_process_active = Get-Process | Where-Object {$_.Name -like 'sectr_host*'}
if ( $host_process_active ) {
write-host 'Skipping sectr_host build, process is active'
return
@ -117,21 +147,31 @@ push-location $path_root
return
}
$linker_args = ""
$linker_args += ( $flag_msvc_link_disable_dynamic_base + ' ' )
$build_args = @()
$build_args += $flag_build
$build_args += $command_build
$build_args += './host'
$build_args += $flag_output_path + $executable
$build_args += ($flag_collection + $pkg_collection_thirdparty)
$build_args += $flag_use_separate_modules
$build_args += $flag_thread_count + $CoreCount_Physical
$build_args += $flag_optimize_none
$build_args += $flag_debug
$build_args += $flag_pdb_name + $pdb
$build_args += ($flag_extra_linker_flags + $linker_args )
$build_args += $flag_subsystem + 'windows'
# $build_args += $flag_show_system_call
# $build_args += $flag_show_timings
write-host 'Building Host Module'
& $odin $build_args
& $odin_compiler $build_args
write-host
}
build-host
Pop-Location
Pop-Location # path_code
}
build-prototype
pop-location
pop-location # path_root