From fb46370e561bb74cca908980531b6092a34cf673 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Mon, 16 May 2011 19:31:07 +0200 Subject: Cleanup of target dependencies. --- src/lj_mcode.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'src/lj_mcode.c') diff --git a/src/lj_mcode.c b/src/lj_mcode.c index 8d0f7213..279854f8 100644 --- a/src/lj_mcode.c +++ b/src/lj_mcode.c @@ -162,20 +162,7 @@ static void mcode_protect(jit_State *J, int prot) #define mcode_validptr(p) ((p) && (uintptr_t)(p) < 0xffff0000) #endif -#if LJ_TARGET_X64 -#define MCODE_JUMPRANGE 31 -#elif LJ_TARGET_ARM -#define MCODE_JUMPRANGE 26 -#else -#define MCODE_JUMPRANGE 32 -#endif - -#if MCODE_JUMPRANGE == 32 - -/* All 32 bit memory addresses are reachable by relative jumps. */ -#define mcode_alloc(J, sz) mcode_alloc_at((J), 0, (sz), MCPROT_GEN) - -#else +#ifdef LJ_TARGET_JUMPRANGE /* Get memory within relative jump distance of our code in 64 bit mode. */ static void *mcode_alloc(jit_State *J, size_t sz) @@ -184,7 +171,7 @@ static void *mcode_alloc(jit_State *J, size_t sz) ** Try addresses within a distance of target-range/2+1MB..target+range/2-1MB. */ uintptr_t target = (uintptr_t)(void *)lj_vm_exit_handler & ~(uintptr_t)0xffff; - const uintptr_t range = (1u << MCODE_JUMPRANGE) - (1u << 21); + const uintptr_t range = (1u << LJ_TARGET_JUMPRANGE) - (1u << 21); /* First try a contiguous area below the last one. */ uintptr_t hint = J->mcarea ? (uintptr_t)J->mcarea - sz : 0; int i; @@ -208,6 +195,11 @@ static void *mcode_alloc(jit_State *J, size_t sz) return NULL; } +#else + +/* All memory addresses are reachable by relative jumps. */ +#define mcode_alloc(J, sz) mcode_alloc_at((J), 0, (sz), MCPROT_GEN) + #endif /* -- MCode area management ----------------------------------------------- */ -- cgit v1.2.3-55-g6feb