From af00e3b3f3c7c039e2ac53e700222516aff496cc Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 8 Nov 2015 08:09:54 +0000 Subject: [PATCH] clarify how a jit function table is declared, which has implications on whether a giant 256MB static buffer is allocated, which is causing problems when desmume is loaded as a DLL in 32bit systems. shouldnt affect the main windows or cocoa ports, but will cause other ports to take a different (safer and speed indeterminate) codepath. Build scripts must now make a choice to opt into the riskier behaviour. --- desmume/src/arm_jit.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/desmume/src/arm_jit.h b/desmume/src/arm_jit.h index fa8343ac5..60f07adb6 100644 --- a/desmume/src/arm_jit.h +++ b/desmume/src/arm_jit.h @@ -31,9 +31,21 @@ void arm_jit_close(); void arm_jit_sync(); template u32 arm_jit_compile(); -#if defined(HOST_WINDOWS) || defined(DESMUME_COCOA) +//#define MAPPED_JIT_FUNCS: to define or not to define? +//* x86 windows seems faster with NON-DEFINED +//* x64 windows seems faster with DEFINED +//* x86 windows seems to have problems without DEFINED when desmume is built as a dll due to the +// ~300 MB .bss section created by the 256MB non-mapped compiled_funcs table +// (when loaded as a dll into a busy process, that much contiguous address space is hard to find. No big deal when starting up a process) +//In principle, mapped compiled_funcs should be faster because it avoids some bit shifting logic to look it up from the memory map, right, +//but I guess it doesn't always work out that way. +// +//So here's my proposed policy. NON-DEFINED is dangerous due to the huge .bss section, so it should be the default +//The build system should #define JIT_FUNCS_FLAT to make the flat array +#ifndef JIT_FUNCS_FLAT #define MAPPED_JIT_FUNCS #endif + #ifdef MAPPED_JIT_FUNCS struct JIT_struct {