#endif
#include <stdio.h>
#include <string.h>
-#include <signal.h>
#include <errno.h>
#include <assert.h>
#ifdef __MACH__
#endif
#include "metadata/sgen-gc.h"
-#include "metadata/metadata-internals.h"
-#include "metadata/class-internals.h"
-#include "metadata/gc-internal.h"
-#include "metadata/object-internals.h"
-#include "metadata/threads.h"
#include "metadata/sgen-cardtable.h"
#include "metadata/sgen-protocol.h"
#include "metadata/sgen-archdep.h"
#include "metadata/sgen-bridge.h"
#include "metadata/sgen-memory-governor.h"
#include "metadata/sgen-pinning.h"
-#include "metadata/mono-gc.h"
-#include "metadata/method-builder.h"
-#include "metadata/profiler-private.h"
-#include "metadata/monitor.h"
-#include "metadata/threadpool-internals.h"
-#include "metadata/mempool-internals.h"
-#include "metadata/marshal.h"
-#include "utils/mono-mmap.h"
-#include "utils/mono-time.h"
-#include "utils/mono-semaphore.h"
-#include "utils/mono-counters.h"
-#include "utils/mono-proclib.h"
-#include "utils/mono-threads.h"
+#include "metadata/sgen-client.h"
/* Enable it so nursery allocation diagnostic data is collected */
//#define NALLOC_DEBUG 1
#ifdef USER_CONFIG
size_t sgen_nursery_size = (1 << 22);
-#ifdef SGEN_ALIGN_NURSERY
int sgen_nursery_bits = 22;
#endif
-#endif
-char *sgen_space_bitmap MONO_INTERNAL;
-size_t sgen_space_bitmap_size MONO_INTERNAL;
+char *sgen_space_bitmap;
+size_t sgen_space_bitmap_size;
#ifdef HEAVY_STATISTICS
printf ("------------------------------------DUMP RECORDS----------------------------\n");
for (i = 0; i < next_record; ++i) {
AllocRecord *rec = alloc_records + i;
- printf ("obj [%p, %p] size %zd reason %s seq %d tid %zx\n", rec->address, rec_end (rec), rec->size, get_reason_name (rec), rec->seq, (size_t)rec->tid);
+ printf ("obj [%p, %p] size %d reason %s seq %d tid %x\n", rec->address, rec_end (rec), (int)rec->size, get_reason_name (rec), rec->seq, (size_t)rec->tid);
}
}
hole_size = rec->address - rec_end (prev);
max_hole = MAX (max_hole, hole_size);
}
- printf ("obj [%p, %p] size %zd hole to prev %d reason %s seq %d tid %zx\n", rec->address, rec_end (rec), rec->size, hole_size, get_reason_name (rec), rec->seq, (size_t)rec->tid);
+ printf ("obj [%p, %p] size %d hole to prev %d reason %s seq %d tid %zx\n", rec->address, rec_end (rec), (int)rec->size, hole_size, get_reason_name (rec), rec->seq, (size_t)rec->tid);
prev = rec;
}
printf ("SUMMARY total alloc'd %d holes %d max_hole %d\n", total, holes, max_hole);
void
sgen_clear_range (char *start, char *end)
{
- MonoArray *o;
size_t size = end - start;
if ((start && !end) || (start > end))
g_error ("Invalid range [%p %p]", start, end);
- if (size < sizeof (MonoArray)) {
- memset (start, 0, size);
- return;
+ if (sgen_client_array_fill_range (start, size)) {
+ sgen_set_nursery_scan_start (start);
+ SGEN_ASSERT (0, start + sgen_safe_object_get_size ((GCObject*)start) == end, "Array fill produced wrong size");
}
-
- o = (MonoArray*)start;
- o->obj.vtable = sgen_get_array_fill_vtable ();
- /* Mark this as not a real object */
- o->obj.synchronisation = GINT_TO_POINTER (-1);
- o->bounds = NULL;
- o->max_length = (mono_array_size_t)(size - sizeof (MonoArray));
- sgen_set_nursery_scan_start (start);
- g_assert (start + sgen_safe_object_get_size ((MonoObject*)o) == end);
}
void
{
SGEN_LOG (4, "Found empty fragment: %p-%p, size: %zd", frag_start, frag_end, frag_size);
binary_protocol_empty (frag_start, frag_size);
- MONO_GC_NURSERY_SWEPT ((mword)frag_start, frag_end - frag_start);
/* Not worth dealing with smaller fragments: need to tune */
if (frag_size >= SGEN_MAX_NURSERY_WASTE) {
/* memsetting just the first chunk start is bound to provide better cache locality */
while (pin_entry < pin_end || frags_ranges) {
char *addr0, *addr1;
size_t size;
- SgenFragment *last_frag = NULL;
addr0 = addr1 = sgen_nursery_end;
if (pin_entry < pin_end)
GRAY_OBJECT_ENQUEUE (unpin_queue, addr0, sgen_obj_get_descriptor_safe (addr0));
else
SGEN_UNPIN_OBJECT (addr0);
- size = SGEN_ALIGN_UP (sgen_safe_object_get_size ((MonoObject*)addr0));
+ size = SGEN_ALIGN_UP (sgen_safe_object_get_size ((GCObject*)addr0));
CANARIFY_SIZE (size);
sgen_set_nursery_scan_start (addr0);
frag_end = addr0;
} else {
frag_end = addr1;
size = frags_ranges->fragment_next - addr1;
- last_frag = frags_ranges;
frags_ranges = frags_ranges->next_in_order;
}
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_safe_name (p), sgen_safe_object_get_size (p));
+ SGEN_LOG (3, "Bastard pinning obj %p (%s), size: %zd", p, sgen_client_object_safe_name (p), sgen_safe_object_get_size (p));
}
}
return fragment_total;