[mono] Introduce MonoMemoryManager to hold memory previously owned by the domain...
commit62c0b74d57f3c0d6a7db82d5915abc8a5232aab2
authormonojenkins <jo.shields+jenkins@xamarin.com>
Tue, 15 Sep 2020 01:55:55 +0000 (14 21:55 -0400)
committerGitHub <noreply@github.com>
Tue, 15 Sep 2020 01:55:55 +0000 (14 21:55 -0400)
tree2a80a1448b4db6ca7a73515d541c70b6c064f9e9
parent49de4af005a3a6170aa5a39d499649db5ac153b0
[mono] Introduce MonoMemoryManager to hold memory previously owned by the domain (#20338)

These commits:
* Add the MonoMemoryManager struct
* Create a memory manager in every domain on legacy
* Create a memory manager in every ALC on netcore
* Update callers accessing the fields in the domain directly
* Remove lazy initialization on some of the old domain fields, in the interest in code simplification
* Put the lock protecting the MemoryManager fields inside the struct itself

Everything is still allocated at the domain level, either from the domain or default ALC depending on legacy vs netcore.

This and the follow up PR have potential to expose racy locking logic by not taking the domain lock as frequently, but if that comes up we can just readd the domain lock as needed alongside the memory manager lock.

Co-authored-by: CoffeeFlux <CoffeeFlux@users.noreply.github.com>
19 files changed:
mono/metadata/Makefile.am
mono/metadata/appdomain.c
mono/metadata/assembly-load-context.c
mono/metadata/assembly.c
mono/metadata/domain-internals.h
mono/metadata/domain.c
mono/metadata/loader-internals.h
mono/metadata/memory-manager.c [new file with mode: 0644]
mono/metadata/object.c
mono/metadata/reflection-cache.h
mono/metadata/reflection.c
mono/metadata/sre.c
mono/mini/interp/interp.c
mono/mini/interp/transform.c
mono/mini/method-to-ir.c
mono/mini/mini-runtime.c
mono/mini/monovm.h
msvc/libmonoruntime-common.targets
msvc/libmonoruntime-common.targets.filters