Skip to content

Commit d377e26

Browse files
committed
Reset MMXState to X87 at the start of each block
Ensures that blocks always start with the same state independently of predecessors which allows independent compilation of blocks. Starting in the X87 state is better than starting in MMX state because MMX state is more work to initialize.
1 parent 8864637 commit d377e26

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎FEXCore/Source/Interface/Core/OpcodeDispatcher.h

+11
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,16 @@ class OpDispatchBuilder final : public IREmitter {
112112
// Changes get stored out by CalculateDeferredFlags.
113113
CachedNZCV = nullptr;
114114
CFInverted = CFInvertedABI;
115+
115116
FlushRegisterCache();
116117

118+
// Start block in X87 state.
119+
// This is important to ensure that blocks always start with the same state independently of predecessors
120+
// which allows independent compilation of blocks.
121+
// Starting in the X87 state is better than starting in MMX state because
122+
// MMX state is more work to initialize.
123+
MMXState = MMXState_X87;
124+
117125
// New block needs to reset segment telemetry.
118126
SegmentsNeedReadCheck = ~0U;
119127

@@ -2341,6 +2349,9 @@ class OpDispatchBuilder final : public IREmitter {
23412349

23422350
void ChgStateMMX_X87() override {
23432351
LOGMAN_THROW_A_FMT(MMXState == MMXState_MMX, "Expected state to be MMX");
2352+
// We explicitly initialize to x87 state in StartNewBlock.
2353+
// So if we ever change this to do something else, we need to
2354+
// make sure that we consider if we need to explicitly set it there.
23442355
FlushRegisterCache();
23452356
MMXState = MMXState_X87;
23462357
}

0 commit comments

Comments
 (0)