[arm64] Increase the amount of memory used to bind branches since the arm64 thunk...
[mono.git] / mono / utils / mono-codeman.c
index 5c2a83b118965861560e3b60e89874c61c96e2e4..2237445838e9759a098575f45cbfaf34c6d16e44 100644 (file)
@@ -492,7 +492,7 @@ mono_code_manager_foreach (MonoCodeManager *cman, MonoCodeManagerFunc func, void
 #define BIND_ROOM 8
 #endif
 #if defined(TARGET_ARM64)
-#define BIND_ROOM 8
+#define BIND_ROOM 4
 #endif
 
 static CodeChunk*
@@ -529,15 +529,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