size_t new_hash = HASH3(real_key, new_size, log_new_size);
p -> next = new_table[new_hash];
+ GC_dirty(p);
new_table[new_hash] = p;
p = next;
}
}
*log_size_ptr = log_new_size;
*table = new_table;
+ GC_dirty(new_table); /* entire object */
}
GC_API int GC_CALL GC_register_disappearing_link(void * * link)
dl_set_next(new_dl, dl_hashtbl -> head[index]);
dl_hashtbl -> head[index] = new_dl;
dl_hashtbl -> entries++;
+ GC_dirty(dl_hashtbl->head + index);
UNLOCK();
+ GC_dirty(new_dl);
return GC_SUCCESS;
}
/* Remove found entry from the table. */
if (NULL == prev_dl) {
dl_hashtbl -> head[index] = dl_next(curr_dl);
+ GC_dirty(dl_hashtbl->head + index);
} else {
dl_set_next(prev_dl, dl_next(curr_dl));
+ GC_dirty(prev_dl);
}
dl_hashtbl -> entries--;
break;
{
int i;
int new_size = 0;
+ GC_bool needs_barrier = FALSE;
GC_ASSERT(I_HOLD_LOCK());
for (i = 0; i < GC_toggleref_array_size; ++i) {
break;
case GC_TOGGLE_REF_STRONG:
GC_toggleref_arr[new_size++].strong_ref = obj;
+ needs_barrier = TRUE;
break;
case GC_TOGGLE_REF_WEAK:
GC_toggleref_arr[new_size++].weak_ref = GC_HIDE_POINTER(obj);
(GC_toggleref_array_size - new_size) * sizeof(GCToggleRef));
GC_toggleref_array_size = new_size;
}
+ if (needs_barrier)
+ GC_dirty(GC_toggleref_arr); /* entire object */
}
STATIC void GC_normal_finalize_mark_proc(ptr_t);
if (!ensure_toggleref_capacity(1)) {
res = GC_NO_MEMORY;
} else {
- GC_toggleref_arr[GC_toggleref_array_size++].strong_ref =
+ GC_toggleref_arr[GC_toggleref_array_size].strong_ref =
is_strong_ref ? obj : (void *)GC_HIDE_POINTER(obj);
+ if (is_strong_ref)
+ GC_dirty(GC_toggleref_arr + GC_toggleref_array_size);
+ GC_toggleref_array_size++;
}
}
UNLOCK();
dl_hashtbl -> head[curr_index] = dl_next(curr_dl);
} else {
dl_set_next(prev_dl, dl_next(curr_dl));
+ GC_dirty(prev_dl);
}
curr_dl -> dl_hidden_link = new_hidden_link;
dl_set_next(curr_dl, dl_hashtbl -> head[new_index]);
dl_hashtbl -> head[new_index] = curr_dl;
+ GC_dirty(curr_dl);
+ GC_dirty(dl_hashtbl->head); /* entire object */
return GC_SUCCESS;
}
GC_fnlz_roots.fo_head[index] = fo_next(curr_fo);
} else {
fo_set_next(prev_fo, fo_next(curr_fo));
+ GC_dirty(prev_fo);
}
if (fn == 0) {
GC_fo_entries--;
curr_fo -> fo_fn = fn;
curr_fo -> fo_client_data = (ptr_t)cd;
curr_fo -> fo_mark_proc = mp;
+ GC_dirty(curr_fo);
/* Reinsert it. We deleted it first to maintain */
/* consistency in the event of a signal. */
if (prev_fo == 0) {
GC_fnlz_roots.fo_head[index] = curr_fo;
} else {
fo_set_next(prev_fo, curr_fo);
+ GC_dirty(prev_fo);
}
}
+ if (NULL == prev_fo)
+ GC_dirty(GC_fnlz_roots.fo_head + index);
UNLOCK();
# ifndef DBG_HDRS_ALL
if (EXPECT(new_fo != 0, FALSE)) {
fo_set_next(new_fo, GC_fnlz_roots.fo_head[index]);
GC_fo_entries++;
GC_fnlz_roots.fo_head[index] = new_fo;
+ GC_dirty(GC_fnlz_roots.fo_head + index);
UNLOCK();
+ GC_dirty(new_fo);
}
GC_API void GC_CALL GC_register_finalizer(void * obj,
size_t i; \
size_t dl_size = dl_hashtbl->log_size == -1 ? 0 : \
(size_t)1 << dl_hashtbl->log_size; \
+ GC_bool needs_barrier = FALSE; \
GC_ASSERT(I_HOLD_LOCK()); \
for (i = 0; i < dl_size; i++) { \
struct disappearing_link *prev_dl = NULL; \
curr_dl = dl_next(curr_dl); \
} \
} \
+ if (needs_barrier) \
+ GC_dirty(dl_hashtbl -> head); /* entire object */ \
}
#define DELETE_DL_HASHTBL_ENTRY(dl_hashtbl, curr_dl, prev_dl, next_dl) \
next_dl = dl_next(curr_dl); \
if (NULL == prev_dl) { \
dl_hashtbl -> head[i] = next_dl; \
+ needs_barrier = TRUE; \
} else { \
dl_set_next(prev_dl, next_dl); \
+ GC_dirty(prev_dl); \
} \
GC_clear_mark_bit(curr_dl); \
dl_hashtbl -> entries--; \
size_t i;
size_t fo_size = log_fo_table_size == -1 ? 0 :
(size_t)1 << log_fo_table_size;
+ GC_bool needs_barrier = FALSE;
GC_ASSERT(I_HOLD_LOCK());
# ifndef SMALL_CONFIG
next_fo = fo_next(curr_fo);
if (NULL == prev_fo) {
GC_fnlz_roots.fo_head[i] = next_fo;
+ needs_barrier = TRUE;
} else {
fo_set_next(prev_fo, next_fo);
+ GC_dirty(prev_fo);
}
GC_fo_entries--;
if (GC_object_finalized_proc)
/* Add to list of objects awaiting finalization. */
fo_set_next(curr_fo, GC_fnlz_roots.finalize_now);
+ GC_dirty(curr_fo);
SET_FINALIZE_NOW(curr_fo);
/* unhide object pointer so any future collections will */
/* see it. */
SET_FINALIZE_NOW(next_fo);
} else {
fo_set_next(prev_fo, next_fo);
+ GC_dirty(prev_fo);
}
curr_fo -> fo_hidden_base =
GC_HIDE_POINTER(curr_fo -> fo_hidden_base);
i = HASH2(real_ptr, log_fo_table_size);
fo_set_next(curr_fo, GC_fnlz_roots.fo_head[i]);
+ GC_dirty(curr_fo);
GC_fo_entries++;
GC_fnlz_roots.fo_head[i] = curr_fo;
curr_fo = prev_fo;
+ needs_barrier = TRUE;
}
}
prev_fo = curr_fo;
}
}
}
+ if (needs_barrier)
+ GC_dirty(GC_fnlz_roots.fo_head); /* entire object */
GC_remove_dangling_disappearing_links(&GC_dl_hashtbl);
# ifndef GC_TOGGLE_REFS_NOT_NEEDED
/* Add to list of objects awaiting finalization. */
fo_set_next(curr_fo, GC_fnlz_roots.finalize_now);
+ GC_dirty(curr_fo);
SET_FINALIZE_NOW(curr_fo);
/* unhide object pointer so any future collections will */
GC_ASSERT(result -> flags == 0);
# endif
GC_ASSERT(result -> thread_blocked_sp == NULL);
+ if (EXPECT(result != &first_thread, TRUE))
+ GC_dirty(result);
return(result);
}
} else {
GC_ASSERT(prev != &first_thread);
prev -> tm.next = p -> tm.next;
+ GC_dirty(prev);
}
}
}
} else {
GC_ASSERT(prev != &first_thread);
prev -> tm.next = p -> tm.next;
+ GC_dirty(prev);
}
if (EXPECT(p != &first_thread, TRUE)) {
GC_INTERNAL_FREE(p);
/* set up thread arguments */
args -> start = lpStartAddress;
args -> param = lpParameter;
+ GC_dirty(args);
set_need_to_lock();
thread_h = CreateThread(lpThreadAttributes, dwStackSize, GC_win32_start,
/* set up thread arguments */
args -> start = (LPTHREAD_START_ROUTINE)start_address;
args -> param = arglist;
+ GC_dirty(args);
set_need_to_lock();
thread_h = _beginthreadex(security, stack_size,
si -> start_routine = start_routine;
si -> arg = arg;
+ GC_dirty(si);
if (attr != 0 &&
pthread_attr_getdetachstate(attr, &si->detached)
== PTHREAD_CREATE_DETACHED) {
pthread_cleanup_push(GC_thread_exit_proc, (void *)me);
result = (*start)(start_arg);
me -> status = result;
+ GC_dirty(me);
pthread_cleanup_pop(1);
# ifdef DEBUG_THREADS