FEXCore/SharedCodeBufferManager: Pivot what tracks memory allocations

It's soon going to change how these buffers are managed, where the
CodeBuffer is going to manage its own allocations soon once it changes
over to the bitmap allocator. Additionally the Manager class is actually
going to do proper management, pooling, and invalidation handling.

Split the task preemptively before we switch to the bitmap allocator to
reduce churn. A little change in the CodeCache where it needs to query
the codebuffer directly rather than the context, but fairly safe.

Shouldn't be any real behaviour change.
This commit is contained in:
Ryan Houdek committed 2026-08-20 16:35:28 -07:00
1 parent f50279a2e7
commit c9c5a75b76
5 files changed
+45 -43

No files matched your search

@@ -34,6 +34,9 @@ CodeBuffer::CodeBuffer(size_t Size)
FEXCore::Allocator::VirtualTHPControl(Ptr, Size, FEXCore::Allocator::THPControl::Enable);
LookupCache = fextl::make_unique<GuestToHostMap>();
CodeBufferEnd = Ptr + UsableSize();
CodeBufferOffset = Ptr;
}
CodeBuffer::~CodeBuffer() {
@@ -66,9 +69,6 @@ fextl::shared_ptr<CodeBuffer> SharedCodeBufferManager::AllocateNew(size_t Size)
auto Buffer = fextl::make_shared<CodeBuffer>(Size);
Latest = Buffer;
CodeBufferBase = Buffer->Ptr;
CodeBufferEnd = Buffer->Ptr + Buffer->UsableSize();
CodeBufferOffset = CodeBufferBase;
OnCodeBufferAllocated(Buffer);