MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / CompileAndGetStats

Method CompileAndGetStats

Source/Tools/CodeSizeValidation/Main.cpp:47–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45 bool ParseMessage(const char* Message);
46
47 InstructionData CompileAndGetStats(FEXCore::Context::Context* CTX, FEXCore::Core::InternalThreadState* Thread, const void* Data,
48 size_t SizeBytes, int32_t MaxInst = -1) {
49 if (SizeBytes > MAX_CODE_SIZE) {
50 LogMan::Msg::AFmt("x86 code too large!");
51 }
52
53 {
54 auto CodeInvalidationlk = FEXCore::GuardSignalDeferringSection(CTX->GetCodeInvalidationMutex(), Thread);
55 FEXCore::Context::InvalidatedEntryAccumulator Accumulator;
56 CTX->InvalidateGuestCodeRange(Thread, Accumulator, reinterpret_cast<uint64_t>(CodeStart), MAX_CODE_SIZE);
57 }
58
59 ClearStats();
60 memcpy(CodeStart, Data, SizeBytes);
61
62 if (MaxInst == -1) {
63 // Compile the NOP.
64 CTX->CompileRIP(Thread, reinterpret_cast<uint64_t>(CodeStart));
65 } else {
66 CTX->CompileRIPCount(Thread, reinterpret_cast<uint64_t>(CodeStart), MaxInst);
67 }
68 return CurrentStats;
69 }
70
71 bool InfoPrintingDisabled() const {
72 return SetupInfoDisabled;

Callers 1

TestInstructionsFunction · 0.80

Calls 5

AFmtFunction · 0.85
CompileRIPMethod · 0.80
CompileRIPCountMethod · 0.80

Tested by 1

TestInstructionsFunction · 0.64