Skip to content

Commit

Permalink
Merge pull request FEX-Emu#4362 from neobrain/refactor_remove_unused
Browse files Browse the repository at this point in the history
Remove unused code in various places
  • Loading branch information
Sonicadvance1 authored Feb 17, 2025
2 parents d14b6e1 + bb30a2e commit 6b82664
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 22 deletions.
4 changes: 0 additions & 4 deletions CodeEmitter/CodeEmitter/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ class Buffer {

protected:

void ResetBuffer() {
CurrentOffset = BufferBase;
}

uint8_t* BufferBase;
uint8_t* CurrentOffset;
uint64_t Size;
Expand Down
4 changes: 0 additions & 4 deletions FEXCore/Source/Interface/Context/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,6 @@ class ContextImpl final : public FEXCore::Context::Context {
~ContextImpl();

static void ThreadRemoveCodeEntry(FEXCore::Core::InternalThreadState* Thread, uint64_t GuestRIP);
static void ThreadAddBlockLink(FEXCore::Core::InternalThreadState* Thread, uint64_t GuestDestination,
FEXCore::Context::ExitFunctionLinkData* HostLink, const BlockDelinkerFunc& delinker);

template<auto Fn>
static uint64_t ThreadExitFunctionLink(FEXCore::Core::CpuStateFrame* Frame, ExitFunctionLinkData* Record) {
Expand Down Expand Up @@ -360,8 +358,6 @@ class ContextImpl final : public FEXCore::Context::Context {
*/
void InitializeCompiler(FEXCore::Core::InternalThreadState* Thread);

void AddBlockMapping(FEXCore::Core::InternalThreadState* Thread, uint64_t Address, void* Ptr);

IR::AOTIRCaptureCache IRCaptureCache;
fextl::unique_ptr<FEXCore::CodeSerialize::CodeObjectSerializeService> CodeObjectCacheService;

Expand Down
15 changes: 1 addition & 14 deletions FEXCore/Source/Interface/Core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,6 @@ void ContextImpl::LockBeforeFork(FEXCore::Core::InternalThreadState* Thread) {
}
#endif

void ContextImpl::AddBlockMapping(FEXCore::Core::InternalThreadState* Thread, uint64_t Address, void* Ptr) {
Thread->LookupCache->AddBlockMapping(Address, Ptr);
}

void ContextImpl::ClearCodeCache(FEXCore::Core::InternalThreadState* Thread) {
FEXCORE_PROFILE_INSTANT("ClearCodeCache");

Expand Down Expand Up @@ -845,7 +841,7 @@ uintptr_t ContextImpl::CompileBlock(FEXCore::Core::CpuStateFrame* Frame, uint64_

// Insert to lookup cache
// Pages containing this block are added via AddBlockExecutableRange before each page gets accessed in the frontend
AddBlockMapping(Thread, GuestRIP, CodePtr);
Thread->LookupCache->AddBlockMapping(GuestRIP, CodePtr);

return (uintptr_t)CodePtr;
}
Expand Down Expand Up @@ -909,19 +905,10 @@ void ContextImpl::MarkMemoryShared(FEXCore::Core::InternalThreadState* Thread) {
}
}

void ContextImpl::ThreadAddBlockLink(FEXCore::Core::InternalThreadState* Thread, uint64_t GuestDestination,
FEXCore::Context::ExitFunctionLinkData* HostLink, const FEXCore::Context::BlockDelinkerFunc& delinker) {
auto lk = GuardSignalDeferringSection<std::shared_lock>(static_cast<ContextImpl*>(Thread->CTX)->CodeInvalidationMutex, Thread);

Thread->LookupCache->AddBlockLink(GuestDestination, HostLink, delinker);
}

void ContextImpl::ThreadRemoveCodeEntry(FEXCore::Core::InternalThreadState* Thread, uint64_t GuestRIP) {
LogMan::Throw::AFmt(static_cast<ContextImpl*>(Thread->CTX)->CodeInvalidationMutex.try_lock() == false, "CodeInvalidationMutex needs to "
"be unique_locked here");

std::lock_guard<std::recursive_mutex> lk(Thread->LookupCache->WriteLock);

Thread->LookupCache->Erase(Thread->CurrentFrame, GuestRIP);
}

Expand Down

0 comments on commit 6b82664

Please sign in to comment.