Free host: out-call lookups hashed; FlushCache known by address, not by a string search at every kernel call

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Thomas MartinandClaude Opus 5.5 committed 2026-11-04 23:15:23 +01:00
1 parent 171389f470
commit b9ad0dd56e
2 files changed
+9 -3

No files matched your search

+3 -1
View File
@@ -96,6 +96,8 @@ namespace bozo::host
if (const ee::KernelCall k = ee::kernelCallByName(name); k != ee::KernelCall::None)
{
d.bindKernelCall(a, k);
if (name.find("FlushCache") != std::string::npos)
flushCacheAt_.insert(a);
continue;
}
// A library BozoEngine implements; anything else (an override address the port registered nothing at, a
@@ -290,7 +292,7 @@ namespace bozo::host
void FreeHost::kernelCallEnd(ee::Dispatcher &, R5900Context *, uint32_t target, bool)
{
++stats_.kernelCalls;
if (auto n = names_.find(target); n != names_.end() && n->second.find("FlushCache") != std::string::npos)
if (flushCacheAt_.count(target))
libs_.io.flushCache();
}
+6 -2
View File
@@ -17,6 +17,8 @@
#include <functional>
#include <map>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
namespace bozo::host
@@ -115,8 +117,10 @@ namespace bozo::host
FreeOptions opt_;
ee::Dispatcher *d_ = nullptr;
libs::Libraries libs_;
std::map<uint32_t, port::Function> portAt_;
std::map<uint32_t, const libs::Function *> nativeAt_;
// Looked up at every out-call (a few thousand a frame in a match): hashed.
std::unordered_map<uint32_t, port::Function> portAt_;
std::unordered_map<uint32_t, const libs::Function *> nativeAt_;
std::unordered_set<uint32_t> flushCacheAt_; // the kernel's FlushCache entries (kernelCallEnd)
std::map<uint32_t, std::string> names_;
std::map<uint32_t, uint64_t> perOverride_;
uint32_t insideDepth_ = 0;