From d78f217132e28c56831b097bfa72a74e9755ef26 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Wed, 5 Apr 2023 18:09:47 -0400 Subject: [PATCH] [mono][aot] Fix an assert. This is hit when AOTing GitHub_27678.dll. --- src/mono/mono/mini/memory-access.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/mono/mono/mini/memory-access.c b/src/mono/mono/mini/memory-access.c index d7d36f904cde55..58d9c54c2829b5 100644 --- a/src/mono/mono/mini/memory-access.c +++ b/src/mono/mono/mini/memory-access.c @@ -116,8 +116,19 @@ mini_emit_memcpy (MonoCompile *cfg, int destreg, int doffset, int srcreg, int so { int cur_reg; - /*FIXME arbitrary hack to avoid unbound code expansion.*/ - g_assert (size < MAX_INLINE_COPY_SIZE); + if (size >= MAX_INLINE_COPY_SIZE) { + MonoInst *iargs [3]; + + int reg = alloc_ireg (cfg); + EMIT_NEW_UNALU (cfg, iargs [0], OP_MOVE, reg, destreg); + reg = alloc_ireg (cfg); + EMIT_NEW_UNALU (cfg, iargs [1], OP_MOVE, reg, srcreg); + EMIT_NEW_ICONST (cfg, iargs [2], size); + + mono_emit_method_call (cfg, mini_get_memcpy_method (), iargs, NULL); + return; + } + g_assert (align > 0); MONO_DISABLE_WARNING(4127) /* conditional expression is constant */