Removed PM's original "GCC JIT" implementations.

This commit is contained in:
David Anderson 2004-07-20 03:53:49 +00:00
parent 5daf73e3d5
commit c504df473d
3 changed files with 14 additions and 43 deletions

View File

@ -61,7 +61,7 @@ OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o)
OBJC_WIN32 := $(CSRCFILES:%.c=$(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) 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 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_LINUX=$(CC_LINUX) $(CFLAGS) -fPIC $(INCLUDEDIRS) -o $@ -c $<
DO_CC_WIN32=$(CC_WIN32) $(CFLAGS) $(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 $@ 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 $(OBJDIR_LINUX)/%.o: $(SRCDIR)/%.c

View File

@ -562,11 +562,8 @@ static int amx_BrowseRelocate(AMX *amx)
} /* if */ } /* if */
#if defined __GNUC__ || defined ASM32 || defined JIT #if defined __GNUC__ || defined ASM32 || defined JIT
/* relocate symbol */ /* relocate symbol */
#if defined JIT && defined __linux__
#else
*(cell *)(code+(int)cip) = opcode_list[op]; *(cell *)(code+(int)cip) = opcode_list[op];
#endif #endif
#endif
#if defined JIT #if defined JIT
opcode_count++; opcode_count++;
#endif #endif
@ -788,10 +785,6 @@ static int amx_BrowseRelocate(AMX *amx)
} /* for */ } /* for */
#if defined JIT #if defined JIT
#if defined __linux__
// HACK: Determine maxcodesize
asm_runJIT(NULL, NULL, NULL);
#endif
amx->code_size = getMaxCodeSize()*opcode_count + hdr->cod amx->code_size = getMaxCodeSize()*opcode_count + hdr->cod
+ (hdr->stp - hdr->dat); + (hdr->stp - hdr->dat);
amx->reloc_size = 2*sizeof(cell)*reloc_count; amx->reloc_size = 2*sizeof(cell)*reloc_count;
@ -1056,40 +1049,16 @@ int AMXAPI amx_Init(AMX *amx,void *program)
} }
#else /* #if defined __WIN32 __ */ #else /* #if defined __WIN32 __ */
// DOS32 has no imposed limits on its segments.
// TODO: Add cases for Linux, Unix, OS/2, ... #if defined __BORLANDC__ || defined __WATCOMC__
#if defined __linux__ #pragma argsused
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; }
#endif #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 __ */ #endif /* #if defined __WIN32 __ */

View File

@ -25,6 +25,8 @@
#include <sclinux.h> #include <sclinux.h>
#endif #endif
#define JIT
#ifndef AMX_H_INCLUDED #ifndef AMX_H_INCLUDED
#define AMX_H_INCLUDED #define AMX_H_INCLUDED