From 037991eba58acd89f8d368ca0e9fbdb3bc47d6a1 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 22 Feb 2018 23:39:38 +0300 Subject: [PATCH] Fix type of local variables receiving result of PHT_HASH 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/os_dep.c b/os_dep.c index f591d70..cdda0be 100644 --- 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) { -- 2.7.4