Modified memorymanagement for JIT in Symbian

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

No files matched your search

+16 -3
View File
@@ -45,6 +45,12 @@
#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))
#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
// provides exactly the primitive operations that Dolphin needs.
@@ -54,9 +60,16 @@ void* AllocateExecutableMemory(size_t size, bool low)
#if defined(_WIN32)
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#elif defined(__SYMBIAN32__)
// On Symbian, we will need to create an RChunk and allocate with ->CreateLocalCode(size, size);
static char *map_hint = 0;
void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, -1, 0);
//This function may be called more than once, and we want to create only one big
//memory chunck for all the executable code for the JIT
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
static char *map_hint = 0;
#if defined(__x86_64__) && !defined(MAP_32BIT)