From c504df473d11649f95e6c21c9fb22cb664781af2 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 20 Jul 2004 03:53:49 +0000 Subject: [PATCH] Removed PM's original "GCC JIT" implementations. --- amxmodx/Makefile | 6 +++--- amxmodx/amx.cpp | 49 +++++++++--------------------------------------- amxmodx/amx.h | 2 ++ 3 files changed, 14 insertions(+), 43 deletions(-) diff --git a/amxmodx/Makefile b/amxmodx/Makefile index 1cde75dc..31324c62 100755 --- a/amxmodx/Makefile +++ b/amxmodx/Makefile @@ -61,7 +61,7 @@ OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o) OBJC_WIN32 := $(CSRCFILES:%.c=$(OBJDIR_WIN32)/%.o) -CCOPT = -g -ggdb3 -DMEMORY_TEST +CCOPT = -march=i386 -O2 -s -DNDEBUG INCLUDEDIRS=-I../curl/include -I$(SRCDIR) -I$(METADIR) -I$(SDKSRC)/engine -I$(SDKSRC)/common -I$(SDKSRC)/pm_shared -I$(SDKSRC)/dlls -I$(SDKSRC) $(EXTRA_INCLUDEDIRS) CFLAGS=-Wall -Wno-unknown-pragmas @@ -70,7 +70,7 @@ CFLAGS:=$(CCOPT) $(CFLAGS) $(ODEF) $(EXTRA_FLAGS) DO_CC_LINUX=$(CC_LINUX) $(CFLAGS) -fPIC $(INCLUDEDIRS) -o $@ -c $< DO_CC_WIN32=$(CC_WIN32) $(CFLAGS) $(INCLUDEDIRS) -o $@ -c $< -LINK_LINUX=$(CC_LINUX) $(CFLAGS) -shared -ldl -lm -lstdc++ $(OBJ_LINUX) $(OBJC_LINUX) $(EXTRA_LIBDIRS_LINUX) $(EXTRA_LIBS_LINUX) -o $@ +LINK_LINUX=$(CC_LINUX) $(CFLAGS) -shared -ldl -lm $(OBJ_LINUX) $(OBJC_LINUX) $(EXTRA_LIBDIRS_LINUX) $(EXTRA_LIBS_LINUX) jits.o -o $@ LINK_WIN32=$(LD_WINDLL) -mwindows --def $(MODNAME).def --add-stdcall-alias $(OBJ_WIN32) $(OBJC_WIN32) $(EXTRA_LIBDIRS_WIN32) $(EXTRA_LIBS_WIN32) -o $@ $(OBJDIR_LINUX)/%.o: $(SRCDIR)/%.c @@ -114,4 +114,4 @@ clean_both: clean_win32: del /q $(OBJDIR_WIN32) - \ No newline at end of file + diff --git a/amxmodx/amx.cpp b/amxmodx/amx.cpp index db296e9c..4a044c58 100755 --- a/amxmodx/amx.cpp +++ b/amxmodx/amx.cpp @@ -562,11 +562,8 @@ static int amx_BrowseRelocate(AMX *amx) } /* if */ #if defined __GNUC__ || defined ASM32 || defined JIT /* relocate symbol */ - #if defined JIT && defined __linux__ - #else *(cell *)(code+(int)cip) = opcode_list[op]; #endif - #endif #if defined JIT opcode_count++; #endif @@ -788,10 +785,6 @@ static int amx_BrowseRelocate(AMX *amx) } /* for */ #if defined JIT - #if defined __linux__ - // HACK: Determine maxcodesize - asm_runJIT(NULL, NULL, NULL); - #endif amx->code_size = getMaxCodeSize()*opcode_count + hdr->cod + (hdr->stp - hdr->dat); amx->reloc_size = 2*sizeof(cell)*reloc_count; @@ -1056,40 +1049,16 @@ int AMXAPI amx_Init(AMX *amx,void *program) } #else /* #if defined __WIN32 __ */ - - // TODO: Add cases for Linux, Unix, OS/2, ... - #if defined __linux__ - int memoryFullAccess(void* addr, int len) - { - //int oldProt = get_page_prot(addr); - void* newAddr = (void*) ((int)addr - (int)addr % getpagesize()); - len += (int)addr % getpagesize(); - if (mprotect(newAddr, len, PROT_READ | PROT_WRITE | PROT_EXEC) != -1) - return PROT_READ | PROT_WRITE | PROT_EXEC; - else - return 0; - } - - int memorySetAccess(void* addr, int len, int access) - { - //int oldProt = get_page_prot(addr); - void* newAddr = (void*) ((int)addr - (int)addr % getpagesize()); - len += (int)addr % getpagesize(); - mprotect(newAddr, len, access); - return 0; - } - #else - // DOS32 has no imposed limits on its segments. - #if defined __BORLANDC__ || defined __WATCOMC__ - #pragma argsused - #endif - int memoryFullAccess( void* addr, int len ) { return 1; } - - #if defined __BORLANDC__ || defined __WATCOMC__ - #pragma argsused - #endif - int memorySetAccess( void* addr, int len, int access ) { return 1; } + // DOS32 has no imposed limits on its segments. + #if defined __BORLANDC__ || defined __WATCOMC__ + #pragma argsused #endif + int memoryFullAccess( void* addr, int len ) { return 1; } + + #if defined __BORLANDC__ || defined __WATCOMC__ + #pragma argsused + #endif + int memorySetAccess( void* addr, int len, int access ) { return 1; } #endif /* #if defined __WIN32 __ */ diff --git a/amxmodx/amx.h b/amxmodx/amx.h index 7523b70d..8180901e 100755 --- a/amxmodx/amx.h +++ b/amxmodx/amx.h @@ -25,6 +25,8 @@ #include #endif +#define JIT + #ifndef AMX_H_INCLUDED #define AMX_H_INCLUDED