]> granicus.if.org Git - gc/commitdiff
Fix type of local variables receiving result of PHT_HASH
authorIvan Maidanski <ivmai@mail.ru>
Thu, 22 Feb 2018 20:39:38 +0000 (23:39 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 22 Feb 2018 20:39:38 +0000 (23:39 +0300)
The variables should be of word type, not int or size_t.

* os_dep.c (GC_write_fault_handler, GC_remove_protection): Change type
of index local variable from size_t to word.
* os_dep.c [MPROTECT_VDB && DARWIN] (catch_exception_raise): Change
type of index local variable from int to word.

os_dep.c

index f591d70766bdd749ae392b877f69167ce89c6222..cdda0be294b185202a44eec7e10bbaa607c8d3d2 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -3376,7 +3376,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void)
         /* and then to have the thread stopping code set the dirty      */
         /* flag, if necessary.                                          */
         for (i = 0; i < divHBLKSZ(GC_page_size); i++) {
-            size_t index = PHT_HASH(h+i);
+            word index = PHT_HASH(h+i);
 
             async_set_pht_entry_from_index(GC_dirty_pages, index);
         }
@@ -3430,7 +3430,8 @@ GC_INNER void GC_remove_protection(struct hblk *h, word nblocks,
         return;
     }
     for (current = h_trunc; (word)current < (word)h_end; ++current) {
-        size_t index = PHT_HASH(current);
+        word index = PHT_HASH(current);
+
         if (!is_ptrfree || (word)current < (word)h
             || (word)current >= (word)(h + nblocks)) {
             async_set_pht_entry_from_index(GC_dirty_pages, index);
@@ -3815,6 +3816,7 @@ GC_INNER void GC_read_dirty(GC_bool output_unneeded)
                 for (h = (struct hblk *)vaddr;
                      (word)h < (word)next_vaddr; h++) {
                     word index = PHT_HASH(h);
+
                     set_pht_entry_from_index(GC_grungy_pages, index);
                 }
             }
@@ -4479,7 +4481,7 @@ catch_exception_raise(mach_port_t exception_port GC_ATTR_UNUSED,
 
     UNPROTECT(h, GC_page_size);
     for (i = 0; i < divHBLKSZ(GC_page_size); i++) {
-      int index = PHT_HASH(h+i);
+      word index = PHT_HASH(h+i);
       async_set_pht_entry_from_index(GC_dirty_pages, index);
     }
   } else if (GC_mprotect_state == GC_MP_DISCARDING) {