[sgen] Avoid popping the entire finalizer queues if finalizers are suspended
authorVlad Brezae <brezaevlad@gmail.com>
Mon, 25 Jul 2016 17:40:59 +0000 (20:40 +0300)
committerVlad Brezae <brezaevlad@gmail.com>
Wed, 27 Jul 2016 00:09:53 +0000 (03:09 +0300)
commiteb92161b45dacca672237d203b77090cb5a7b7be
tree2a43ebc6ac838259aca49a719dd71ca4106422c1
parent200f8b2227d23f91948a6495523e5abd9dffeb82
[sgen] Avoid popping the entire finalizer queues if finalizers are suspended

When we shutdown we set suspend_finalizers flag in metadata so we no longer run any finalizers. After recent changes, we avoid traversing gc hashes for finalizer enqueuing when this flag is set. The counterpart, popping the queues empty (even without running the finalizers) can still take some time, especially since we lock for each entry. Exit early from this loop if we no longer need to run finalizers.

Achieve this by setting a new flag inside sgen, instead of passing the address of suspend_finalizers all the time to the sgen api.
mono/metadata/boehm-gc.c
mono/metadata/gc-internals.h
mono/metadata/gc.c
mono/metadata/null-gc.c
mono/metadata/sgen-mono.c
mono/sgen/sgen-fin-weak-hash.c
mono/sgen/sgen-gc.c
mono/sgen/sgen-gc.h