Modified memorymanagement for JIT in Symbian

This commit is contained in:
Summeli 2013-01-08 19:04:25 +02:00
parent 615a370d73
commit 1e8253f1c8
2 changed files with 24 additions and 3 deletions

View File

@ -22,6 +22,10 @@
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#ifdef __SYMBIAN32__
#include <e32std.h>
#endif
namespace ArmGen namespace ArmGen
{ {
@ -61,7 +65,11 @@ const u8 *ARMXEmitter::AlignCodePage()
void ARMXEmitter::Flush() void ARMXEmitter::Flush()
{ {
#ifdef __SYMBIAN32__
User::IMB_Range( startcode, code );
#else
__builtin___clear_cache (startcode, code); __builtin___clear_cache (startcode, code);
#endif
SLEEP(0); SLEEP(0);
} }
void ARMXEmitter::SetCC(CCFlags cond) void ARMXEmitter::SetCC(CCFlags cond)

View File

@ -45,6 +45,12 @@
#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) #define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))
#endif #endif
#ifdef __SYMBIAN32__
#include <e32std.h>
#define SYMBIAN_CODECHUNCK_SIZE 1024*1024*17;
static RChunk* g_code_chunk = NULL;
static RHeap* g_code_heap = NULL;
#endif
// This is purposely not a full wrapper for virtualalloc/mmap, but it // This is purposely not a full wrapper for virtualalloc/mmap, but it
// provides exactly the primitive operations that Dolphin needs. // provides exactly the primitive operations that Dolphin needs.
@ -54,9 +60,16 @@ void* AllocateExecutableMemory(size_t size, bool low)
#if defined(_WIN32) #if defined(_WIN32)
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#elif defined(__SYMBIAN32__) #elif defined(__SYMBIAN32__)
// On Symbian, we will need to create an RChunk and allocate with ->CreateLocalCode(size, size); //This function may be called more than once, and we want to create only one big
static char *map_hint = 0; //memory chunck for all the executable code for the JIT
void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, -1, 0); if( g_code_chunk == NULL && g_code_heap == NULL)
{
TInt minsize = SYMBIAN_CODECHUNCK_SIZE;
TInt maxsize = SYMBIAN_CODECHUNCK_SIZE + 3*4096; //some offsets
g_code_chunk->CreateLocalCode(minsize, maxsize);
g_code_heap = UserHeap::ChunkHeap(*g_code_chunk, minsize, 1, maxsize);
}
void* ptr = (void*) g_code_heap->Alloc( size );
#else #else
static char *map_hint = 0; static char *map_hint = 0;
#if defined(__x86_64__) && !defined(MAP_32BIT) #if defined(__x86_64__) && !defined(MAP_32BIT)