X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Futils%2Fmono-codeman.c;h=30416858d9f0b868ffba274c587a7791558164eb;hb=76f6d439314225271889986a4d78301ec4789e8f;hp=5c2a83b118965861560e3b60e89874c61c96e2e4;hpb=5f5bed4643181a26ab8b7a529f032ee1e3c7cb96;p=mono.git diff --git a/mono/utils/mono-codeman.c b/mono/utils/mono-codeman.c index 5c2a83b1189..30416858d9f 100644 --- a/mono/utils/mono-codeman.c +++ b/mono/utils/mono-codeman.c @@ -251,7 +251,7 @@ codechunk_valloc (void *preferred, guint32 size) * 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); @@ -272,7 +272,7 @@ codechunk_vfree (void *ptr, guint32 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); @@ -292,7 +292,7 @@ codechunk_cleanup (void) 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) { @@ -331,7 +331,7 @@ mono_code_manager_cleanup (void) 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__) @@ -488,11 +488,8 @@ mono_code_manager_foreach (MonoCodeManager *cman, MonoCodeManagerFunc func, void #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 8 +#define BIND_ROOM 4 #endif static CodeChunk* @@ -529,15 +526,21 @@ new_codechunk (CodeChunk *last, int dynamic, int size) } } #ifdef BIND_ROOM - 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; bsize &= ~ (MIN_ALIGN - 1); if (chunk_size - size < bsize) { chunk_size = size + bsize; - chunk_size += pagesize - 1; - chunk_size &= ~ (pagesize - 1); + if (!dynamic) { + chunk_size += pagesize - 1; + chunk_size &= ~ (pagesize - 1); + } } #endif @@ -563,7 +566,7 @@ new_codechunk (CodeChunk *last, int dynamic, int size) #endif } - chunk = malloc (sizeof (CodeChunk)); + chunk = (CodeChunk *) malloc (sizeof (CodeChunk)); if (!chunk) { if (flags == CODE_FLAG_MALLOC) dlfree (ptr); @@ -573,7 +576,7 @@ new_codechunk (CodeChunk *last, int dynamic, int size) } chunk->next = NULL; chunk->size = chunk_size; - chunk->data = ptr; + chunk->data = (char *) ptr; chunk->flags = flags; chunk->pos = bsize; chunk->bsize = bsize;