1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-27 21:40:34 +02:00

trace_worker_steal first does a try_pop on its own deque

Before asking other threads for values, see if there is any pending data
that overflowed from the local mark stack.
This commit is contained in:
Andy Wingo 2022-10-03 15:29:14 +02:00
parent 8b8ddaf6e2
commit 1e3122d054

View file

@ -547,6 +547,16 @@ trace_worker_steal(struct local_tracer *trace) {
struct tracer *tracer = heap_tracer(trace->heap);
struct trace_worker *worker = trace->worker;
// It could be that the worker's local trace queue has simply
// overflowed. In that case avoid contention by trying to pop
// something from the worker's own queue.
{
DEBUG("tracer #%zu: trying to pop worker's own deque\n", worker->id);
struct gc_ref obj = trace_deque_try_pop(&worker->deque);
if (gc_ref_is_heap_object(obj))
return obj;
}
while (1) {
DEBUG("tracer #%zu: trying to steal\n", worker->id);
struct gc_ref obj = trace_worker_steal_from_any(worker, tracer);