[mono] Componentize hot reload (#52866)
authorAleksey Kliger (λgeek) <alklig@microsoft.com>
Sat, 12 Jun 2021 04:32:57 +0000 (00:32 -0400)
committerGitHub <noreply@github.com>
Sat, 12 Jun 2021 04:32:57 +0000 (00:32 -0400)
commit23336b89d83e51789e0fd8bdff40689f5be2a58b
tree5071fc2071f18556fdb34e4ee59a0d7d9f76dbb9
parent1b382e2b1f06f20d80cc62f83277637dfb7a1831
[mono] Componentize hot reload (#52866)

* Move most of the code to hot_reload.c

For the fast path data, we will leave a struct in the runtime with the values
and pass its address to the component to fill in.

* Mark functions used by hot reload with MONO_COMPONENT_API

* Drop the metadata_update_init EE and runtime callbacks

They're unused now

* remove mono_ prefix from some static methods in hot reload

* Always define metadata_update_published runtime callback

* Move metadata update data out of MonoImage, into hot_reload component

Use separate baseline and delta structs for tracking updates

* move slowpath metadata lookup, and cleanup to hot_reload component

Move the delta_image and method_table_update data into BaselineInfo
and DeltaInfo.  Keep a single `MonoImage:has_updates` flag to switch
over to the slow path through the component.

* fixup: set has_updates on first update, too

Also setup the BaselineInfo and DeltaInfo earlier before the first
string heap lookup

* fixup after rebase

* ConsoleDelta sample: build on osx-arm64, use hotreload buildtool

instead of hotreload-delta-gen CLI tool

* fix whitespace

* bugfix - get the value of MonoImage:has_updates not its address

* Dynamically query runtime for GetApplyUpdateCapabilities

if the hot reload component is stubbed out, return empty capabilities.

This is a step toward removing FEATURE_METADATA_UPDATE and
ENABLE_METADATA_UPDATE defines and solely using component
infrastrucutre for controlling behavior

* Mark some runtime functions with MONO_COMPONENT_API

* fixup icall declaration

* fix whitespace and indentation

* Return capabilities if hot reload component is available, even if env var isn't set.

Match CoreCLR behavior.  Also makes our testsuite actually run the
tests (we check for capabilities before running setting
DOTNET_MODIFIABLE_ASSEMBLIES using the remote executor)
25 files changed:
src/mono/System.Private.CoreLib/src/System/Reflection/Metadata/AssemblyExtensions.cs
src/mono/mono/component/hot_reload-stub.c
src/mono/mono/component/hot_reload.c
src/mono/mono/component/hot_reload.h
src/mono/mono/metadata/assembly-internals.h
src/mono/mono/metadata/domain.c
src/mono/mono/metadata/icall-decl.h
src/mono/mono/metadata/icall-def-netcore.h
src/mono/mono/metadata/icall.c
src/mono/mono/metadata/image.c
src/mono/mono/metadata/loader-internals.h
src/mono/mono/metadata/loader.c
src/mono/mono/metadata/metadata-internals.h
src/mono/mono/metadata/metadata-update.c
src/mono/mono/metadata/metadata-update.h
src/mono/mono/metadata/metadata.c
src/mono/mono/metadata/metadata.h
src/mono/mono/metadata/object-internals.h
src/mono/mono/mini/ee.h
src/mono/mono/mini/interp-stubs.c
src/mono/mono/mini/interp/interp.c
src/mono/mono/mini/mini-runtime.c
src/mono/mono/utils/mono-error-internals.h
src/mono/mono/utils/mono-logger-internals.h
src/mono/sample/mbr/console/ConsoleDelta.csproj