gboolean sgen_find_optimized_pin_queue_area (void *start, void *end, size_t *first_out, size_t *last_out) { size_t first = sgen_pointer_queue_search (&pin_queue, start); size_t last = sgen_pointer_queue_search (&pin_queue, end); SGEN_ASSERT (0, last == pin_queue.next_slot || pin_queue.data [last] >= end, "Pin queue search gone awry"); *first_out = first; *last_out = last; return first != last; }
/* * The pin_queue should be full and sorted, without entries from the cemented * objects. We traverse the cement hash and check if each object is pinned in * the pin_queue (the pin_queue contains entries between obj and obj+obj_len) */ void sgen_cement_force_pinned (void) { int i; if (!cement_enabled) return; for (i = 0; i < SGEN_CEMENT_HASH_SIZE; i++) { GCObject *obj = cement_hash [i].obj; size_t index; if (!obj) continue; if (cement_hash [i].count < SGEN_CEMENT_THRESHOLD) continue; SGEN_ASSERT (0, !cement_hash [i].forced, "Why do we have a forced cemented object before forcing ?"); /* Returns the index of the target or of the first element greater than it */ index = sgen_pointer_queue_search (&pin_queue, obj); if (index == pin_queue.next_slot) continue; SGEN_ASSERT (0, pin_queue.data [index] >= (gpointer)obj, "Binary search should return a pointer greater than the search target"); if (pin_queue.data [index] < (gpointer)((char*)obj + sgen_safe_object_get_size (obj))) cement_hash [i].forced = TRUE; } }