[sgen] Remove `sgen_client_object_safe_name()`.
authorMark Probst <mark.probst@gmail.com>
Thu, 8 Jan 2015 23:30:51 +0000 (15:30 -0800)
committerMark Probst <mark.probst@gmail.com>
Wed, 29 Apr 2015 18:00:04 +0000 (11:00 -0700)
mono/metadata/sgen-client.h
mono/metadata/sgen-copy-object.h
mono/metadata/sgen-debug.c
mono/metadata/sgen-fin-weak-hash.c
mono/metadata/sgen-gc.c
mono/metadata/sgen-mono.c
mono/metadata/sgen-new-bridge.c
mono/metadata/sgen-nursery-allocator.c
mono/metadata/sgen-old-bridge.c
mono/metadata/sgen-pinning.c

index 6c9886dad2740c13e5232bc7ebcb2f4c22a332c2..d58d5e283bdacb71879093b4f6251f0e318650f6 100644 (file)
@@ -100,9 +100,6 @@ gpointer sgen_client_out_of_memory (size_t size);
  */
 const char* sgen_client_description_for_internal_mem_type (int type);
 
-/* FIXME: Use `sgen_client_vtable_get_name()` instead of this. */
-const char* sgen_client_object_safe_name (GCObject *obj);
-
 const char* sgen_client_vtable_get_namespace (GCVTable *vtable);
 const char* sgen_client_vtable_get_name (GCVTable *vtable);
 
index 1a0184fb7d1e590865c6202b6a72c370383457d5..99fd0cc37ca36d3c4325b5925620c3d164e9b6be 100644 (file)
@@ -49,7 +49,7 @@ par_copy_object_no_checks (char *destination, GCVTable *vt, void *obj, mword obj
        sgen_client_update_copied_object (destination, vt, obj, objsize);
        obj = destination;
        if (queue) {
-               SGEN_LOG (9, "Enqueuing gray object %p (%s)", obj, sgen_client_object_safe_name (obj));
+               SGEN_LOG (9, "Enqueuing gray object %p (%s)", obj, sgen_client_vtable_get_name (vt));
                GRAY_OBJECT_ENQUEUE (queue, obj, sgen_vtable_get_descriptor (vt));
        }
 }
index d63008b8ef4d530fc3ce3c721120962e9badc186..1caf2b682b2fbce90b09d61741664be6d568ef52 100644 (file)
@@ -297,7 +297,7 @@ sgen_check_major_refs (void)
 #undef HANDLE_PTR
 #define HANDLE_PTR(ptr,obj)    do {    \
                if (*(ptr)) {   \
-                       g_assert (sgen_client_object_safe_name (*(ptr)) != NULL);       \
+                       g_assert (sgen_client_vtable_get_name (SGEN_LOAD_VTABLE_UNCHECKED (*(ptr))));   \
                }       \
        } while (0)
 
@@ -668,11 +668,12 @@ sgen_debug_verify_nursery (gboolean do_dump_nursery_content)
                size = SGEN_ALIGN_UP (ss);
                verify_scan_starts (cur, cur + size);
                if (do_dump_nursery_content) {
+                       GCVTable *vtable = SGEN_LOAD_VTABLE (cur);
                        if (cur > hole_start)
                                SGEN_LOG (0, "HOLE [%p %p %d]", hole_start, cur, (int)(cur - hole_start));
-                       SGEN_LOG (0, "OBJ  [%p %p %d %d %s %d]", cur, cur + size, (int)size, (int)ss,
-                                       sgen_client_object_safe_name ((GCObject*)cur),
-                                       (gpointer)LOAD_VTABLE (cur) == sgen_client_get_array_fill_vtable ());
+                       SGEN_LOG (0, "OBJ  [%p %p %d %d %s.%s %d]", cur, cur + size, (int)size, (int)ss,
+                                       sgen_client_vtable_get_namespace (vtable), sgen_client_vtable_get_name (vtable),
+                                       vtable == sgen_client_get_array_fill_vtable ());
                }
                if (nursery_canaries_enabled () && (GCVTable*)SGEN_LOAD_VTABLE (cur) != sgen_client_get_array_fill_vtable ()) {
                        CHECK_CANARY_FOR_OBJECT (cur);
@@ -718,11 +719,12 @@ sgen_debug_check_nursery_is_clean (void)
 static gboolean scan_object_for_specific_ref_precise = TRUE;
 
 #undef HANDLE_PTR
-#define HANDLE_PTR(ptr,obj) do {               \
-       if ((GCObject*)*(ptr) == key) { \
-       g_print ("found ref to %p in object %p (%s) at offset %td\n",   \
-                       key, (obj), sgen_client_object_safe_name ((GCObject*)(obj)), ((char*)(ptr) - (char*)(obj))); \
-       }                                                               \
+#define HANDLE_PTR(ptr,obj) do {                                       \
+               if ((GCObject*)*(ptr) == key) {                         \
+                       GCVTable *vtable = SGEN_LOAD_VTABLE (*(ptr));   \
+                       g_print ("found ref to %p in object %p (%s.%s) at offset %td\n", \
+                                       key, (obj), sgen_client_vtable_get_namespace (vtable), sgen_client_vtable_get_name (vtable), ((char*)(ptr) - (char*)(obj))); \
+               }                                                       \
        } while (0)
 
 static void
