summaryrefslogtreecommitdiffstats
path: root/libacc/acc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libacc/acc.cpp')
-rw-r--r--libacc/acc.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/libacc/acc.cpp b/libacc/acc.cpp
index 8f33b0b..6e13f9a 100644
--- a/libacc/acc.cpp
+++ b/libacc/acc.cpp
@@ -23,10 +23,11 @@
#include <cutils/hashmap.h>
-#if defined(__i386__)
#include <sys/mman.h>
-#endif
+#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
+#define MAP_ANONYMOUS MAP_ANON
+#endif
#if defined(__arm__)
#define DEFAULT_ARM_CODEGEN
@@ -230,7 +231,7 @@ class Compiler : public ErrorSink {
void release() {
if (pProgramBase != 0) {
- free(pProgramBase);
+ munmap(pProgramBase, mSize);
pProgramBase = 0;
}
}
@@ -263,7 +264,9 @@ class Compiler : public ErrorSink {
virtual void init(int size) {
release();
mSize = size;
- pProgramBase = (char*) calloc(1, size);
+ pProgramBase = (char*) mmap(NULL, size,
+ PROT_EXEC | PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
ind = pProgramBase;
}