[interp] Assign sp once is enough in leave. (mono/mono#16694)
authorJay Krell <jaykrell@microsoft.com>
Sat, 7 Sep 2019 01:48:15 +0000 (18:48 -0700)
committerLarry Ewing <lewing@xamarin.com>
Sat, 7 Sep 2019 01:48:15 +0000 (20:48 -0500)
Move vt_sp there too.

Commit migrated from https://github.com/mono/mono/commit/b18840e92cb5b1afef6c0e5df05cc026eb32efbf

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

index ff55fe5..acc05e7 100644 (file)
@@ -5905,7 +5905,9 @@ main_loop:
                        // but not have to change how exception handling macros access labels and locals.
 
                        g_assert (sp >= frame->stack);
-                       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;
 
                        int opcode = *ip;
@@ -5955,8 +5957,6 @@ main_loop:
                        if (old_list != finally_ips && finally_ips) {
                                ip = (const guint16*)finally_ips->data;
                                finally_ips = g_slist_remove (finally_ips, ip);
-                               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;
                                // 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;