@@ -742,8 +744,9 @@ scan_object_for_specific_ref (char *start, GCObject *key)
                int i;
                for (i = 0; i < size / sizeof (mword); ++i) {
                        if (words [i] == (mword)key) {
-                               g_print ("found possible ref to %p in object %p (%s) at offset %td\n",
-                                               key, start, sgen_client_object_safe_name ((GCObject*)start), i * sizeof (mword));
+                               GCVTable *vtable = SGEN_LOAD_VTABLE (start);
+                               g_print ("found possible ref to %p in object %p (%s.%s) at offset %td\n",
+                                               key, start, sgen_client_vtable_get_namespace (vtable), sgen_client_vtable_get_name (vtable), i * sizeof (mword));
                        }
                }
        }
index 5506513de345364a05365f37c79e8c03c6ed119e..e2885dc7ae7bdcc6ad65b364e474076a7123dcbc 100644 (file)
@@ -154,7 +154,7 @@ sgen_collect_bridge_objects (int generation, ScanCopyContext ctx)
                        /* insert it into the major hash */
                        sgen_hash_table_replace (&major_finalizable_hash, tagged_object_apply (copy, tag), NULL, NULL);
 
-                       SGEN_LOG (5, "Promoting finalization of object %p (%s) (was at %p) to major table", copy, sgen_client_object_safe_name ((GCObject*)copy), object);
+                       SGEN_LOG (5, "Promoting finalization of object %p (%s) (was at %p) to major table", copy, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (copy)), object);
 
                        continue;
                } else if (copy != (char*)object) {
@@ -164,7 +164,7 @@ sgen_collect_bridge_objects (int generation, ScanCopyContext ctx)
                        /* register for reinsertion */
                        sgen_pointer_queue_add (&moved_fin_objects, tagged_object_apply (copy, tag));
 
-                       SGEN_LOG (5, "Updating object for finalization: %p (%s) (was at %p)", copy, sgen_client_object_safe_name ((GCObject*)copy), object);
+                       SGEN_LOG (5, "Updating object for finalization: %p (%s) (was at %p)", copy, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (copy)), object);
 
                        continue;
                }
@@ -205,7 +205,7 @@ sgen_finalize_in_range (int generation, ScanCopyContext ctx)
                                SGEN_HASH_TABLE_FOREACH_REMOVE (TRUE);
                                sgen_queue_finalization_entry (copy);
                                /* Make it survive */
-                               SGEN_LOG (5, "Queueing object for finalization: %p (%s) (was at %p) (%d)", copy, sgen_client_object_safe_name (copy), object, sgen_hash_table_num_entries (hash_table));
+                               SGEN_LOG (5, "Queueing object for finalization: %p (%s) (was at %p) (%d)", copy, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (copy)), object, sgen_hash_table_num_entries (hash_table));
                                continue;
                        } else {
                                if (hash_table == &minor_finalizable_hash && !ptr_in_nursery (copy)) {
@@ -215,7 +215,7 @@ sgen_finalize_in_range (int generation, ScanCopyContext ctx)
                                        /* insert it into the major hash */
                                        sgen_hash_table_replace (&major_finalizable_hash, tagged_object_apply (copy, tag), NULL, NULL);
 
-                                       SGEN_LOG (5, "Promoting finalization of object %p (%s) (was at %p) to major table", copy, sgen_client_object_safe_name (copy), object);
+                                       SGEN_LOG (5, "Promoting finalization of object %p (%s) (was at %p) to major table", copy, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (copy)), object);
 
                                        continue;
                                } else if (copy != object) {
@@ -225,7 +225,7 @@ sgen_finalize_in_range (int generation, ScanCopyContext ctx)
                                        /* register for reinsertion */
                                        sgen_pointer_queue_add (&moved_fin_objects, tagged_object_apply (copy, tag));
 
-                                       SGEN_LOG (5, "Updating object for finalization: %p (%s) (was at %p)", copy, sgen_client_object_safe_name (copy), object);
+                                       SGEN_LOG (5, "Updating object for finalization: %p (%s) (was at %p)", copy, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (copy)), object);
 
                                        continue;
                                }
