diff --git a/code/grime/arena_fixed.odin b/code/grime/arena_fixed.odin new file mode 100644 index 0000000..e69de29 diff --git a/code/grime/arena_vchaining.odin b/code/grime/arena_vchaining.odin new file mode 100644 index 0000000..e69de29 diff --git a/code/grime/linked_list.odin b/code/grime/linked_list.odin index fa17d37..f2989f3 100644 --- a/code/grime/linked_list.odin +++ b/code/grime/linked_list.odin @@ -47,7 +47,7 @@ DLL_NodePN :: struct ( $ Type : typeid ) { prev, next : ^Type, } DLL_NodeFL :: struct ( $ Type : typeid ) { -first, last : ^Type, + first, last : ^Type, } DLL_NodeBT :: struct ($Type: typeid) { bottom, top: ^Type, diff --git a/code/grime/pool_allocator.odin b/code/grime/pool_backed.odin similarity index 100% rename from code/grime/pool_allocator.odin rename to code/grime/pool_backed.odin diff --git a/code/grime/pool_virtual.odin b/code/grime/pool_virtual.odin new file mode 100644 index 0000000..e69de29 diff --git a/code/grime/profiler.odin b/code/grime/profiler.odin index 2fcc5f7..e576317 100644 --- a/code/grime/profiler.odin +++ b/code/grime/profiler.odin @@ -1,5 +1,9 @@ package grime +/* +This is just a snippet file, do not use directly. +*/ + import "base:runtime" import "core:prof/spall" @@ -8,26 +12,30 @@ SpallProfiler :: struct { buffer : spall.Buffer, } -@(private) -Module_Context : ^SpallProfiler +// The rest is a snippet to implement in the target codebase. +when false +{ + @(private) + Module_Context : ^SpallProfiler -set_profiler_module_context :: #force_inline proc "contextless" ( ctx : ^SpallProfiler ) { - Module_Context = ctx -} + set_profiler_module_context :: #force_inline proc "contextless" ( ctx : ^SpallProfiler ) { + Module_Context = ctx + } -DISABLE_PROFILING :: true + DISABLE_PROFILING :: true -@(deferred_none = profile_end, disabled = DISABLE_PROFILING) -profile :: #force_inline proc "contextless" ( name : string, loc := #caller_location ) { - spall._buffer_begin( & Module_Context.ctx, & Module_Context.buffer, name, "", loc ) -} + @(deferred_none = profile_end, disabled = DISABLE_PROFILING) + profile :: #force_inline proc "contextless" ( name : string, loc := #caller_location ) { + spall._buffer_begin( & Module_Context.ctx, & Module_Context.buffer, name, "", loc ) + } -@(disabled = DISABLE_PROFILING) -profile_begin :: #force_inline proc "contextless" ( name : string, loc := #caller_location ) { - spall._buffer_begin( & Module_Context.ctx, & Module_Context.buffer, name, "", loc ) -} + @(disabled = DISABLE_PROFILING) + profile_begin :: #force_inline proc "contextless" ( name : string, loc := #caller_location ) { + spall._buffer_begin( & Module_Context.ctx, & Module_Context.buffer, name, "", loc ) + } -@(disabled = DISABLE_PROFILING) -profile_end :: #force_inline proc "contextless" () { - spall._buffer_end( & Module_Context.ctx, & Module_Context.buffer) -} + @(disabled = DISABLE_PROFILING) + profile_end :: #force_inline proc "contextless" () { + spall._buffer_end( & Module_Context.ctx, & Module_Context.buffer) + } +} \ No newline at end of file diff --git a/code/grime/ptr.odin b/code/grime/unused/.ptr.odin similarity index 100% rename from code/grime/ptr.odin rename to code/grime/unused/.ptr.odin diff --git a/code/grime/.ring_buffer.odin b/code/grime/unused/.ring_buffer.odin similarity index 100% rename from code/grime/.ring_buffer.odin rename to code/grime/unused/.ring_buffer.odin diff --git a/code/host/host.odin b/code/host/host.odin index 4af76c8..db3dff7 100644 --- a/code/host/host.odin +++ b/code/host/host.odin @@ -10,7 +10,7 @@ Currently the prototype has hot-reload always enabled, eventually there will be */ package sectr_host -//region Grime & Dependencies +//region pkg_mappings import "base:runtime" Byte :: runtime.Byte Kilobyte :: runtime.Kilobyte @@ -88,7 +88,7 @@ file_status :: proc { to_str :: proc { builder_to_string, } -//endregion Grime & Dependencies +//endregion pkg_mappings Path_Snapshot :: "VMemChunk_1.snapshot" Path_Logs :: "../logs" @@ -111,6 +111,9 @@ RuntimeState :: struct { job_system: JobSystemContext, } +@thread_local +worker_thread: sectr.ThreadWorkerContext + ClientMemory :: struct { persistent : VArena, frame : VArena, diff --git a/code/host/readme.md b/code/host/readme.md new file mode 100644 index 0000000..1d14f01 --- /dev/null +++ b/code/host/readme.md @@ -0,0 +1,5 @@ +# Host: OS Sandbox Manager + +The host is the final downstream module and is responsible for handling the launch of application, its persistent memory tracking, and the multi-threaded job system including its worker threads. +For debug builds the host supports hot-reloading the client module (Sectr). +Maxmimum orchestration is designated to the client module, which only defers launch and the initial job setup to the Host. diff --git a/code/sectr/app/app.odin b/code/sectr/app/app.odin new file mode 100644 index 0000000..98633f0 --- /dev/null +++ b/code/sectr/app/app.odin @@ -0,0 +1,2 @@ +package sectr + diff --git a/code/sectr/app/readme.md b/code/sectr/app/readme.md new file mode 100644 index 0000000..4fb861b --- /dev/null +++ b/code/sectr/app/readme.md @@ -0,0 +1,4 @@ +# App: Application Orchestration + +The user-level features are managed here down-stream of engine orchestration. +For this prototype these involve mainly the screen UI, the project workspace UIs, and the codebase backend. diff --git a/code/sectr/engine/engine.odin b/code/sectr/engine/engine.odin new file mode 100644 index 0000000..e69de29 diff --git a/code/sectr/engine/job_system.odin b/code/sectr/engine/job_system.odin index 3cc73ce..bb7f94e 100644 --- a/code/sectr/engine/job_system.odin +++ b/code/sectr/engine/job_system.odin @@ -23,6 +23,7 @@ Job :: struct { group: ^JobGroup, ignored: IgnoredThreads, dbg_lbl: string, + // scratch: CArena, } JobList :: struct { @@ -44,6 +45,161 @@ ThreadWorkerContext :: struct { index: int, } +WorkerID :: enum u32 { + Master_Prepper = 0, + + API_Apologist, + Artifical_Sweetener, + Assertion_Avenger, + Async_Antagonist, + Atomic_Accountant, + Black_Box_Provider, + Bit_Rot_Repacker, + Big_O_Admirer, + Blitting_Bandit, + Blockchain_Believer, + Blue_Caller, + Blue_Screen_Shopper, + Branch_Mispredictor, + Breakpoint_Bandit, + Buffer_Baron, + Cache_Concierge, + Cafecito_Barista, + Callback_Operator, + Callstack_Canopy, + Carpe_Datum, + Chief_Synergy_Officer, + Cipher_Clerk, + Conscripted_Camper, + Dean_Of_Misplaced_Delegation, + Dereference_Doctorate, + Checkbox_Boi, + Credible_Threat, + Dead_Drop_Delegate, + Deadline_Denialist, + Deadlock_Daemon, + DMA_Desperado, + Dump_Curator, + Edge_Case_Evangelist, + Enterprise_Entangler, + Exception_Excavator, + Git_Blame_Archaeologist, + Feature_Creeper, + Feature_Freeze_Fighter, + Fencepost_Fiddler, + Fitness_Unpacker, + Flop_Flipper, + Floating_Point_Propoganda, + Forgets_To_Check, + Global_Guardian, + Goto_Goon, + Ghost_Protocols, + Halting_Solver, + Handshake_Hypeman, + Headcount_Hoarder, + Heisenbug_Hunter, + Heuristic_Hypnotist, + Hotfix_Hooligan, + Hot_Path_Hitchhiker, + Idle_Malware, + Implementation_Detailer, + Interrupt_Ignorer, + Interrupt_Insurgent, + Jank_Jockey, + Jefe_De_Errores, + Kickoff_Holiday, + Kilobyte_Kingpin, + KPI_Keeper, + Latency_Lover, + Leeroy_Jenkins, + Legacy_Liaison, + Loop_Lobbyist, + Linter_Lamenter, + Lock_Free_Liar, + Low_Hanging_Fruit_Picker, + Malloc_Maverick, + Malpractice_Mitigator, + Merge_Conflict_Mediator, + Memory_Mangler, + MaƱana_Manager, + Minimum_Wage_Multiplexer, + Monad_Masquerader, + NaN_Propagator, + NDA_Negotiator, + Null_Pointer_Enthusiast, + Off_By_One_Offender, + On_Call_Intern, + Onboarding_Overlord, + Overflow_Investor, + Out_Of_Bounds_Outlaw, + Page_Fault_Pioneer, + Panic_As_A_Service, + Paradigm_Pivoter, + Patient_Zero_Pollinator, + Payload_Plunderer, + Perpetual_Peon, + Phishing_Pharmacist, + Pipeline_Plumber, + Pointer_Pilgrim, + Production_Pusher, + Quiet_Quitter, + Query_Gremlin, + Race_Condition_Gambler, + Rebase_Renegade, + Red_Tape_Renderer, + Resting_Receptionist, + Quantum_Quibbler, + Regex_Rancher, + Register_Riveter, + Register_Spill_Rancher, + Roadmap_Revisionist, + Rootkit_Realtor, + Runtime_Ruffian, + Sabbatical_Scheduler, + Shift_Manager, + Speculative_Skeptic, + Segfault_Stretcher, + Siesta_Scheduler, + Singleton_Sinner, + Sleeper_Cell_Spammer, + Spaghetti_Chef, + Spinlock_Spelunker, + Stack_Smuggler, + Stakeholder_Simulator, + TCP_Tango, + Techdebt_Treasurer, + Tenured_Trapper, + Thread_Local_Tourist, + Triage_Technician, + Tunnel_Fisherman, + Type_Theorist, + UDP_Unicycle, + Unattended_Child, + Undefined_Behavior_Brokerage, + Unreachable_Utopian, + Unicode_Usurper, + Unsafe_Advocate, + Unsigned_Vigilante, + Unwind_Understudy, + Voltage_Vampire, + Vibe_Checker, + Virtual_Vagrant, + Volatile_Vandal, + Void_Voyager, + Waiting_Room_Warden, + Weltschmerz_Worker, + While_True_Wanderer, + Write_Barrier_Warden, + XORcist, + YAGNI_Yeller, + Yellowpage_Dialer, + Zeroring_Comissioner, + Zero_Cost_Commando, + Zero_Day_Dreamer, + Zombie_Zookeeper, + Zombo_Vistor, +} + // Hard constraint for Windows JOB_SYSTEM_MAX_WORKER_THREADS :: 64 diff --git a/code/sectr/engine/profiler.odin b/code/sectr/engine/profiler.odin new file mode 100644 index 0000000..7ba6dc6 --- /dev/null +++ b/code/sectr/engine/profiler.odin @@ -0,0 +1,3 @@ +package sectr + + diff --git a/code/sectr/engine/readme.md b/code/sectr/engine/readme.md new file mode 100644 index 0000000..7f72bd4 --- /dev/null +++ b/code/sectr/engine/readme.md @@ -0,0 +1,3 @@ +# Engine: Technical Orchestration + +All aspects of technical operations are handled as conceptually the engine of the application. \ No newline at end of file diff --git a/code/sectr/app/state.odin b/code/sectr/engine/state.odin similarity index 100% rename from code/sectr/app/state.odin rename to code/sectr/engine/state.odin diff --git a/code/sectr/grime/pkg_mappings.odin b/code/sectr/grime/pkg_mappings.odin index ef26aac..4520615 100644 --- a/code/sectr/grime/pkg_mappings.odin +++ b/code/sectr/grime/pkg_mappings.odin @@ -327,6 +327,7 @@ import "codebase:grime" to_str_runes_pair_via_string :: grime.to_str_runes_pair_via_string to_str_runes_pair_via_runes :: grime.to_str_runes_pair_via_runes + // profiler SpallProfiler :: grime.SpallProfiler