struct _MonoCodeManager {
int dynamic;
int read_only;
- int bind_size;
CodeChunk *current;
CodeChunk *full;
CodeChunk *last;
* Keep a small freelist of memory blocks to decrease pressure on the kernel memory subsystem to avoid #3321.
*/
mono_mutex_lock (&valloc_mutex);
- freelist = g_hash_table_lookup (valloc_freelists, GUINT_TO_POINTER (size));
+ freelist = (GSList *) g_hash_table_lookup (valloc_freelists, GUINT_TO_POINTER (size));
if (freelist) {
ptr = freelist->data;
memset (ptr, 0, size);
GSList *freelist;
mono_mutex_lock (&valloc_mutex);
- freelist = g_hash_table_lookup (valloc_freelists, GUINT_TO_POINTER (size));
+ freelist = (GSList *) g_hash_table_lookup (valloc_freelists, GUINT_TO_POINTER (size));
if (!freelist || g_slist_length (freelist) < VALLOC_FREELIST_SIZE) {
freelist = g_slist_prepend (freelist, ptr);
g_hash_table_insert (valloc_freelists, GUINT_TO_POINTER (size), freelist);
return;
g_hash_table_iter_init (&iter, valloc_freelists);
while (g_hash_table_iter_next (&iter, &key, &value)) {
- GSList *freelist = value;
+ GSList *freelist = (GSList *) value;
GSList *l;
for (l = freelist; l; l = l->next) {
MonoCodeManager*
mono_code_manager_new (void)
{
- MonoCodeManager *cman = g_malloc0 (sizeof (MonoCodeManager));
+ MonoCodeManager *cman = (MonoCodeManager *) g_malloc0 (sizeof (MonoCodeManager));
if (!cman)
return NULL;
#if defined(__native_client_codegen__) && defined(__native_client__)
* Creates a new code manager suitable for holding native code that can be
* used for single or small methods that need to be deallocated independently
* of other native code.
- * BIND_SIZE is the amount of memory reserved for storing thunks. If its 0,
- * the default size is used.
*
* Returns: the new code manager
*/
MonoCodeManager*
-mono_code_manager_new_dynamic (int bind_size)
+mono_code_manager_new_dynamic (void)
{
MonoCodeManager *cman = mono_code_manager_new ();
cman->dynamic = 1;
- cman->bind_size = bind_size;
return cman;
}
#if defined(__ppc__) || defined(__powerpc__)
#define BIND_ROOM 4
#endif
-#if defined(__arm__)
-#define BIND_ROOM 8
-#endif
#if defined(TARGET_ARM64)
#define BIND_ROOM 4
#endif
static CodeChunk*
-new_codechunk (CodeChunk *last, int dynamic, int size, int bind_size)
+new_codechunk (CodeChunk *last, int dynamic, int size)
{
int minsize, flags = CODE_FLAG_MMAP;
int chunk_size, bsize = 0;
}
}
#ifdef BIND_ROOM
- if (bind_size) {
- bsize = bind_size;
- } else {
- if (dynamic)
- /* Reserve more space since there are no other chunks we might use if this one gets full */
- bsize = (chunk_size * 2) / BIND_ROOM;
- else
- bsize = chunk_size / BIND_ROOM;
- }
+ if (dynamic)
+ /* Reserve more space since there are no other chunks we might use if this one gets full */
+ bsize = (chunk_size * 2) / BIND_ROOM;
+ else
+ bsize = chunk_size / BIND_ROOM;
if (bsize < MIN_BSIZE)
bsize = MIN_BSIZE;
bsize += MIN_ALIGN -1;
#endif
}
- chunk = malloc (sizeof (CodeChunk));
+ chunk = (CodeChunk *) malloc (sizeof (CodeChunk));
if (!chunk) {
if (flags == CODE_FLAG_MALLOC)
dlfree (ptr);
}
chunk->next = NULL;
chunk->size = chunk_size;
- chunk->data = ptr;
+ chunk->data = (char *) ptr;
chunk->flags = flags;
chunk->pos = bsize;
chunk->bsize = bsize;
}
if (!cman->current) {
- cman->current = new_codechunk (cman->last, cman->dynamic, size, cman->bind_size);
+ cman->current = new_codechunk (cman->last, cman->dynamic, size);
if (!cman->current)
return NULL;
cman->last = cman->current;
cman->full = chunk;
break;
}
- chunk = new_codechunk (cman->last, cman->dynamic, size, cman->bind_size);
+ chunk = new_codechunk (cman->last, cman->dynamic, size);
if (!chunk)
return NULL;
chunk->next = cman->current;