Skip to content

Commit

Permalink
Disable mult/div and memset optimizations when debugging Lightrec
Browse files Browse the repository at this point in the history
These optimizations cause Lightrec's interpreter and dynarec to have
different behaviours.

Signed-off-by: Paul Cercueil <[email protected]>
  • Loading branch information
pcercuei committed Jan 20, 2025
1 parent 98e20e6 commit 3f89beb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ LIGHTREC_CODE_INV ?= 0
CFLAGS += -DLIGHTREC_CUSTOM_MAP=$(LIGHTREC_CUSTOM_MAP) \
-DLIGHTREC_CODE_INV=$(LIGHTREC_CODE_INV) \
-DLIGHTREC_ENABLE_THREADED_COMPILER=$(LIGHTREC_THREADED_COMPILER) \
-DLIGHTREC_ENABLE_DISASSEMBLER=$(or $(LIGHTREC_DEBUG),0)
-DLIGHTREC_ENABLE_DISASSEMBLER=$(or $(LIGHTREC_DEBUG),0) \
-DLIGHTREC_NO_DEBUG=$(if $(LIGHTREC_DEBUG),0,1)
ifeq ($(LIGHTREC_CUSTOM_MAP),1)
LDLIBS += -lrt
OBJS += $(LIGHTREC_CUSTOM_MAP_OBJ)
Expand Down
4 changes: 2 additions & 2 deletions include/lightrec/lightrec-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
#define HAS_DEFAULT_ELM 1

#define OPT_REMOVE_DIV_BY_ZERO_SEQ 1
#define OPT_REPLACE_MEMSET 1
#define OPT_REPLACE_MEMSET LIGHTREC_NO_DEBUG
#define OPT_DETECT_IMPOSSIBLE_BRANCHES 1
#define OPT_HANDLE_LOAD_DELAYS 1
#define OPT_TRANSFORM_OPS 1
#define OPT_LOCAL_BRANCHES 1
#define OPT_SWITCH_DELAY_SLOTS 1
#define OPT_FLAG_IO 1
#define OPT_FLAG_MULT_DIV 1
#define OPT_FLAG_MULT_DIV LIGHTREC_NO_DEBUG
#define OPT_EARLY_UNLOAD 1
#define OPT_PRELOAD_PC 1

Expand Down
2 changes: 1 addition & 1 deletion jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ HAVE_ARI64=0
HAVE_LIGHTREC=0
LIGHTREC_CUSTOM_MAP=0
LIGHTREC_THREADED_COMPILER=0
LIGHTREC_DEBUG=0
HAVE_GPU_NEON=0
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
HAVE_ARI64=1
Expand All @@ -156,6 +155,7 @@ endif
COREFLAGS += -DLIGHTREC_CUSTOM_MAP=$(LIGHTREC_CUSTOM_MAP)
COREFLAGS += -DLIGHTREC_ENABLE_THREADED_COMPILER=$(LIGHTREC_THREADED_COMPILER)
COREFLAGS += -DLIGHTREC_ENABLE_DISASSEMBLER=$(or $(LIGHTREC_DEBUG),0)
COREFLAGS += -DLIGHTREC_NO_DEBUG=$(if $(LIGHTREC_DEBUG),0,1)

ifeq ($(HAVE_ARI64),1)
SOURCES_C += $(DYNAREC_DIR)/new_dynarec.c \
Expand Down

0 comments on commit 3f89beb

Please sign in to comment.