42 #define DEFAULT_CODE_MEMORY_SIZE 128 * 1024
62 code_memory_mutex =
new Mutex();
81 code_memory_mutex->
lock();
87 if (size > code_memory_size) {
94 if (size > code_memory_size)
95 code_memory_size =
size;
99 code_memory_size =
MEMORY_ALIGN(code_memory_size, pagesize);
102 STATISTICS(maxcodememusage.max(codememusage.get()));
107 PROT_READ | PROT_WRITE | PROT_EXEC,
119 code_memory = (
void *) ((
ptrint) code_memory +
size);
120 code_memory_size -=
size;
122 code_memory_mutex->
unlock();
static Mutex * code_memory_mutex
#define STATISTICS(x)
Wrapper for statistics only code.
Dummy implementation of a mutex.
JNIEnv jthread jobject jclass jlong size
#define TRACESUBSYSTEMINITIALIZATION(text)
static size_t code_memory_size
void codememory_init(void)
void * codememory_get(size_t size)
This file contains the statistics framework.
static int getpagesize(void)
#define STAT_REGISTER_GROUP_VAR(type, var, init, name, description, group)
Register an statistics variable and add it to a group.
static void * code_memory
void codememory_release(void *p, size_t size)
static void * mmap_anonymous(void *addr, size_t len, int prot, int flags)
Maps anonymous memory, even on systems not defining MAP_ANON(YMOUS).
#define STAT_DECLARE_GROUP(var)
Declare an external group (or subgroup).
#define MEMORY_ALIGN(pos, size)
void unlock()
Unlocks the given mutex object and checks for errors.
#define DEFAULT_CODE_MEMORY_SIZE
void lock()
Locks the given mutex object and checks for errors.