sourcemod/knight/shared/KeCodeAllocator.h
David Anderson 7875fe1acd Landed sourcepawn-1.2. The big changes:
1) JIT compilation/optimization now occurs per-function, and only when functions are first used.  We're now officially a whole-method JIT rather than an AOT compiler (albiet, still a simple JIT).  This has two implications: Functions are now much better abstracted internally, and loading a plugin is now much less expensive.  If a function contains calls to other functions, THOSE functions are only compiled when they're invoked as well.

2) I've removed debug mode.  We always show full backtraces now, as there was a very cheap way to implement this which really cleaned up everything.  This is great for a number of reasons -- there's less code, the JIT is better designed, we don't need to relocate debug tables, and best of all we no longer have to tell users to enable debug mode at their own expense.

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402459
2008-08-15 05:22:26 +00:00

48 lines
1.1 KiB
C++

#ifndef _INCLUDE_KNIGHT_KE_CODE_ALLOCATOR_H_
#define _INCLUDE_KNIGHT_KE_CODE_ALLOCATOR_H_
#include <KeLinking.h>
#include <KeStdTypes.h>
namespace Knight
{
class KeCodeCache;
/**
* @brief Creates a new code cache/allocator.
*
* @return New code cache allocator.
*/
extern KeCodeCache *KE_CreateCodeCache();
/**
* @brief Destroys a code cache allocator.
*
* @param cache Code cache object.
*/
extern void KE_DestroyCodeCache(KeCodeCache *cache);
/**
* @brief Allocates code memory that is readable, writable,
* and executable.
*
* The address returned wlil be aligned, minimally, on a 16-byte
* boundary.
*
* @param cache Code cache object.
* @param size Amount of memory needed.
* @return Address pointing to the memory.
*/
extern void *KE_AllocCode(KeCodeCache *cache, size_t size);
/**
* @brief Frees code memory.
*
* @param cache Code cache object.
* @param code Address of code memory.
*/
extern void KE_FreeCode(KeCodeCache *cache, void *code);
}
#endif //_INCLUDE_KNIGHT_KE_CODE_ALLOCATOR_H_