[coop] Checked build GC critical regions.
authorAleksey Kliger <aleksey@xamarin.com>
Thu, 17 Dec 2015 20:03:22 +0000 (15:03 -0500)
committerAleksey Kliger <aleksey@xamarin.com>
Fri, 18 Dec 2015 20:15:49 +0000 (15:15 -0500)
commit3a60d3564ca9355e090a15de825a55a909c86692
treecf0c65a61aeb8bc54cb6aaa6ccda2bf7794716cb
parentf2b8c44a9141492c1598b35ba7f54397afc85726
[coop] Checked build GC critical regions.

For local handles in coop suspend configuartions we need the idea of a
"critical region": a situation when transitioning from GC
Unsafe (running) to GC Safe (blocking) mode constitutes a bug. In
checked builds, we'd like to assert when that happens.

This PR adds MONO_PREPARE_GC_CRITICAL_REGION,
MONO_FINISH_GC_CRITICAL_REGION and MONO_REQ_GC_NOT_CRITICAL.

In regular build, these are nops. In checked build, they use a new
thread-local flag to prevent transitions from running to blocking.
mono/metadata/handle.h
mono/utils/checked-build.c
mono/utils/checked-build.h
mono/utils/mono-threads-coop.h