* Copyright 2005-2011 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
* Copyright 2011 Xamarin, Inc.
+ * Copyright (C) 2012 Xamarin Inc
*
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#define HANDLE_PTR(ptr,obj) do { \
if (*(ptr) && sgen_ptr_in_nursery ((char*)*(ptr))) { \
if (!sgen_get_remset ()->find_address ((char*)(ptr))) { \
- fprintf (gc_debug_file, "Oldspace->newspace reference %p at offset %td in object %p (%s.%s) not found in remsets.\n", *(ptr), (char*)(ptr) - (char*)(obj), (obj), ((MonoObject*)(obj))->vtable->klass->name_space, ((MonoObject*)(obj))->vtable->klass->name); \
+ SGEN_LOG (1, "Oldspace->newspace reference %p at offset %td in object %p (%s.%s) not found in remsets.", *(ptr), (char*)(ptr) - (char*)(obj), (obj), ((MonoObject*)(obj))->vtable->klass->name_space, ((MonoObject*)(obj))->vtable->klass->name); \
binary_protocol_missing_remset ((obj), (gpointer)LOAD_VTABLE ((obj)), (char*)(ptr) - (char*)(obj), *(ptr), (gpointer)LOAD_VTABLE(*(ptr)), object_is_pinned (*(ptr))); \
if (!object_is_pinned (*(ptr))) \
missing_remsets = TRUE; \
check_consistency_callback (char *start, size_t size, void *dummy)
{
GCVTable *vt = (GCVTable*)LOAD_VTABLE (start);
- DEBUG (8, fprintf (gc_debug_file, "Scanning object %p, vtable: %p (%s)\n", start, vt, vt->klass->name));
+ SGEN_LOG (8, "Scanning object %p, vtable: %p (%s)", start, vt, vt->klass->name);
#define SCAN_OBJECT_ACTION
#include "sgen-scan-object.h"
missing_remsets = FALSE;
- DEBUG (1, fprintf (gc_debug_file, "Begin heap consistency check...\n"));
+ SGEN_LOG (1, "Begin heap consistency check...");
// Check that oldspace->newspace pointers are registered with the collector
major_collector.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)check_consistency_callback, NULL);
sgen_los_iterate_objects ((IterateObjectCallbackFunc)check_consistency_callback, NULL);
- DEBUG (1, fprintf (gc_debug_file, "Heap consistency check done.\n"));
+ SGEN_LOG (1, "Heap consistency check done.");
if (!binary_protocol_is_enabled ())
g_assert (!missing_remsets);
{
int i;
- fprintf (gc_debug_file, "nursery-ptr ");
for (i = 0; i < valid_nursery_object_count; ++i) {
if (valid_nursery_objects [i] >= ptr)
break;
}
if (i >= valid_nursery_object_count || valid_nursery_objects [i] + safe_object_get_size ((MonoObject *)valid_nursery_objects [i]) < ptr) {
- fprintf (gc_debug_file, "(unalloc'd-memory)");
+ SGEN_LOG (1, "nursery-ptr (unalloc'd-memory)");
} else {
char *obj = valid_nursery_objects [i];
MonoVTable *vtable = (MonoVTable*)LOAD_VTABLE (obj);
int size = safe_object_get_size ((MonoObject *)obj);
if (obj == ptr)
- fprintf (gc_debug_file, "(object %s.%s size %d)",
+ SGEN_LOG (1, "nursery-ptr (object %s.%s size %d)",
vtable->klass->name_space, vtable->klass->name, size);
else
- fprintf (gc_debug_file, "(interior-ptr offset %td of %p (%s.%s) size %d)",
+ SGEN_LOG (1, "nursery-ptr (interior-ptr offset %td of %p (%s.%s) size %d)",
ptr - obj, obj,
vtable->klass->name_space, vtable->klass->name, size);
}
} else if (major_collector.describe_pointer (ptr)) {
//Nothing really
} else if (!mono_sgen_los_describe_pointer (ptr)) {
- fprintf (gc_debug_file, "non-heap-ptr");
+ SGEN_LOG (1, "\tnon-heap-ptr");
}
}
char *ptr = *slot;
MonoVTable *vtable = (MonoVTable*)LOAD_VTABLE (obj);
- fprintf (gc_debug_file, "Invalid object pointer %p [", ptr);
- describe_pointer (ptr);
- fprintf (gc_debug_file, "] at offset %td in object %p (%s.%s).\n",
+ SGEN_LOG (1, "Invalid object pointer %p at offset %td in object %p (%s.%s):", ptr,
(char*)slot - obj,
obj, vtable->klass->name_space, vtable->klass->name);
+ describe_pointer (ptr);
broken_heap = TRUE;
}
char *ptr = *slot;
MonoVTable *vtable = (MonoVTable*)LOAD_VTABLE (obj);
- fprintf (gc_debug_file, "Oldspace->newspace reference %p at offset %td in object %p (%s.%s) not found in remsets.\n",
+ SGEN_LOG (1, "Oldspace->newspace reference %p at offset %td in object %p (%s.%s) not found in remsets.",
ptr, (char*)slot - obj, obj,
vtable->klass->name_space, vtable->klass->name);
continue;
while (start < (char**)info->stack_end) {
if (*start >= obj && *start < endobj) {
- DEBUG (0, fprintf (gc_debug_file, "Object %p referenced in thread %p (id %p) at %p, stack: %p-%p\n", obj, info, (gpointer)mono_thread_info_get_tid (info), start, info->stack_start, info->stack_end));
+ SGEN_LOG (1, "Object %p referenced in thread %p (id %p) at %p, stack: %p-%p", obj, info, (gpointer)mono_thread_info_get_tid (info), start, info->stack_start, info->stack_end);
}
start++;
}
#endif
if (w >= (mword)obj && w < (mword)obj + size)
- DEBUG (0, fprintf (gc_debug_file, "Object %p referenced in saved reg %d of thread %p (id %p)\n", obj, j, info, (gpointer)mono_thread_info_get_tid (info)));
+ SGEN_LOG (1, "Object %p referenced in saved reg %d of thread %p (id %p)", obj, j, info, (gpointer)mono_thread_info_get_tid (info));
} END_FOREACH_THREAD
}
}
if (!root->root_desc) {
while (start < (char**)root->end_root) {
if (*start >= obj && *start < endobj) {
- DEBUG (0, fprintf (gc_debug_file, "Object %p referenced in pinned roots %p-%p\n", obj, start, root->end_root));
+ SGEN_LOG (1, "Object %p referenced in pinned roots %p-%p\n", obj, start, root->end_root);
}
start++;
}