[runtime] Unbalanced GC Unsafe transitions before shutdown (mono/mono#17566)
authorAleksey Kliger (λgeek) <alklig@microsoft.com>
Sat, 26 Oct 2019 22:45:35 +0000 (18:45 -0400)
committerGitHub <noreply@github.com>
Sat, 26 Oct 2019 22:45:35 +0000 (18:45 -0400)
commit40e0df20d21289ace3be27fb792e5f5ed4c72e5e
tree5c0c6db99e70a13a1619fd7da198e712ff68b310
parent4ccaa2f49be0791121588cebc09fd6997335b278
[runtime] Unbalanced GC Unsafe transitions before shutdown (mono/mono#17566)

When embedders call mono_runtime_quit or mono_jit_cleanup, we need to do unbalanced transitions to GC Unsafe, because after mini_cleanup runs we don't have GC thread states anymore and MONO_EXIT_GC_UNSAFE will assert.

* [runtime] Do an unbalanced GC Unsafe transition in mono_jit_cleanup

After mini_cleanup, we don't have GC thread states anymore because all that
stuff was cleaned up, so MONO_EXIT_GC_UNSAFE would assert

* [runtime] Mark mono_runtime_quit external only.

Runtime should use mono_runtime_quit_internal.

After we call the quit_function (aka mini_cleanup) we don't have any GC thread
states anymore because all that stuff got cleaned up.  So MONO_EXIT_GC_UNSAFE
can't work.

Commit migrated from https://github.com/mono/mono/commit/0e3caf00df54199be88cfcb53ed847226defebb4
src/mono/mono/metadata/appdomain.c
src/mono/mono/metadata/appdomain.h
src/mono/mono/metadata/coree.c
src/mono/mono/metadata/domain-internals.h
src/mono/mono/metadata/icall.c
src/mono/mono/metadata/runtime.c
src/mono/mono/mini/debugger-agent.c
src/mono/mono/mini/driver.c