sourcepawn/jit/jit_function.cpp
author David Anderson <dvander@alliedmods.net>
Fri Aug 15 05:22:26 2008 +0000 (2008-08-15)
changeset 2226 d10b38524be3
child 4013 6201c1180e0e
permissions -rw-r--r--
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.
dvander@2226
     1
#include "jit_function.h"
dvander@2226
     2
#include "sp_vm_engine.h"
dvander@2226
     3
#include "jit_x86.h"
dvander@2226
     4
dvander@2226
     5
JitFunction::JitFunction(void *entry_addr, cell_t pcode_offs)
dvander@2226
     6
: m_pEntryAddr(entry_addr), m_PcodeOffs(pcode_offs)
dvander@2226
     7
{
dvander@2226
     8
}
dvander@2226
     9
dvander@2226
    10
JitFunction::~JitFunction()
dvander@2226
    11
{
dvander@2226
    12
	g_Jit.FreeCode(m_pEntryAddr);
dvander@2226
    13
}
dvander@2226
    14
dvander@2226
    15
void *JitFunction::GetEntryAddress()
dvander@2226
    16
{
dvander@2226
    17
	return m_pEntryAddr;
dvander@2226
    18
}
dvander@2226
    19
dvander@2226
    20
cell_t JitFunction::GetPCodeAddress()
dvander@2226
    21
{
dvander@2226
    22
	return m_PcodeOffs;
dvander@2226
    23
}