[interp] Cleanup dispatch macros. (mono/mono#16784)
authorJay Krell <jaykrell@microsoft.com>
Tue, 17 Sep 2019 08:55:46 +0000 (01:55 -0700)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Tue, 17 Sep 2019 08:55:45 +0000 (10:55 +0200)
- Factor out reptition into already existing macros.
 - Remove the default for computed goto which is dead.
   Computed goto has no notion of default. It is just
   an unchecked array access.

Extracted from https://github.com/mono/mono/pull/16721.

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

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

index 848f97a..aabb03f 100644 (file)
@@ -213,19 +213,16 @@ int mono_interp_traceopt = 0;
 
 #if USE_COMPUTED_GOTO
 
-#define MINT_IN_SWITCH(op) goto *in_labels[op];
-#define MINT_IN_CASE(x) LAB_ ## x:
-#define MINT_IN_DISPATCH(op) goto *in_labels[op];
-#define MINT_IN_BREAK { goto *in_labels[*ip]; }
-#define MINT_IN_DEFAULT mint_default: if (0) goto mint_default; /* make gcc shut up */
+#define MINT_IN_DISPATCH(op) goto *in_labels [op]
+#define MINT_IN_SWITCH(op)   MINT_IN_DISPATCH (op);
+#define MINT_IN_BREAK        MINT_IN_DISPATCH (*ip)
+#define MINT_IN_CASE(x)      LAB_ ## x:
 
 #else
 
 #define MINT_IN_SWITCH(op) COUNT_OP(op); switch (op)
 #define MINT_IN_CASE(x) case x:
-#define MINT_IN_DISPATCH(op) goto main_loop;
 #define MINT_IN_BREAK break
-#define MINT_IN_DEFAULT default:
 
 #endif
 
@@ -6528,8 +6525,10 @@ common_vcall:
                        MINT_IN_BREAK;
                }
 
-               MINT_IN_DEFAULT
+#if !USE_COMPUTED_GOTO
+               default:
                        g_error ("Unimplemented opcode: %04x %s at 0x%x\n", *ip, mono_interp_opname (*ip), ip - frame->imethod->code);
+#endif
                }
        }