*/
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);
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));
}
}
#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)
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);
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
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));
}
}
}
/* 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) {
/* 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;
}
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)) {
/* 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) {
/* 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;
}
/* 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;
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);
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));
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);
}
}
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);
}
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;
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);
{
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);
{
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;
}
}
-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)
{
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");
+ }
}
}
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;
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");
+ }
}
}
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));
}
}