fixed a number of regressions, things are starting to load

--HG--
branch : refac-jit
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/refac-jit%402395
This commit is contained in:
David Anderson 2008-07-10 05:38:54 +00:00
parent 85760603b7
commit a88d7c1cdc
5 changed files with 38 additions and 12 deletions

View File

@ -239,7 +239,7 @@ void BaseRuntime::RefreshFunctionCache()
{ {
continue; continue;
} }
m_PubFuncs[i]->Set(pub->code_offs, this, pub->funcid, i); m_PubFuncs[i]->Set(pub->code_offs, this, (i << 1) | 1, i);
} }
} }
@ -261,7 +261,7 @@ IPluginFunction *BaseRuntime::GetFunctionById(funcid_t func_id)
{ {
m_PubFuncs[func_id] = new CFunction(m_pPlugin->publics[func_id].code_offs, m_PubFuncs[func_id] = new CFunction(m_pPlugin->publics[func_id].code_offs,
this, this,
m_pPlugin->publics[func_id].funcid, (func_id << 1) | 1,
func_id); func_id);
pFunc = m_PubFuncs[func_id]; pFunc = m_PubFuncs[func_id];
} }
@ -269,7 +269,7 @@ IPluginFunction *BaseRuntime::GetFunctionById(funcid_t func_id)
{ {
pFunc->Set(m_pPlugin->publics[func_id].code_offs, pFunc->Set(m_pPlugin->publics[func_id].code_offs,
this, this,
m_pPlugin->publics[func_id].funcid, (func_id << 1) | 1,
func_id); func_id);
} }
} }
@ -293,7 +293,7 @@ IPluginFunction *BaseRuntime::GetFunctionByName(const char *public_name)
GetPublicByIndex(index, &pub); GetPublicByIndex(index, &pub);
if (pub) if (pub)
{ {
m_PubFuncs[index] = new CFunction(pub->code_offs, this, pub->funcid, index); m_PubFuncs[index] = new CFunction(pub->code_offs, this, (index << 1) | 1, index);
} }
pFunc = m_PubFuncs[index]; pFunc = m_PubFuncs[index];
} }
@ -303,7 +303,7 @@ IPluginFunction *BaseRuntime::GetFunctionByName(const char *public_name)
GetPublicByIndex(index, &pub); GetPublicByIndex(index, &pub);
if (pub) if (pub)
{ {
pFunc->Set(pub->code_offs, this, pub->funcid, index); pFunc->Set(pub->code_offs, this, (index << 1) | 1, index);
} }
else else
{ {

View File

@ -1,7 +1,8 @@
# (C)2004-2008 SourceMod Development Team # (C)2004-2008 SourceMod Development Team
# Makefile written by David "BAILOPAN" Anderson # Makefile written by David "BAILOPAN" Anderson
SMSDK = ../../.. SMSDK = ../..
SOURCEHOOK = ../../../sourcemm-1.6/sourcehook
##################################### #####################################
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
@ -9,7 +10,26 @@ SMSDK = ../../..
PROJECT = sourcepawn.jit.x86 PROJECT = sourcepawn.jit.x86
OBJECTS = dll_exports.cpp jit_x86.cpp opcode_helpers.cpp OBJECTS = dll_exports.cpp \
x86/jit_x86.cpp \
x86/opcode_helpers.cpp \
sp_vm_basecontext.cpp \
sp_vm_engine.cpp \
sp_vm_function.cpp \
engine2.cpp \
BaseRuntime.cpp \
zlib/adler32.c \
zlib/compress.c \
zlib/crc32.c \
zlib/deflate.c \
zlib/gzio.c \
zlib/infback.c \
zlib/inffast.c \
zlib/inflate.c \
zlib/inftrees.c \
zlib/trees.c \
zlib/uncompr.c \
zlib/zutil.c
############################################## ##############################################
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ### ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
@ -24,7 +44,7 @@ CPP = gcc-4.1
LINK = -static-libgcc LINK = -static-libgcc
INCLUDE = -I. -I.. -I$(SMSDK)/public -I$(SMSDK)/public/jit -I$(SMSDK)/public/jit/x86 \ INCLUDE = -I. -I.. -I$(SMSDK)/public -I$(SMSDK)/public/jit -I$(SMSDK)/public/jit/x86 \
-I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/sourcepawn -I$(SOURCEHOOK)
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \ CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -DHAVE_STDINT_H \ -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -DHAVE_STDINT_H \
@ -52,12 +72,17 @@ endif
BINARY = $(PROJECT).so BINARY = $(PROJECT).so
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o) OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o)
$(BIN_DIR)/%.o: %.c
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
$(BIN_DIR)/%.o: %.cpp $(BIN_DIR)/%.o: %.cpp
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< $(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
all: all:
mkdir -p $(BIN_DIR) mkdir -p $(BIN_DIR)/x86
mkdir -p $(BIN_DIR)/zlib
$(MAKE) -f Makefile jit $(MAKE) -f Makefile jit
jit: $(OBJ_LINUX) jit: $(OBJ_LINUX)

View File

@ -125,6 +125,7 @@ IPluginRuntime *SourcePawnEngine2::LoadPlugin(ICompilation *co, const char *file
uint8_t *base; uint8_t *base;
int z_result; int z_result;
int error; int error;
BaseRuntime *pRuntime;
FILE *fp = fopen(file, "rb"); FILE *fp = fopen(file, "rb");
@ -203,7 +204,7 @@ IPluginRuntime *SourcePawnEngine2::LoadPlugin(ICompilation *co, const char *file
return NULL; return NULL;
} }
BaseRuntime *pRuntime = new BaseRuntime(plugin); pRuntime = new BaseRuntime(plugin);
if (co == NULL) if (co == NULL)
{ {

View File

@ -262,7 +262,7 @@ int BaseContext::GetPubvarByIndex(uint32_t index, sp_pubvar_t **pubvar)
int BaseContext::FindPubvarByName(const char *name, uint32_t *index) int BaseContext::FindPubvarByName(const char *name, uint32_t *index)
{ {
return m_pRuntime->FindPublicByName(name, index); return m_pRuntime->FindPubvarByName(name, index);
} }
int BaseContext::GetPubvarAddrs(uint32_t index, cell_t *local_addr, cell_t **phys_addr) int BaseContext::GetPubvarAddrs(uint32_t index, cell_t *local_addr, cell_t **phys_addr)

View File

@ -50,7 +50,7 @@ void CFunction::Set(uint32_t code_addr, BaseRuntime *runtime, funcid_t fnid, uin
bool CFunction::IsRunnable() bool CFunction::IsRunnable()
{ {
return m_pRuntime->IsPaused(); return !m_pRuntime->IsPaused();
} }
int CFunction::CallFunction(const cell_t *params, unsigned int num_params, cell_t *result) int CFunction::CallFunction(const cell_t *params, unsigned int num_params, cell_t *result)