@@ -587,7 +587,7 @@ finalizers_with_predicate (SgenObjectPredicateFunc predicate, void *user_data, G
                        /* remove and put in out_array */
                        SGEN_HASH_TABLE_FOREACH_REMOVE (TRUE);
                        out_array [count ++] = object;
-                       SGEN_LOG (5, "Collecting object for finalization: %p (%s) (%d)", object, sgen_client_object_safe_name (object), sgen_hash_table_num_entries (hash_table));
+                       SGEN_LOG (5, "Collecting object for finalization: %p (%s) (%d)", object, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (object)), sgen_hash_table_num_entries (hash_table));
                        if (count == out_size)
                                return count;
                        continue;
index c41dd092998b8fa09896b33dfa9d35c18e9774e0..6659372beb765bc83fb15fcbc734a1ad0f77de9f 100644 (file)
@@ -565,7 +565,7 @@ sgen_drain_gray_stack (int max_objs, ScanCopyContext ctx)
                        GRAY_OBJECT_DEQUEUE (queue, &obj, &desc);
                        if (!obj)
                                return TRUE;
-                       SGEN_LOG (9, "Precise gray object scan %p (%s)", obj, sgen_client_object_safe_name ((GCObject*)obj));
+                       SGEN_LOG (9, "Precise gray object scan %p (%s)", obj, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (obj)));
                        scan_func (obj, desc, queue);
                }
        } while (max_objs < 0);
@@ -712,7 +712,7 @@ pin_objects_from_nursery_pin_queue (gboolean do_scan_objects, ScanCopyContext ct
                        scan_func (obj_to_pin, desc, queue);
                } else {
                        SGEN_LOG (4, "Pinned object %p, vtable %p (%s), count %d\n",
-                                       obj_to_pin, *(void**)obj_to_pin, sgen_client_object_safe_name (obj_to_pin), count);
+                                       obj_to_pin, *(void**)obj_to_pin, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (obj_to_pin)), count);
                        binary_protocol_pin (obj_to_pin,
                                        (gpointer)LOAD_VTABLE (obj_to_pin),
                                        safe_object_get_size (obj_to_pin));
@@ -1067,7 +1067,7 @@ scan_finalizer_entries (SgenPointerQueue *fin_queue, ScanCopyContext ctx)
                void *obj = fin_queue->data [i];
                if (!obj)
                        continue;
-               SGEN_LOG (5, "Scan of fin ready object: %p (%s)\n", obj, sgen_client_object_safe_name (obj));
+               SGEN_LOG (5, "Scan of fin ready object: %p (%s)\n", obj, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (obj)));
                copy_func (&fin_queue->data [i], queue);
        }
 }
@@ -1829,7 +1829,7 @@ major_copy_or_mark_from_roots (size_t *old_next_pin_slot, CopyOrMarkFromRootsMod
                                GRAY_OBJECT_ENQUEUE (WORKERS_DISTRIBUTE_GRAY_QUEUE, bigobj->data, sgen_obj_get_descriptor (bigobj->data));
                        sgen_pin_stats_register_object ((char*) bigobj->data, safe_object_get_size ((GCObject*) bigobj->data));
                        SGEN_LOG (6, "Marked large object %p (%s) size: %lu from roots", bigobj->data,
-                                       sgen_client_object_safe_name ((GCObject*)bigobj->data),
+                                       sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (bigobj->data)),
                                        (unsigned long)sgen_los_object_size (bigobj));
 
                        sgen_client_pinned_los_object (bigobj->data);
@@ -2578,7 +2578,7 @@ sgen_gc_invoke_finalizers (void)
                }
 
                if (obj)
-                       SGEN_LOG (7, "Finalizing object %p (%s)", obj, sgen_client_object_safe_name (obj));
+                       SGEN_LOG (7, "Finalizing object %p (%s)", obj, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (obj)));
 
                UNLOCK_GC;
 
