landed massive refactoring of the JIT. contexts are actually contexts now, and a higher level structure wraps sp_plugin_t info. on that note, both sp_plugin_t and sp_context_t are entirely opaque, and not even core has access to them. amazingly, i managed to keep binary compatibility here although a large number of functions are deprecated (and core should eventually stop calling them).
NOTE: the JIT is now embeddable out-of-box and usable by other projects which is pretty cool. I will commit a shell app demonstrating this soon
1 #ifndef _INCLUDE_SOURCEPAWN_JIT_RUNTIME_H_
2 #define _INCLUDE_SOURCEPAWN_JIT_RUNTIME_H_
5 #include "jit_shared.h"
6 #include "sp_vm_function.h"
10 class DebugInfo : public IPluginDebugInfo
13 DebugInfo(sp_plugin_t *plugin);
15 int LookupFile(ucell_t addr, const char **filename);
16 int LookupFunction(ucell_t addr, const char **name);
17 int LookupLine(ucell_t addr, uint32_t *line);
19 sp_plugin_t *m_pPlugin;
22 /* Jit wants fast access to this so we expose things as public */
23 class BaseRuntime : public SourcePawn::IPluginRuntime
26 BaseRuntime(sp_plugin_t *pl);
29 virtual bool IsDebugging();
30 virtual IPluginDebugInfo *GetDebugInfo();
31 virtual int FindNativeByName(const char *name, uint32_t *index);
32 virtual int GetNativeByIndex(uint32_t index, sp_native_t **native);
33 virtual uint32_t GetNativesNum();
34 virtual int FindPublicByName(const char *name, uint32_t *index);
35 virtual int GetPublicByIndex(uint32_t index, sp_public_t **publicptr);
36 virtual uint32_t GetPublicsNum();
37 virtual int GetPubvarByIndex(uint32_t index, sp_pubvar_t **pubvar);
38 virtual int FindPubvarByName(const char *name, uint32_t *index);
39 virtual int GetPubvarAddrs(uint32_t index, cell_t *local_addr, cell_t **phys_addr);
40 virtual uint32_t GetPubVarsNum();
41 virtual IPluginFunction *GetFunctionByName(const char *public_name);
42 virtual IPluginFunction *GetFunctionById(funcid_t func_id);
43 virtual IPluginContext *GetDefaultContext();
44 virtual int ApplyCompilationOptions(ICompilation *co);
45 virtual void SetPauseState(bool paused);
46 virtual bool IsPaused();
47 virtual size_t GetMemUsage();
49 BaseContext *GetBaseContext();
52 void RefreshFunctionCache();
55 sp_plugin_t *m_pPlugin;
57 CFunction **m_PubFuncs;
60 #endif //_INCLUDE_SOURCEPAWN_JIT_RUNTIME_H_