Merge pull request #463 from strawd/concurrent-requests
[mono.git] / mono / metadata / sgen-new-bridge.c
index a8bf84acc02b0f064b446e1a46d2361703901518..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/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
@@ -626,7 +625,7 @@ static int dfs1_passes, dfs2_passes;
 
 #undef HANDLE_PTR
 #define HANDLE_PTR(ptr,obj)    do {                                    \
-               MonoObject *dst = (MonoObject*)*(ptr);                  \
+               GCObject *dst = (GCObject*)*(ptr);                      \
                if (dst && object_needs_expansion (&dst)) {                     \
                        ++num_links;                                    \
                        dyn_array_ptr_push (&dfs_stack, obj_entry);     \
@@ -665,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;
 
@@ -673,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
@@ -933,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;
@@ -974,7 +973,7 @@ static int fist_pass_links, second_pass_links, sccs_links;
 static int max_sccs_links = 0;
 
 static void
-register_finalized_object (MonoObject *obj)
+register_finalized_object (GCObject *obj)
 {
        g_assert (sgen_need_bridge_processing ());
        dyn_array_ptr_push (&registered_bridges, obj);
@@ -1202,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);
                        }
                }
@@ -1325,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_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");
+                       }
                }
        }
 
@@ -1351,7 +1352,7 @@ processing_after_callback (int generation)
 }
 
 static void
-describe_pointer (MonoObject *obj)
+describe_pointer (GCObject *obj)
 {
        HashEntry *entry;
        int i;