Skip to content

Commit

Permalink
Core: remove usage of g_RecompPos
Browse files Browse the repository at this point in the history
  • Loading branch information
project64 committed May 16, 2024
1 parent 7f18773 commit a1f4635
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion Source/Project64-core/N64System/N64System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,6 @@ bool CN64System::SetActiveSystem(bool bActive)
g_Plugins = m_Plugins;
g_TLBLoadAddress = &m_TLBLoadAddress;
g_TLBStoreAddress = &m_TLBStoreAddress;
g_RecompPos = m_Recomp ? m_Recomp->RecompPos() : nullptr;
g_Random = &m_Random;
}
else
Expand Down
4 changes: 3 additions & 1 deletion Source/Project64-core/N64System/Recompiler/CodeBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <Project64-core/N64System/N64System.h>
#include <Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.h>
#include <Project64-core/N64System/Recompiler/CodeBlock.h>
#include <Project64-core/N64System/Recompiler/Recompiler.h>
#include <Project64-core/N64System/Recompiler/x86/x86RecompilerOps.h>
#include <Project64-core/N64System/SystemGlobals.h>
#include <string.h>
Expand All @@ -14,6 +15,7 @@ extern "C" void __clear_cache_android(uint8_t * begin, uint8_t * end);
#endif

CCodeBlock::CCodeBlock(CN64System & System, uint32_t VAddrEnter) :
m_Recompiler(*System.m_Recomp),
m_MMU(System.m_MMU_VM),
m_Reg(System.m_Reg),
m_VAddrEnter(VAddrEnter),
Expand Down Expand Up @@ -908,7 +910,7 @@ uint32_t CCodeBlock::Finilize(uint8_t * CompiledLocation)
m_CodeHolder.relocateToBase((uint64_t)m_CompiledLocation);
size_t codeSize = m_CodeHolder.codeSize();
m_CodeHolder.copyFlattenedData(m_CompiledLocation, codeSize, asmjit::CopySectionFlags::kPadSectionBuffer);
*g_RecompPos += codeSize;
*m_Recompiler.RecompPos() += codeSize;

#if defined(ANDROID) && (defined(__arm__) || defined(_M_ARM))
__clear_cache((uint8_t *)((uint32_t)m_CompiledLocation & ~1), m_CompiledLocation + codeSize);
Expand Down
2 changes: 2 additions & 0 deletions Source/Project64-core/N64System/Recompiler/CodeBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#endif

class CMipsMemoryVM;
class CRecompiler;

class CCodeBlock :
public asmjit::ErrorHandler
Expand Down Expand Up @@ -119,6 +120,7 @@ class CCodeBlock :
typedef std::map<uint32_t, CCodeSection *> SectionMap;
typedef std::list<CCodeSection *> SectionList;

CRecompiler & m_Recompiler;
CMipsMemoryVM & m_MMU;
CRegisters & m_Reg;
SectionMap m_SectionMap;
Expand Down
4 changes: 2 additions & 2 deletions Source/Project64-core/N64System/Recompiler/Recompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ CCompiledFunc * CRecompiler::CompileCode()
ShowMemUsed();
}

uint32_t CodeLen = CodeBlock.Finilize(*g_RecompPos);
*g_RecompPos += CodeLen;
uint32_t CodeLen = CodeBlock.Finilize(*RecompPos());
*RecompPos() += CodeLen;
LogCodeBlock(CodeBlock);

if (bSMM_StoreInstruc())
Expand Down
1 change: 0 additions & 1 deletion Source/Project64-core/N64System/SystemGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ CSystemTimer * g_SystemTimer = nullptr;
uint32_t * g_TLBLoadAddress = nullptr;
uint32_t * g_TLBStoreAddress = nullptr;
CDebugger * g_Debugger = nullptr;
uint8_t ** g_RecompPos = nullptr;
CMempak * g_Mempak = nullptr;
CRandom * g_Random = nullptr;
CEnhancements * g_Enhancements = nullptr;
Expand Down
2 changes: 0 additions & 2 deletions Source/Project64-core/N64System/SystemGlobals.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ extern uint32_t * g_TLBStoreAddress;
__interface CDebugger;
extern CDebugger * g_Debugger;

extern uint8_t ** g_RecompPos;

class CMempak;
extern CMempak * g_Mempak;

Expand Down

0 comments on commit a1f4635

Please sign in to comment.