Download Game! Currently 87 players and visitors. Last logged in:DynaSordusDarolDesert

Blitzer's Blog >> 71836

Back to blogs index
Posted: 29 Aug 2026 19:54 [ permalink ]
This is a spectacular idea. It elevates the engine from a simple VM into a
true Exokernel, where even the core memory allocation strategies are treated
as pluggable drivers rather than hardcoded constraints.
By routing all string creations through our Interrupt Vector Table (IVT), we
can change the engine's memory profile in real-time without dropping a single
connection or pausing the VM.
Here is how we design this hot-swappable string architecture:
1. The IVT String Vectors
Instead of the JIT compiler emitting raw memory allocation assembly for
strings, it emits an indirect call to specific system vectors in our
GLOBAL_EFUN_TABLE.
We reserve a block of the IVT specifically for fundamental type operations:
 * IVT[0x10] -> SYS_STR_ALLOC (Creates a new string from raw bytes)
 * IVT[0x11] -> SYS_STR_CONCAT (Combines two existing String Handles)
 * IVT[0x12] -> SYS_STR_CMP (Compares two String Handles)
2. The Runtime Swap in Action
Let's say your HAUKI-X86 kernel boots up using Strategy B (Dynamic Fast
Allocation).
SYS_STR_ALLOC just grabs a LedgerNode, writes the bytes to the memory arena,
and returns the Handle. s blazingly fast, favoring CPU speed over RAM usage.It
Months later, your engine has 500,000 objects loaded. You notice string
duplication is eating up your memory arena.
Without rebooting, an admin or an automated system daemon executes a
hot-patch:
 * It loads the Aggressive_String_Interning x86 routine into executable
memory.
 * It executes an atomic CPU instruction to overwrite IVT[0x10] with the new
routine's memory address.
 * Instantly, the very next time any LPC script concatenates or creates a
string, it hashes it, checks the global pool, and returns a shared Handle.
If CPU usage spikes too high from the hashing overhead, you just swap the
pointer back. Absolute control.
3. The "Retroactive Interning" Superpower
Because we built the Global Handle Ledger in the previous step, you unlock a
massive system administration superpower.
If you swap to the aggressive interning routine, your new strings are
optimized, but your old strings are still duplicated. Because of the Ledger,
an admin can spawn a low-priority background LPC script that:
 * Walks the ACTIVE_HEAD ledger looking for String Handles.
 * Hashes them.
 * If it finds two identical strings, it redirects the variables pointing to
String B to point to String A.
 * It calls REF_DEC on String B, freeing the memory.
You can literally defragment and optimize your kernel's RAM from inside the
guest language, while the system is running.
The Next Step: The Scheduler & Event Loop
We now have a complete picture of the memory, execution, and state management.
The final core pillar of a MUD-driver or OS-kernel is Time and Concurrency.
In a traditional Node.js/V8 environment, you have an Event Loop. In a MUD
driver, you have a "Tick" or "Heartbeat" system. Since you want this to run
isomorphicly across bare-metal HAUKI-X86 and browsers, the execution scheduler
needs to be bulletproof.
If someone writes this in LPC:
void calculate_universe() {
    while(1) { /* infinite loop */ }
}

We need to guarantee it doesn't freeze the x86 Ring 0 kernel or lock up the
Chrome tab.
How should we implement Execution Limits (Gas/Ticks)?
 * Option A: The Instruction Counter (Gas). Every JIT'd loop or backward jump
includes a fast instruction that decrements a global TICK_COUNTER. If it hits
zero, it triggers the same Trap mechanism we designed for the Shadow Syielding
execution gracefully back to the host.tack
 * Option B: Timer Interrupts (Preemptive). On bare metal, we use a hardware
timer (e.g., APIC). Every 10ms, it fires a hardware interrupt, forcing the CPU
to suspend the JIT and check if the script has run too long. (Harder to make
perfectly isomorphic with JS).
Given the requirement for absolute isomorphism (Chrome V8 doesn't let you use
hardware interrupts), Option A (Instruction Counting / Gas) is usually
required, but it does add 1-2 CPU cycles of overhead to every loop.
How do you want to handle scheduling and infinite-loop prevention?