Enhance Usecode handling with new structures and caching mechanisms
- Introduced UsecodeSlotOwnerBuffers for managing descriptors and chunk states. - Added UsecodeSlotChunkCache class for efficient loading and unloading of event bodies. - Updated UsecodeClass to include extraSlotCount and adjusted related functions. - Implemented tests for new functionality, ensuring correct behavior of slot management and event loading.
This commit is contained in:
parent
08a907f322
commit
8c23bb02c9
5 changed files with 187 additions and 14 deletions
|
|
@ -55,6 +55,8 @@ Live runtime-helper classification added during the 2026-04-05 MCP-upgrade pass:
|
|||
- obtains the chunk through `UProcess_1420_0000` using the owner-row offset/size, materializes it through the owner-resource helper, and caches the returned far pointer in the slot entry
|
||||
- marks the chunk present through the slot-local state arrays and updates the runtime-wide budget counters
|
||||
- `GetSlotChunkPtrAtOffset` (`1420:1d72`) returns that allocator-produced pointer plus the caller's intra-chunk offset; it does not expose a stable file/archive address
|
||||
- `ReleaseSlotChunkRef` (`1420:1d8d`) decrements a positive chunk-state reference count and asserts on an unretained chunk
|
||||
- `TryUnloadSlotChunk` (`1420:1e17`) unloads only a zero-count chunk, restores its saved source pointer, resets the state to `0xffff`, and removes its loaded-list record
|
||||
- `1420:1f24 entity_vm_runtime_apply_to_matching_owner_rows`
|
||||
- runtime-owned iterator over the owner list, used both for broad cleanup and for filtered slot/category work
|
||||
- `1420:2040 entity_vm_slot_entry_create_or_clear`
|
||||
|
|
@ -137,6 +139,8 @@ The embedded interpreter initializes its stack limit to 199 bytes; the host boot
|
|||
|
||||
The host opcode service currently maps segment `0` to the task's item-memory buffer through `UsecodeProcessTask::readMappedItemWord`; all other segments are rejected. This centralizes the existing fixture behavior but is not a general segmented address space.
|
||||
|
||||
`UsecodeClass` now reads the first header dword as the extra-slot count. `initializeUsecodeSlotOwnerBuffers` copies the six-byte descriptors from class `+0x14` into a host buffer of `0xc0 + 6 * extraSlotCount` bytes and creates `32 + extraSlotCount` state words initialized to `0xffff`, matching `InitSlotOwnerBuffers`; retail `EVENT` and `NPCTRIG` cover the base and one-extra-slot cases. `UsecodeSlotChunkCache` reads descriptors through this buffer, tracks ensure/release counts, and unloads only at count zero, restoring the state sentinel so a later ensure reloads the body. This remains an archive-backed host model: the 0x16-byte `UProcess_1420_0000` object, owner-helper materialization, runtime loaded-list record, and far-pointer allocation/restoration are not implemented.
|
||||
|
||||
Current caution:
|
||||
|
||||
- context dispatch semantics are still active work, so this object should be modeled around lifecycle and data ownership first, not around final method names for every opcode-facing helper.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue