Merge pull request #2005 from BrzVlad/feature-concurrent-work
[mono.git] / mono / metadata / sgen-new-bridge.c
index dc62dd467f66227e3de54d5633076fb50f75dbd4..c894b065bedb7fd513273d40edaf15945774d439 100644 (file)
 #include <stdlib.h>
 #include <errno.h>
 
-#include "sgen-gc.h"
-#include "sgen-bridge.h"
-#include "sgen-hash-table.h"
-#include "sgen-qsort.h"
-#include "sgen-client.h"
+#include "sgen/sgen-gc.h"
+#include "sgen-bridge-internal.h"
+#include "sgen/sgen-hash-table.h"
+#include "sgen/sgen-qsort.h"
+#include "sgen/sgen-client.h"
 #include "tabledefs.h"
 #include "utils/mono-logger-internal.h"
-#include "utils/mono-time.h"
-#include "utils/mono-compiler.h"
 
 //#define NEW_XREFS
 #ifdef NEW_XREFS
@@ -666,7 +664,7 @@ dfs1 (HashEntry *obj_entry)
 
                        if (!obj_entry->v.dfs1.is_visited) {
                                int num_links = 0;
-                               mword desc = sgen_obj_get_descriptor_safe (start);
+                               mword desc = sgen_obj_get_descriptor_safe (obj);
 
                                obj_entry->v.dfs1.is_visited = 1;
 
@@ -674,7 +672,7 @@ dfs1 (HashEntry *obj_entry)
                                dyn_array_ptr_push (&dfs_stack, obj_entry);
                                dyn_array_ptr_push (&dfs_stack, NULL);
 
-#include "sgen-scan-object.h"
+#include "sgen/sgen-scan-object.h"
 
                                /*
                                 * We can remove non-bridge objects with a single outgoing
@@ -934,7 +932,7 @@ dump_graph (void)
 
        fprintf (file, "<nodes>\n");
        SGEN_HASH_TABLE_FOREACH (&hash_table, obj, entry) {
-               MonoVTable *vt = (MonoVTable*) SGEN_LOAD_VTABLE (obj);
+               MonoVTable *vt = SGEN_LOAD_VTABLE (obj);
                fprintf (file, "<node id=\"%p\"><attvalues><attvalue for=\"0\" value=\"%s.%s\"/><attvalue for=\"1\" value=\"%s\"/></attvalues></node>\n",
                                obj, vt->klass->name_space, vt->klass->name, entry->is_bridge ? "true" : "false");
        } SGEN_HASH_TABLE_FOREACH_END;
@@ -1203,7 +1201,7 @@ processing_build_callback_data (int generation)
                        HashEntryWithAccounting *entry = (HashEntryWithAccounting*)all_entries [i];
                        if (entry->entry.is_bridge) {
                                MonoObject *obj = sgen_hash_table_key_for_value_pointer (entry);
-                               MonoClass *klass = ((MonoVTable*)SGEN_LOAD_VTABLE (obj))->klass;
+                               MonoClass *klass = SGEN_LOAD_VTABLE (obj)->klass;
                                mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "OBJECT %s::%s (%p) weight %f", klass->name_space, klass->name, obj, entry->weight);
                        }
                }
@@ -1326,12 +1324,14 @@ processing_after_callback (int generation)
 
        if (bridge_accounting_enabled) {
                for (i = 0; i < num_sccs; ++i) {
-                       for (j = 0; j < api_sccs [i]->num_objs; ++j)
+                       for (j = 0; j < api_sccs [i]->num_objs; ++j) {
+                               GCVTable vtable = SGEN_LOAD_VTABLE (api_sccs [i]->objs [j]);
                                mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC,
                                        "OBJECT %s (%p) SCC [%d] %s",
-                                               sgen_client_object_safe_name (api_sccs [i]->objs [j]), api_sccs [i]->objs [j],
+                                               sgen_client_vtable_get_namespace (vtable), sgen_client_vtable_get_name (vtable), api_sccs [i]->objs [j],
                                                i,
                                                api_sccs [i]->is_alive  ? "ALIVE" : "DEAD");
+                       }
                }
        }