#include "mono/metadata/mono-endian.h"
#include "mono/metadata/appdomain.h" /* mono_init */
#include "mono/metadata/debug-helpers.h"
+#include "mono/utils/mono-compiler.h"
static FILE *output;
static int include_namespace = 0;
static void
print_subtypes (MonoImage *image, MonoClass *class, int depth) {
int i, token;
- MonoTableInfo *t;
+ const MonoTableInfo *t;
MonoClass *child;
if (depth++ > max_depth)
char *p;
guint32 cols [MONO_INTERFACEIMPL_SIZE];
guint32 token, i, count = 0;
- MonoTableInfo *intf = mono_image_get_table_info (image, MONO_TABLE_INTERFACEIMPL);
+ const MonoTableInfo *intf = mono_image_get_table_info (image, MONO_TABLE_INTERFACEIMPL);
cname = g_strdup (cname);
p = strrchr (cname, '.');
if (method->flags & (METHOD_ATTRIBUTE_PINVOKE_IMPL | METHOD_ATTRIBUTE_ABSTRACT))
return;
- header = ((MonoMethodNormal *)method)->header;
+ header = mono_method_get_header (method);
if (header->num_clauses)
has_exceptions++;
num_exceptions += header->num_clauses;
n = read32 (ip + 1);
if (n >= -1 && n <= 8) {
int_waste += 4;
- g_print ("%s %d\n", mono_opcode_names [i], n);
+ g_print ("%s %d\n", mono_opcode_name (i), n);
} else if (n < 128 && n >= -128) {
int_waste += 3;
- g_print ("%s %d\n", mono_opcode_names [i], n);
+ g_print ("%s %d\n", mono_opcode_name (i), n);
}
ip += 5;
break;
case MONO_CEE_LDLOC:
case MONO_CEE_STLOC:
var_waste += 3;
- g_print ("%s %d\n", mono_opcode_names [i], n);
+ g_print ("%s %d\n", mono_opcode_name (i), n);
break;
default:
var_waste += 2;
- g_print ("%s %d\n", mono_opcode_names [i], n);
+ g_print ("%s %d\n", mono_opcode_name (i), n);
break;
}
} else {
var_waste += 2;
- g_print ("%s %d\n", mono_opcode_names [i], n);
+ g_print ("%s %d\n", mono_opcode_name (i), n);
}
}
ip += 3;
case MONO_CEE_LDLOC_S:
case MONO_CEE_STLOC_S:
var_waste++;
- g_print ("%s %d\n", mono_opcode_names [i], (signed char)ip [1]);
+ g_print ("%s %d\n", mono_opcode_name (i), (signed char)ip [1]);
break;
default:
break;
break;
case MonoShortInlineI:
if ((signed char)ip [1] <= 8 && (signed char)ip [1] >= -1) {
- g_print ("%s %d\n", mono_opcode_names [i], (signed char)ip [1]);
+ g_print ("%s %d\n", mono_opcode_name (i), (signed char)ip [1]);
int_waste ++;
}
ip += 2;
const MonoOpcode *opcode;
MonoMethodHeader *header;
GHashTable *hash;
+ static GHashTable *visited = NULL;
const unsigned char *ip;
int i;
if (depth++ > max_depth)
return;
- if (method->info) /* avoid recursion */
+
+ if (! visited)
+ visited = g_hash_table_new (NULL, NULL);
+
+ if (g_hash_table_lookup (visited, method))
return;
- method->info = method;
+
+ g_hash_table_insert (visited, method, method);
if (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME))
return;
if (method->flags & (METHOD_ATTRIBUTE_PINVOKE_IMPL | METHOD_ATTRIBUTE_ABSTRACT))
return;
- header = ((MonoMethodNormal *)method)->header;
+ header = mono_method_get_header (method);
ip = header->code;
hash = g_hash_table_new (g_direct_hash, g_direct_equal);
int i, dfn;
char *code;
- header = ((MonoMethodNormal*)method)->header;
+ header = mono_method_get_header (method);
bblocks = mono_method_find_bblocks (header);
for (i = 0; i < bblocks->len; ++i) {
bb = (MonoBasicBlock*)g_ptr_array_index (bblocks, i);
aname = argv [i];
if (argc > i + 1)
cname = argv [i + 1];
- if (!aname)
- aname = "mscorlib";
+ if (aname) {
+ assembly = mono_assembly_open (aname, NULL);
+ } else {
+ assembly = mono_image_get_assembly (mono_get_corlib ());
+ }
if (!cname && (graphtype == GRAPH_TYPES))
cname = "System.Object";
- assembly = mono_assembly_open (aname, NULL);
if (!assembly) {
g_print ("cannot open assembly %s\n", aname);
exit (1);