Skip to content

Commit

Permalink
Merge pull request #4180 from Sonicadvance1/fexcore_const_ptr_ctx
Browse files Browse the repository at this point in the history
FEXCore: Constify CTX ptr in InternalThreadState
  • Loading branch information
Sonicadvance1 authored Nov 29, 2024
2 parents aa2180d + 969cae5 commit 649a494
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions FEXCore/Source/Interface/Core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,6 @@ void ContextImpl::InitializeCompiler(FEXCore::Core::InternalThreadState* Thread)

Dispatcher->InitThreadPointers(Thread);

Thread->CTX = this;

Thread->PassManager->AddDefaultPasses(this);
Thread->PassManager->AddDefaultValidationPasses();

Expand All @@ -410,7 +408,9 @@ void ContextImpl::InitializeCompiler(FEXCore::Core::InternalThreadState* Thread)

FEXCore::Core::InternalThreadState*
ContextImpl::CreateThread(uint64_t InitialRIP, uint64_t StackPointer, const FEXCore::Core::CPUState* NewThreadState, uint64_t ParentTID) {
FEXCore::Core::InternalThreadState* Thread = new FEXCore::Core::InternalThreadState {};
FEXCore::Core::InternalThreadState* Thread = new FEXCore::Core::InternalThreadState {
.CTX = this,
};

Thread->CurrentFrame->State.gregs[X86State::REG_RSP] = StackPointer;
Thread->CurrentFrame->State.rip = InitialRIP;
Expand Down
2 changes: 1 addition & 1 deletion FEXCore/include/FEXCore/Debug/InternalThreadState.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct InternalThreadState : public FEXCore::Allocator::FEXAllocOperators {
std::atomic_bool ThreadSleeping {false};
} RunningEvents;

FEXCore::Context::Context* CTX;
FEXCore::Context::Context* const CTX;

NonMovableUniquePtr<FEXCore::Threads::Thread> ExecutionThread;
bool StartPaused {false};
Expand Down

0 comments on commit 649a494

Please sign in to comment.