From 121481c6859939f4bd7e7ebd6111ac836d020184 Mon Sep 17 00:00:00 2001 From: Jay Krell Date: Tue, 17 Sep 2019 01:55:46 -0700 Subject: [PATCH] [interp] Cleanup dispatch macros. (mono/mono#16784) - 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 | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/mono/mono/mini/interp/interp.c b/src/mono/mono/mini/interp/interp.c index 848f97a..aabb03f 100644 --- a/src/mono/mono/mini/interp/interp.c +++ b/src/mono/mono/mini/interp/interp.c @@ -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 } } -- 2.7.4