sourcepawn/jit/BaseRuntime.h
changeset 2193 db7c6362f3f2
child 2226 d10b38524be3
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/sourcepawn/jit/BaseRuntime.h	Fri Jul 11 08:18:43 2008 +0000
     1.3 @@ -0,0 +1,60 @@
     1.4 +#ifndef _INCLUDE_SOURCEPAWN_JIT_RUNTIME_H_
     1.5 +#define _INCLUDE_SOURCEPAWN_JIT_RUNTIME_H_
     1.6 +
     1.7 +#include <sp_vm_api.h>
     1.8 +#include "jit_shared.h"
     1.9 +#include "sp_vm_function.h"
    1.10 +
    1.11 +class BaseContext;
    1.12 +
    1.13 +class DebugInfo : public IPluginDebugInfo
    1.14 +{
    1.15 +public:
    1.16 +	DebugInfo(sp_plugin_t *plugin);
    1.17 +public:
    1.18 +	int LookupFile(ucell_t addr, const char **filename);
    1.19 +	int LookupFunction(ucell_t addr, const char **name);
    1.20 +	int LookupLine(ucell_t addr, uint32_t *line);
    1.21 +private:
    1.22 +	sp_plugin_t *m_pPlugin;
    1.23 +};
    1.24 +
    1.25 +/* Jit wants fast access to this so we expose things as public */
    1.26 +class BaseRuntime : public SourcePawn::IPluginRuntime
    1.27 +{
    1.28 +public:
    1.29 +	BaseRuntime(sp_plugin_t *pl);
    1.30 +	~BaseRuntime();
    1.31 +public:
    1.32 +	virtual bool IsDebugging();
    1.33 +	virtual IPluginDebugInfo *GetDebugInfo();
    1.34 +	virtual int FindNativeByName(const char *name, uint32_t *index);
    1.35 +	virtual int GetNativeByIndex(uint32_t index, sp_native_t **native);
    1.36 +	virtual uint32_t GetNativesNum();
    1.37 +	virtual int FindPublicByName(const char *name, uint32_t *index);
    1.38 +	virtual int GetPublicByIndex(uint32_t index, sp_public_t **publicptr);
    1.39 +	virtual uint32_t GetPublicsNum();
    1.40 +	virtual int GetPubvarByIndex(uint32_t index, sp_pubvar_t **pubvar);
    1.41 +	virtual int FindPubvarByName(const char *name, uint32_t *index);
    1.42 +	virtual int GetPubvarAddrs(uint32_t index, cell_t *local_addr, cell_t **phys_addr);
    1.43 +	virtual uint32_t GetPubVarsNum();
    1.44 +	virtual IPluginFunction *GetFunctionByName(const char *public_name);
    1.45 +	virtual IPluginFunction *GetFunctionById(funcid_t func_id);
    1.46 +	virtual IPluginContext *GetDefaultContext();
    1.47 +	virtual int ApplyCompilationOptions(ICompilation *co);
    1.48 +	virtual void SetPauseState(bool paused);
    1.49 +	virtual bool IsPaused();
    1.50 +	virtual size_t GetMemUsage();
    1.51 +public:
    1.52 +	BaseContext *GetBaseContext();
    1.53 +private:
    1.54 +	void ClearCompile();
    1.55 +	void RefreshFunctionCache();
    1.56 +public:
    1.57 +	DebugInfo m_Debug;
    1.58 +	sp_plugin_t *m_pPlugin;
    1.59 +	BaseContext *m_pCtx;
    1.60 +	CFunction **m_PubFuncs;
    1.61 +};
    1.62 +
    1.63 +#endif //_INCLUDE_SOURCEPAWN_JIT_RUNTIME_H_