diff --git a/build.sh b/build.sh index 367f5981d..d4009b5a6 100755 --- a/build.sh +++ b/build.sh @@ -10,13 +10,25 @@ IOS_MIN_VERSION="15.0" IOS="ON" SYSTEM_NAME="iOS" RUN_BUILD="ON" +# Dynarec type: "jitless" (default), "jit", or "none" +DYNAREC_TYPE=${DYNAREC_TYPE:-"jitless"} + +# Set JIT flags based on dynarec type +if [ "$DYNAREC_TYPE" = "jitless" ]; then + USE_JIT="OFF" + NO_JIT="ON" + echo "🔧 Building with JITLESS dynarec" +else + USE_JIT="ON" + NO_JIT="OFF" + echo "🔧 Building with NO dynarec (interpreter only)" +fi # Initialize flags C_FLAGS="-arch ${ARCH} \ -DIOS \ --DTARGET_NO_REC=ON \ --DNO_JIT=ON \ --DUSE_JIT=OFF \ +-DNO_JIT=${NO_JIT} \ +-DUSE_JIT=${USE_JIT} \ -DTARGET_NO_NIXPROF \ -miphoneos-version-min=${IOS_MIN_VERSION} \ -fdata-sections \ @@ -36,10 +48,9 @@ C_FLAGS="-arch ${ARCH} \ CXX_FLAGS="-arch ${ARCH} \ -DIOS \ --DTARGET_NO_REC=ON \ --DNO_JIT=ON \ +-DNO_JIT=${NO_JIT} \ +-DUSE_JIT=${USE_JIT} \ -miphoneos-version-min=${IOS_MIN_VERSION} \ --DUSE_JIT=OFF \ -DTARGET_NO_NIXPROF \ -fdata-sections \ -ffast-math \ @@ -171,8 +182,11 @@ CMAKE_CMD="cmake -B ${BUILD_DIR} \ -DCMAKE_CXX_FLAGS=\"${CXX_FLAGS}\" \ -DIOS=${IOS} \ -DCMAKE_SYSTEM_NAME=${SYSTEM_NAME} \ - -DENABLE_SH4_CACHED_IR=ON \ - -DNO_JIT=ON \ + -DENABLE_SH4_CACHED_IR=OFF \ + -DNO_JIT=${NO_JIT} \ + -DUSE_JIT=${USE_JIT} \ + -DENABLE_LTO=ON \ + -DUSE_LINK_TIME_OPTIMIZATION=ON \ -DCMAKE_POLICY_VERSION_MINIMUM=3.5" # Add linker flags if provided diff --git a/core/cfg/option.cpp b/core/cfg/option.cpp index eb06c2509..28ad73c70 100644 --- a/core/cfg/option.cpp +++ b/core/cfg/option.cpp @@ -24,7 +24,7 @@ namespace config { // Dynarec -Option DynarecEnabled("Dynarec.Enabled", true); +Option DynarecEnabled("Dynarec.Enabled", false); Option Sh4Clock("Sh4Clock", 200); // General diff --git a/core/emulator.cpp b/core/emulator.cpp index 33deed8d5..695fee45f 100644 --- a/core/emulator.cpp +++ b/core/emulator.cpp @@ -503,15 +503,15 @@ void Emulator::init() else #endif // FEAT_SHREC != DYNAREC_NONE { -#ifdef ENABLE_SH4_CACHED_IR - INFO_LOG(INTERPRETER, "Using new Cached Interpreter"); - sh4::ir::Get_Sh4Interpreter(&sh4_cpu); - sh4_cpu.Init(); -#else +// #ifdef ENABLE_SH4_CACHED_IR +// INFO_LOG(INTERPRETER, "Using new Cached Interpreter"); +// sh4::ir::Get_Sh4Interpreter(&sh4_cpu); +// sh4_cpu.Init(); +// #else Get_Sh4Interpreter(&sh4_cpu); sh4_cpu.Init(); INFO_LOG(INTERPRETER, "Using Interpreter"); -#endif // ENABLE_SH4_CACHED_IR +// #endif // ENABLE_SH4_CACHED_IR } state = Init; @@ -959,13 +959,13 @@ void Emulator::start() else #endif // FEAT_SHREC != DYNAREC_NONE { -#if defined(ENABLE_SH4_CACHED_IR) - sh4::ir::Get_Sh4Interpreter(&sh4_cpu); - INFO_LOG(DYNAREC, "Using NEW Cached Interpreter"); -#else +// #if defined(ENABLE_SH4_CACHED_IR) +// sh4::ir::Get_Sh4Interpreter(&sh4_cpu); +// INFO_LOG(DYNAREC, "Using NEW Cached Interpreter"); +// #else Get_Sh4Interpreter(&sh4_cpu); INFO_LOG(DYNAREC, "Using LEGACY Interpreter"); -#endif // ENABLE_SH4_CACHED_IR +// #endif // ENABLE_SH4_CACHED_IR } setupPtyPipe(); diff --git a/core/hw/sh4/dyna/driver.cpp b/core/hw/sh4/dyna/driver.cpp index eaf4b6eff..842d75943 100644 --- a/core/hw/sh4/dyna/driver.cpp +++ b/core/hw/sh4/dyna/driver.cpp @@ -514,11 +514,11 @@ static void recSh4_Reset(bool hard) static void recSh4_Init() { INFO_LOG(DYNAREC, "recSh4 Init"); -#ifdef ENABLE_SH4_CACHED_IR - sh4::ir::Get_Sh4Interpreter(&sh4Interp); -#else +// #ifdef ENABLE_SH4_CACHED_IR + // sh4::ir::Get_Sh4Interpreter(&sh4Interp); +// #else Get_Sh4Interpreter(&sh4Interp); -#endif +// #endif sh4Interp.Init(); bm_Init(); diff --git a/core/hw/sh4/dyna_jitless/driver_jitless.cpp b/core/hw/sh4/dyna_jitless/driver_jitless.cpp index 00aabb4ad..8770d97ad 100644 --- a/core/hw/sh4/dyna_jitless/driver_jitless.cpp +++ b/core/hw/sh4/dyna_jitless/driver_jitless.cpp @@ -970,11 +970,11 @@ static void recSh4_Reset(bool hard) static void recSh4_Init() { INFO_LOG(DYNAREC, "recSh4 Init"); -#ifdef ENABLE_SH4_CACHED_IR - sh4::ir::Get_Sh4Interpreter(&sh4Interp); -#else +// #ifdef ENABLE_SH4_CACHED_IR + // sh4::ir::Get_Sh4Interpreter(&sh4Interp); +// #else Get_Sh4Interpreter(&sh4Interp); -#endif +// #endif sh4Interp.Init(); bm_Init(); diff --git a/core/hw/sh4/sh4_if.h b/core/hw/sh4/sh4_if.h index fd4c2d938..46c52dfb7 100644 --- a/core/hw/sh4/sh4_if.h +++ b/core/hw/sh4/sh4_if.h @@ -316,9 +316,9 @@ static inline void sh4_sr_SetFull(u32 value) #define sh4rcb (*p_sh4rcb) #define Sh4cntx (sh4rcb.cntx) -#ifdef ENABLE_SH4_CACHED_IR -namespace sh4 { namespace ir { void Get_Sh4Interpreter(sh4_if* cpu); } } -#endif +// #ifdef ENABLE_SH4_CACHED_IR +// namespace sh4 { namespace ir { void Get_Sh4Interpreter(sh4_if* cpu); } } +// #endif //Get an interface to sh4 interpreter void Get_Sh4Interpreter(sh4_if* cpu); diff --git a/shell/libretro/option.cpp b/shell/libretro/option.cpp index 0e2569abd..ddef6696f 100644 --- a/shell/libretro/option.cpp +++ b/shell/libretro/option.cpp @@ -23,7 +23,7 @@ namespace config { // Dynarec -Option DynarecEnabled("", true); +Option DynarecEnabled("", false); IntOption Sh4Clock(CORE_OPTION_NAME "_sh4clock", 200); // General diff --git a/tests/test.sh b/tests/test.sh index 4968ff442..fe15c5eb7 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -127,6 +127,7 @@ fi -DUSE_JIT=${USE_JIT} \ -DNO_JIT=${NO_JIT} \ -DUSE_BREAKPAD=OFF \ + -DENABLE_SH4_JITLESS=OFF \ -DTARGET_NO_NIXPROF=ON \ -DNGGEN_ARM64=$( [ "${ARCH}" = "arm64" ] && echo ON || echo OFF ) \ -DENABLE_LOG=${ENABLE_LOG} \