[interp] Fix stack size regression (mono/mono#16887)
authorVlad Brezae <brezaevlad@gmail.com>
Tue, 17 Sep 2019 16:27:51 +0000 (19:27 +0300)
committerGitHub <noreply@github.com>
Tue, 17 Sep 2019 16:27:51 +0000 (19:27 +0300)
Partly revert https://github.com/mono/mono/commit/mono/mono@b18840e92cb5b1afef6c0e5df05cc026eb32efbf

Commit migrated from https://github.com/mono/mono/commit/906c71b8bf990a9f6dce535a1842a2b3d22a5272

src/mono/mono/mini/interp/interp.c

index 97c02a9..b2af948 100644 (file)
@@ -5850,7 +5850,6 @@ common_vcall:
 
                        g_assert (sp >= frame->stack);
                        sp = frame->stack; /* spec says stack should be empty at endfinally so it should be at the start too */
-                       vt_sp = (unsigned char*)sp + frame->imethod->stack_size;
 
                        frame->ip = ip;
 
@@ -5901,6 +5900,8 @@ common_vcall:
                        if (old_list != finally_ips && finally_ips) {
                                ip = (const guint16*)finally_ips->data;
                                finally_ips = g_slist_remove (finally_ips, ip);
+                               // we set vt_sp later here so we relieve stack pressure
+                               vt_sp = (unsigned char*)sp + frame->imethod->stack_size;
                                // goto main_loop instead of MINT_IN_DISPATCH helps the compiler and therefore conserves stack.
                                // This is a slow/rare path and conserving stack is preferred over its performance otherwise.
                                goto main_loop;