mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 10:00:16 +02:00
CodeCache: Switch between 32-/64-bit compilers during cache generation
This commit is contained in:
1 parent
8b8000b98a
commit
66455b708a
3 files changed
+21
-7
No files matched your search
@@ -9,6 +9,11 @@ target_link_libraries(FEXOfflineCompiler PRIVATE
|
||||
fmt::fmt)
|
||||
|
||||
if (MINGW)
|
||||
if (ARCHITECTURE_arm64ec)
|
||||
set_target_properties(FEXOfflineCompiler PROPERTIES OUTPUT_NAME "FEXOfflineCompiler64")
|
||||
else()
|
||||
set_target_properties(FEXOfflineCompiler PROPERTIES OUTPUT_NAME "FEXOfflineCompiler32")
|
||||
endif()
|
||||
patch_library_wine(FEXOfflineCompiler)
|
||||
target_include_directories(FEXOfflineCompiler PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}/Source/Windows/include/"
|
||||
|
||||
@@ -51,6 +51,14 @@ static std::unique_ptr<FEX::Windows::OvercommitTracker> OvercommitTracker;
|
||||
#endif
|
||||
static FEXCore::Core::InternalThreadState* Thread = nullptr;
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _M_ARM64EC
|
||||
const bool Is64BitCompiler = true;
|
||||
#else
|
||||
const bool Is64BitCompiler = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
class AOTSyscallHandler : public FEXCore::HLE::SyscallHandler {
|
||||
#else
|
||||
@@ -396,10 +404,8 @@ static std::optional<std::string> GenerateSingleCache(FEXCore::ExecutableFileInf
|
||||
return std::nullopt;
|
||||
}
|
||||
const bool Is64Bit = Loader.Is64BitMode();
|
||||
#elif defined(_M_ARM64EC)
|
||||
const bool Is64Bit = true;
|
||||
#else
|
||||
const bool Is64Bit = false;
|
||||
const bool Is64Bit = Is64BitCompiler;
|
||||
#endif
|
||||
FEXCore::Config::Set(FEXCore::Config::CONFIG_IS64BIT_MODE, Is64Bit ? "1" : "0");
|
||||
|
||||
@@ -774,11 +780,13 @@ static int ProcessAll() {
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// For WoA, spawn a subprocess for each cache generation run to
|
||||
// ensure robustness against JIT crashes.
|
||||
// For WoA, spawn a subprocess for each cache generation run.
|
||||
// This ensures robustness and allows for switching FEXOfflineCompiler between WoW64 and ARM64EC.
|
||||
char SelfPathRaw[PATH_MAX];
|
||||
GetModuleFileNameA(nullptr, SelfPathRaw, sizeof(SelfPathRaw));
|
||||
std::string SelfPath = SelfPathRaw;
|
||||
auto NewExecName = fmt::format("FEXOfflineCompiler{}.exe", ExecutableIt->second.ExecutableBitness.value());
|
||||
SelfPath.replace(SelfPath.size() - NewExecName.size(), NewExecName.size(), NewExecName);
|
||||
#endif
|
||||
|
||||
fmt::println("\nChecking caches for executable {}", ExecutableIt->second.Filename);
|
||||
|
||||
@@ -227,8 +227,9 @@ int ImageTracker::OpenCodeMapFile() {
|
||||
|
||||
void ImageTracker::LoadAOTImages(MappedImageInfo& ImageInfo) {
|
||||
// Don't attempt cache loading for FEXOfflineCompiler itself
|
||||
static bool IsFOC = ImageInfo.Info.Filename.ends_with("fexofflinecompiler.exe");
|
||||
if (IsFOC) {
|
||||
static bool IsFOC32 = ImageInfo.Info.Filename.ends_with("fexofflinecompiler32.exe");
|
||||
static bool IsFOC64 = ImageInfo.Info.Filename.ends_with("fexofflinecompiler64.exe");
|
||||
if (IsFOC32 || IsFOC64) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user