X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Fopcodes.c;h=e534d33b42239c659f083813f3a06176d3682af8;hb=d28989fddd8c7a54bd166ae98ddace9a2f98d9c4;hp=c7328c15c50b6babe8f4660bd9451e24829eaca4;hpb=ac212882fa2651ba04b22b53e616715ae5175778;p=mono.git diff --git a/mono/metadata/opcodes.c b/mono/metadata/opcodes.c index c7328c15c50..e534d33b422 100644 --- a/mono/metadata/opcodes.c +++ b/mono/metadata/opcodes.c @@ -4,10 +4,12 @@ * Author: * Paolo Molaro (lupus@ximian.com) * - * (C) 2002 Ximian, Inc. + * Copyright 2002-2003 Ximian, Inc (http://www.ximian.com) + * Copyright 2004-2009 Novell, Inc (http://www.novell.com) */ #include #include /* for NULL */ +#include #define MONO_PREFIX1_OFFSET MONO_CEE_ARGLIST #define MONO_CUSTOM_PREFIX_OFFSET MONO_CEE_MONO_ICALL @@ -23,6 +25,7 @@ mono_opcodes [MONO_CEE_LAST + 1] = { #undef OPDEF +#ifdef HAVE_ARRAY_ELEM_INIT #define MSGSTRFIELD(line) MSGSTRFIELD1(line) #define MSGSTRFIELD1(line) str##line static const struct msgstr_t { @@ -34,7 +37,7 @@ static const struct msgstr_t { #include "mono/cil/opcode.def" #undef OPDEF }; -static const int opidx [] = { +static const int16_t opidx [] = { #define OPDEF(a,b,c,d,e,f,g,h,i,j) [MONO_ ## a] = offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)), #include "mono/cil/opcode.def" #undef OPDEF @@ -46,11 +49,27 @@ mono_opcode_name (int opcode) return (const char*)&opstr + opidx [opcode]; } +#else +#define OPDEF(a,b,c,d,e,f,g,h,i,j) b, +static const char* const +mono_opcode_names [MONO_CEE_LAST + 1] = { +#include "mono/cil/opcode.def" + NULL +}; + +const char* +mono_opcode_name (int opcode) +{ + return mono_opcode_names [opcode]; +} + +#endif + MonoOpcodeEnum -mono_opcode_value (const guint8 **ip, const guint8 *end) +mono_opcode_value (const mono_byte **ip, const mono_byte *end) { MonoOpcodeEnum res; - const guint8 *p = *ip; + const mono_byte *p = *ip; if (p >= end) return -1;