275 |
} |
} |
276 |
|
|
277 |
/* Internal use only; lock held. */ |
/* Internal use only; lock held. */ |
278 |
|
static void GC_remove_root_at_pos(i) |
279 |
|
int i; |
280 |
|
{ |
281 |
|
GC_root_size -= (GC_static_roots[i].r_end - GC_static_roots[i].r_start); |
282 |
|
GC_static_roots[i].r_start = GC_static_roots[n_root_sets-1].r_start; |
283 |
|
GC_static_roots[i].r_end = GC_static_roots[n_root_sets-1].r_end; |
284 |
|
GC_static_roots[i].r_tmp = GC_static_roots[n_root_sets-1].r_tmp; |
285 |
|
n_root_sets--; |
286 |
|
} |
287 |
|
|
288 |
|
#if !defined(MSWIN32) && !defined(MSWINCE) |
289 |
|
static void GC_rebuild_root_index() |
290 |
|
{ |
291 |
|
register int i; |
292 |
|
|
293 |
|
for (i = 0; i < RT_SIZE; i++) GC_root_index[i] = 0; |
294 |
|
for (i = 0; i < n_root_sets; i++) |
295 |
|
add_roots_to_index(GC_static_roots + i); |
296 |
|
} |
297 |
|
#endif |
298 |
|
|
299 |
|
/* Internal use only; lock held. */ |
300 |
void GC_remove_tmp_roots() |
void GC_remove_tmp_roots() |
301 |
{ |
{ |
302 |
register int i; |
register int i; |
303 |
|
|
304 |
for (i = 0; i < n_root_sets; ) { |
for (i = 0; i < n_root_sets; ) { |
305 |
if (GC_static_roots[i].r_tmp) { |
if (GC_static_roots[i].r_tmp) { |
306 |
GC_root_size -= |
GC_remove_root_at_pos(i); |
|
(GC_static_roots[i].r_end - GC_static_roots[i].r_start); |
|
|
GC_static_roots[i].r_start = GC_static_roots[n_root_sets-1].r_start; |
|
|
GC_static_roots[i].r_end = GC_static_roots[n_root_sets-1].r_end; |
|
|
GC_static_roots[i].r_tmp = GC_static_roots[n_root_sets-1].r_tmp; |
|
|
n_root_sets--; |
|
307 |
} else { |
} else { |
308 |
i++; |
i++; |
|
} |
|
309 |
} |
} |
|
# if !defined(MSWIN32) && !defined(MSWINCE) |
|
|
{ |
|
|
register int i; |
|
|
|
|
|
for (i = 0; i < RT_SIZE; i++) GC_root_index[i] = 0; |
|
|
for (i = 0; i < n_root_sets; i++) |
|
|
add_roots_to_index(GC_static_roots + i); |
|
310 |
} |
} |
311 |
# endif |
#if !defined(MSWIN32) && !defined(MSWINCE) |
312 |
|
GC_rebuild_root_index(); |
313 |
|
#endif |
314 |
|
} |
315 |
|
|
316 |
|
#if !defined(MSWIN32) && !defined(MSWINCE) |
317 |
|
void GC_remove_roots(b, e) |
318 |
|
char * b; char * e; |
319 |
|
{ |
320 |
|
DCL_LOCK_STATE; |
321 |
|
|
322 |
|
DISABLE_SIGNALS(); |
323 |
|
LOCK(); |
324 |
|
GC_remove_roots_inner(b, e); |
325 |
|
UNLOCK(); |
326 |
|
ENABLE_SIGNALS(); |
327 |
|
} |
328 |
|
|
329 |
|
/* Should only be called when the lock is held */ |
330 |
|
void GC_remove_roots_inner(b,e) |
331 |
|
char * b; char * e; |
332 |
|
{ |
333 |
|
int i; |
334 |
|
for (i = 0; i < n_root_sets; ) { |
335 |
|
if (GC_static_roots[i].r_start >= (ptr_t)b && GC_static_roots[i].r_end <= (ptr_t)e) { |
336 |
|
GC_remove_root_at_pos(i); |
337 |
|
} else { |
338 |
|
i++; |
339 |
|
} |
340 |
|
} |
341 |
|
GC_rebuild_root_index(); |
342 |
} |
} |
343 |
|
#endif /* !defined(MSWIN32) && !defined(MSWINCE) */ |
344 |
|
|
345 |
#if defined(MSWIN32) || defined(_WIN32_WCE_EMULATION) |
#if defined(MSWIN32) || defined(_WIN32_WCE_EMULATION) |
346 |
/* Workaround for the OS mapping and unmapping behind our back: */ |
/* Workaround for the OS mapping and unmapping behind our back: */ |
612 |
|
|
613 |
/* Mark thread local free lists, even if their mark */ |
/* Mark thread local free lists, even if their mark */ |
614 |
/* descriptor excludes the link field. */ |
/* descriptor excludes the link field. */ |
615 |
|
/* If the world is not stopped, this is unsafe. It is */ |
616 |
|
/* also unnecessary, since we will do this again with the */ |
617 |
|
/* world stopped. */ |
618 |
# ifdef THREAD_LOCAL_ALLOC |
# ifdef THREAD_LOCAL_ALLOC |
619 |
GC_mark_thread_local_free_lists(); |
if (GC_world_stopped) GC_mark_thread_local_free_lists(); |
620 |
# endif |
# endif |
621 |
|
|
622 |
/* |
/* |