@@ -2788,7 +2788,7 @@ mono_gc_wbarrier_generic_nostore (gpointer ptr)
 void
 mono_gc_wbarrier_generic_store (gpointer ptr, GCObject* value)
 {
-       SGEN_LOG (8, "Wbarrier store at %p to %p (%s)", ptr, value, value ? sgen_client_object_safe_name (value) : "null");
+       SGEN_LOG (8, "Wbarrier store at %p to %p (%s)", ptr, value, value ? sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (value)) : "null");
        SGEN_UPDATE_REFERENCE_ALLOW_NULL (ptr, value);
        if (ptr_in_nursery (value))
                mono_gc_wbarrier_generic_nostore (ptr);
@@ -2803,7 +2803,7 @@ mono_gc_wbarrier_generic_store_atomic (gpointer ptr, GCObject *value)
 {
        HEAVY_STAT (++stat_wbarrier_generic_store_atomic);
 
-       SGEN_LOG (8, "Wbarrier atomic store at %p to %p (%s)", ptr, value, value ? sgen_client_object_safe_name (value) : "null");
+       SGEN_LOG (8, "Wbarrier atomic store at %p to %p (%s)", ptr, value, value ? sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (value)) : "null");
 
        InterlockedWritePointer (ptr, value);
 
index 51d87ef2f0347b7372d5fb78f8ede9ceb2470ad2..2d191311efd10a5142f8b95b9c86aacad5d02804 100644 (file)
@@ -506,7 +506,7 @@ object_in_domain_predicate (MonoObject *obj, void *user_data)
 {
        MonoDomain *domain = user_data;
        if (mono_object_domain (obj) == domain) {
-               SGEN_LOG (5, "Unregistering finalizer for object: %p (%s)", obj, sgen_client_object_safe_name (obj));
+               SGEN_LOG (5, "Unregistering finalizer for object: %p (%s)", obj, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (obj)));
                return TRUE;
        }
        return FALSE;
@@ -2650,13 +2650,6 @@ sgen_client_pre_collection_checks (void)
        }
 }
 
-const char*
-sgen_client_object_safe_name (GCObject *obj)
-{
-       MonoVTable *vt = (MonoVTable*)SGEN_LOAD_VTABLE (obj);
-       return vt->klass->name;
-}
-
 const char*
 sgen_client_vtable_get_namespace (GCVTable *gc_vtable)
 {
index 1dac908d3bb7169c379ea05496b2d2b5aa9f8691..43dddcbe52e41c77dc3a6631b7316af73a003a86 100644 (file)
@@ -1324,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");
+                       }
                }
        }
 
index e5d75d1bbf3e447d6989d2823f942e31c927b358..d7b67e373ed9a38f607b514eeb6e85689f5f4d6c 100644 (file)
@@ -803,7 +803,7 @@ sgen_build_nursery_fragments (GCMemSection *nursery_section, SgenGrayQueue *unpi
                SGEN_LOG (1, "Nursery fully pinned");
                for (pin_entry = pin_start; pin_entry < pin_end; ++pin_entry) {
                        void *p = *pin_entry;
-                       SGEN_LOG (3, "Bastard pinning obj %p (%s), size: %zd", p, sgen_client_object_safe_name (p), sgen_safe_object_get_size (p));
+                       SGEN_LOG (3, "Bastard pinning obj %p (%s), size: %zd", p, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (p)), sgen_safe_object_get_size (p));
                }
        }
        return fragment_total;
index e25462492f1c6bf8db1ffc07fbfc92ed234a8096..7ce0978ac2c317a4bffbd99326c75b460dc5b2bf 100644 (file)
@@ -883,12 +883,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],
+                                       "OBJECT %s.%s (%p) SCC [%d] %s",
+                                               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");
+                       }
                }
        }
 
index a963c4739f2bee690ebd58cb6a14cebbb4560e69..ed4824d10d4a15cc6f57b3f65d17ad02bc205a69 100644 (file)
@@ -174,7 +174,7 @@ sgen_dump_pin_queue (void)
 
        for (i = 0; i < last_num_pinned; ++i) {
                void *ptr = pin_queue.data [i];
-               SGEN_LOG (3, "Bastard pinning obj %p (%s), size: %zd", ptr, sgen_client_object_safe_name (ptr), sgen_safe_object_get_size (ptr));
+               SGEN_LOG (3, "Bastard pinning obj %p (%s), size: %zd", ptr, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (ptr)), sgen_safe_object_get_size (ptr));
        }
 }