2006-09-20 02:41:24 +02:00
|
|
|
#ifndef _INCLUDE_SOURCEPAWN_JIT_X86_H_
|
|
|
|
#define _INCLUDE_SOURCEPAWN_JIT_X86_H_
|
|
|
|
|
2006-09-20 04:56:20 +02:00
|
|
|
#include <sp_vm_types.h>
|
2006-09-20 02:41:24 +02:00
|
|
|
#include <sp_vm_api.h>
|
2006-09-20 10:44:21 +02:00
|
|
|
#include "..\jit_helpers.h"
|
2006-09-20 02:41:24 +02:00
|
|
|
|
|
|
|
using namespace SourcePawn;
|
|
|
|
|
2006-09-20 10:44:21 +02:00
|
|
|
#define JIT_INLINE_ERRORCHECKS (1<<0)
|
|
|
|
#define JIT_INLINE_NATIVES (1<<1)
|
|
|
|
|
2006-09-20 02:41:24 +02:00
|
|
|
class CompData : public ICompilation
|
|
|
|
{
|
|
|
|
public:
|
2006-09-20 17:51:05 +02:00
|
|
|
CompData() : plugin(NULL),
|
|
|
|
debug(false), inline_level(3), checks(true)
|
2006-09-20 02:41:24 +02:00
|
|
|
{
|
|
|
|
};
|
|
|
|
public:
|
|
|
|
sp_plugin_t *plugin;
|
2006-09-20 10:44:21 +02:00
|
|
|
jitoffs_t jit_return;
|
|
|
|
jitoffs_t jit_verify_addr_eax;
|
|
|
|
jitoffs_t jit_verify_addr_edx;
|
2006-09-20 09:07:49 +02:00
|
|
|
int inline_level;
|
2006-09-20 17:51:05 +02:00
|
|
|
bool checks;
|
2006-09-20 02:41:24 +02:00
|
|
|
bool debug;
|
|
|
|
};
|
|
|
|
|
|
|
|
class JITX86 : public IVirtualMachine
|
|
|
|
{
|
2006-09-20 03:59:56 +02:00
|
|
|
public:
|
|
|
|
JITX86();
|
2006-09-20 02:41:24 +02:00
|
|
|
public:
|
|
|
|
const char *GetVMName() =0;
|
|
|
|
ICompilation *StartCompilation(sp_plugin_t *plugin);
|
|
|
|
bool SetCompilationOption(ICompilation *co, const char *key, const char *val) ;
|
2006-09-20 03:59:56 +02:00
|
|
|
IPluginContext *CompileToContext(ICompilation *co, int *err);
|
2006-09-20 02:41:24 +02:00
|
|
|
void AbortCompilation(ICompilation *co);
|
|
|
|
void FreeContextVars(sp_context_t *ctx);
|
|
|
|
int ContextExecute(sp_context_t *ctx, uint32_t code_idx, cell_t *result);
|
|
|
|
};
|
|
|
|
|
2006-09-20 04:56:20 +02:00
|
|
|
#define AMX_REG_PRI REG_EAX
|
|
|
|
#define AMX_REG_ALT REG_EDX
|
|
|
|
#define AMX_REG_STK REG_EBP
|
|
|
|
#define AMX_REG_DAT REG_EDI
|
|
|
|
#define AMX_REG_TMP REG_ECX
|
|
|
|
#define AMX_REG_INFO REG_ESI
|
|
|
|
#define AMX_REG_FRM REG_EBX
|
|
|
|
|
2006-09-20 06:52:13 +02:00
|
|
|
#define AMX_INFO_FRM AMX_REG_INFO
|
|
|
|
#define AMX_INFO_HEAP 4
|
|
|
|
#define AMX_INFO_RETVAL 8
|
2006-09-20 09:07:49 +02:00
|
|
|
#define AMX_INFO_CONTEXT 12
|
2006-09-20 10:44:21 +02:00
|
|
|
#define AMX_INFO_STACKTOP 16
|
2006-09-20 03:59:56 +02:00
|
|
|
|
2006-09-20 02:41:24 +02:00
|
|
|
#endif //_INCLUDE_SOURCEPAWN_JIT_X86_H_
|