2010-02-10 Mark Probst <mark.probst@gmail.com>
authorMark Probst <mark.probst@gmail.com>
Wed, 10 Feb 2010 16:55:54 +0000 (16:55 -0000)
committerMark Probst <mark.probst@gmail.com>
Wed, 10 Feb 2010 16:55:54 +0000 (16:55 -0000)
        * sgen-gc.c: Round up when calculating the number of scan starts.

svn path=/trunk/mono/; revision=151243

mono/metadata/ChangeLog
mono/metadata/sgen-gc.c

index 70867a71439e03e8e9339dd0a13e0d0ce0196215..1947eae4a80c0b3b4233df3da7b5ff92485bf7c5 100644 (file)
@@ -1,3 +1,7 @@
+2010-02-10  Mark Probst  <mark.probst@gmail.com>
+
+       * sgen-gc.c: Round up when calculating the number of scan starts.
+
 2010-02-10  Rodrigo Kumpera  <rkumpera@novell.com>
 
        * reflection.c: Export mono_get_object_from_blob.
index 8ee2780e0e470ff0154ce1792bfa3ab685dfa5a9..6537c7db3e4f2c54f88130756a3dbf0847b93ab1 100644 (file)
@@ -2257,6 +2257,7 @@ pin_objects_from_addresses (GCMemSection *section, void **start, void **end, voi
                                continue;
                        }
                        idx = ((char*)addr - (char*)section->data) / SCAN_START_SIZE;
+                       g_assert (idx < section->num_scan_start);
                        search_start = (void*)section->scan_starts [idx];
                        if (!search_start || search_start > addr) {
                                while (idx) {
@@ -2700,7 +2701,7 @@ alloc_nursery (void)
        section->data = section->next_data = data;
        section->size = alloc_size;
        section->end_data = nursery_real_end;
-       scan_starts = alloc_size / SCAN_START_SIZE;
+       scan_starts = (alloc_size + SCAN_START_SIZE - 1) / SCAN_START_SIZE;
        section->scan_starts = get_internal_mem (sizeof (char*) * scan_starts, INTERNAL_MEM_SCAN_STARTS);
        section->num_scan_start = scan_starts;
        section->block.role = MEMORY_ROLE_GEN0;
@@ -3676,7 +3677,7 @@ alloc_major_section (void)
        UPDATE_HEAP_BOUNDARIES (section->data, section->end_data);
        total_alloc += section->size;
        DEBUG (3, fprintf (gc_debug_file, "New major heap section: (%p-%p), total: %zd\n", section->data, section->end_data, total_alloc));
-       scan_starts = section->size / SCAN_START_SIZE;
+       scan_starts = (section->size + SCAN_START_SIZE - 1) / SCAN_START_SIZE;
        section->scan_starts = get_internal_mem (sizeof (char*) * scan_starts, INTERNAL_MEM_SCAN_STARTS);
        section->num_scan_start = scan_starts;
        section->block.role = MEMORY_ROLE_GEN1;