Skip to content

Commit dc98263

Browse files
authored
[mini] arm64: Add some more space for tailcall opcodes (#102092)
It looks like in some circumstances 255 bytes isn't enough. 255 is encoded in cpu-arm64.mdesc that only uses a uint8 for the max instruction length. Fixes #102086
1 parent 9eac175 commit dc98263

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/mono/mono/mini/mini-arm64.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5398,6 +5398,13 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
53985398
g_assert (!cfg->method->save_lmf);
53995399

54005400
max_len += call->stack_usage / sizeof (target_mgreg_t) * ins_get_size (OP_TAILCALL_PARAMETER);
5401+
// HACK: In cpu-arm64.mdesc the tailcall opcodes have a len of 255, which is
5402+
// arbitrary, but it's the max uint8 value. It looks like in some
5403+
// circumstances we need more space than that.
5404+
//
5405+
// Add some more space to acount for mono_arm_emit_destroy_frame and
5406+
// emit_load_regset, below
5407+
max_len += 64;
54015408
while (G_UNLIKELY (offset + max_len > cfg->code_size)) {
54025409
cfg->code_size *= 2;
54035410
cfg->native_code = (unsigned char *)mono_realloc_native_code (cfg);

0 commit comments

Comments
 (0)