X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fhelpers.c;h=1b17098ec5db040dc6fb631693b1ee8c3839a773;hb=9ab38c6192912cc1efb8178d8cd5fe00d7c90a78;hp=935c39cd81d7087654a6bfb3402cb92ced05835e;hpb=6110fc90713ce59ff0996fcd3520e09a96575820;p=mono.git diff --git a/mono/mini/helpers.c b/mono/mini/helpers.c index 935c39cd81d..1b17098ec5d 100644 --- a/mono/mini/helpers.c +++ b/mono/mini/helpers.c @@ -14,34 +14,45 @@ #ifdef MINI_OP #undef MINI_OP #endif +#ifdef MINI_OP3 +#undef MINI_OP3 +#endif #ifdef HAVE_ARRAY_ELEM_INIT #define MSGSTRFIELD(line) MSGSTRFIELD1(line) #define MSGSTRFIELD1(line) str##line static const struct msgstr_t { -#define MINI_OP(a,b) char MSGSTRFIELD(__LINE__) [sizeof (b)]; +#define MINI_OP(a,b,dest,src1,src2) char MSGSTRFIELD(__LINE__) [sizeof (b)]; +#define MINI_OP3(a,b,dest,src1,src2,src3) char MSGSTRFIELD(__LINE__) [sizeof (b)]; #include "mini-ops.h" #undef MINI_OP +#undef MINI_OP3 } opstr = { -#define MINI_OP(a,b) b, +#define MINI_OP(a,b,dest,src1,src2) b, +#define MINI_OP3(a,b,dest,src1,src2,src3) b, #include "mini-ops.h" #undef MINI_OP +#undef MINI_OP3 }; static const gint16 opidx [] = { -#define MINI_OP(a,b) [a - OP_LOAD] = offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)), +#define MINI_OP(a,b,dest,src1,src2) [a - OP_LOAD] = offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)), +#define MINI_OP3(a,b,dest,src1,src2,src3) [a - OP_LOAD] = offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)), #include "mini-ops.h" #undef MINI_OP +#undef MINI_OP3 }; #else -#define MINI_OP(a,b) b, +#define MINI_OP(a,b,dest,src1,src2) b, +#define MINI_OP3(a,b,dest,src1,src2,src3) b, /* keep in sync with the enum in mini.h */ static const char* const opnames[] = { #include "mini-ops.h" }; #undef MINI_OP +#undef MINI_OP3 #endif @@ -120,14 +131,16 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id) #endif for (i = 0; id [i]; ++i) { - if (!isalnum (id [i])) + if (i == 0 && isdigit (id [i])) + fprintf (ofd, "_"); + else if (!isalnum (id [i])) fprintf (ofd, "_"); else fprintf (ofd, "%c", id [i]); } fprintf (ofd, ":\n"); - if (emit_debug_info) { + if (emit_debug_info && cfg != NULL) { MonoBasicBlock *bb; fprintf (ofd, ".stabs \"\",100,0,0,.Ltext0\n"); @@ -160,8 +173,13 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id) } fprintf (ofd, "\n"); fclose (ofd); + #ifdef __APPLE__ +#ifdef __ppc64__ +#define DIS_CMD "otool64 -v -t" +#else #define DIS_CMD "otool -v -t" +#endif #else #if defined(sparc) && !defined(__GNUC__) #define DIS_CMD "dis" @@ -175,7 +193,17 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id) #if defined(sparc) #define AS_CMD "as -xarch=v9" #elif defined(__i386__) || defined(__x86_64__) -#define AS_CMD "as -gstabs" +# if defined(__APPLE__) +# define AS_CMD "as" +# else +# define AS_CMD "as -gstabs" +#endif +#elif defined(__mips__) && (_MIPS_SIM == _ABIO32) +#define AS_CMD "as -mips32" +#elif defined(__ppc64__) +#define AS_CMD "as -arch ppc64" +#elif defined(__powerpc64__) +#define AS_CMD "as -mppc64" #else #define AS_CMD "as" #endif @@ -192,11 +220,25 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id) g_free (cmd); if (!objdump_args) objdump_args = ""; + +#ifdef __arm__ + /* + * The arm assembler inserts ELF directives instructing objdump to display + * everything as data. + */ + cmd = g_strdup_printf ("strip -x %s", o_file); + system (cmd); + g_free (cmd); +#endif cmd = g_strdup_printf (DIS_CMD " %s %s", objdump_args, o_file); system (cmd); g_free (cmd); +#ifndef PLATFORM_WIN32 + unlink (o_file); + unlink (as_file); +#endif g_free (o_file); g_free (as_file); #endif