Skip to content

Commit 8818fb0

Browse files
authored
Always build with hot reload support (in a component) (#54124)
Get rid of the ENABLE_METADATA_UPDATE ifdef. To disable hot reload, don't include the component in the runtime
1 parent af5c238 commit 8818fb0

File tree

23 files changed

+4
-171
lines changed

23 files changed

+4
-171
lines changed

src/mono/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR(CMAKE_CXX_COMPILER_ID STREQUAL "Cla
109109
set(GCC 1)
110110
endif()
111111

112-
if(DISABLE_INTERPRETER)
113-
unset(ENABLE_METADATA_UPDATE)
114-
endif()
115-
116112
add_definitions(-DHAVE_CONFIG_H)
117113

118114
if(GCC)

src/mono/Directory.Build.props

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,4 @@
7777
<MonoAOTCompilerProjDirectory>$([MSBuild]::NormalizeDirectory('$(RepoTasksDir)', 'AotCompilerTask'))</MonoAOTCompilerProjDirectory>
7878
</PropertyGroup>
7979

80-
<!-- Feature defaults for mono.proj and System.Private.CoreLib.csproj -->
81-
<PropertyGroup>
82-
<!-- default metadata update support for specific platforms -->
83-
<MonoMetadataUpdate Condition="'$(MonoMetadataUpdate)' == '' and ('$(TargetsAndroid)' == 'true' or '$(TargetsBrowser)' == 'true')">true</MonoMetadataUpdate>
84-
<MonoMetadataUpdate Condition="'$(MonoMetadataUpdate)' == '' and ('$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsMacCatalyst)' == 'true')">true</MonoMetadataUpdate>
85-
<MonoMetadataUpdate Condition="'$(MonoMetadataUpdate)' == ''">false</MonoMetadataUpdate>
86-
</PropertyGroup>
8780
</Project>

src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,6 @@
125125
<DefineConstants Condition="'$(FeatureObjCMarshal)' == 'true'">$(DefineConstants);FEATURE_OBJCMARSHAL</DefineConstants>
126126
</PropertyGroup>
127127

128-
<!-- Experimental mono metadata update feature -->
129-
<PropertyGroup>
130-
<DefineConstants Condition="'$(MonoMetadataUpdate)' == 'true'">$(DefineConstants);FEATURE_METADATA_UPDATE</DefineConstants>
131-
</PropertyGroup>
132-
133128
<!-- ILLinker settings -->
134129
<PropertyGroup>
135130
<ILLinkTrimAssembly>true</ILLinkTrimAssembly>

src/mono/System.Private.CoreLib/src/System/Reflection/Metadata/AssemblyExtensions.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ public static void ApplyUpdate(Assembly assembly, ReadOnlySpan<byte> metadataDel
3737
if (runtimeAssembly == typeof(AssemblyExtensions).Assembly)
3838
throw new InvalidOperationException (SR.InvalidOperation_AssemblyNotEditable);
3939

40-
#if !FEATURE_METADATA_UPDATE
41-
throw new NotSupportedException (SR.NotSupported_MethodBodyReplacement);
42-
#else
4340
unsafe
4441
{
4542
IntPtr monoAssembly = runtimeAssembly.GetUnderlyingNativeHandle ();
@@ -48,7 +45,6 @@ public static void ApplyUpdate(Assembly assembly, ReadOnlySpan<byte> metadataDel
4845
ApplyUpdate_internal(monoAssembly, metadataDeltaPtr, metadataDelta.Length, ilDeltaPtr, ilDelta.Length, pdbDeltaPtr, pdbDelta.Length);
4946
}
5047
}
51-
#endif
5248
}
5349

5450
private static Lazy<string> s_ApplyUpdateCapabilities = new Lazy<string>(() => InitializeApplyUpdateCapabilities());
@@ -57,21 +53,14 @@ public static void ApplyUpdate(Assembly assembly, ReadOnlySpan<byte> metadataDel
5753

5854
private static string InitializeApplyUpdateCapabilities()
5955
{
60-
#if !FEATURE_METADATA_UPDATE
61-
return string.Empty;
62-
#else
6356
return ApplyUpdateEnabled() != 0 ? "Baseline" : string.Empty ;
64-
#endif
6557
}
6658

6759

68-
#if FEATURE_METADATA_UPDATE
6960
[MethodImpl (MethodImplOptions.InternalCall)]
7061
private static extern int ApplyUpdateEnabled ();
7162

7263
[MethodImpl (MethodImplOptions.InternalCall)]
7364
private static unsafe extern void ApplyUpdate_internal (IntPtr base_assm, byte* dmeta_bytes, int dmeta_length, byte *dil_bytes, int dil_length, byte *dpdb_bytes, int dpdb_length);
74-
#endif
75-
7665
}
7766
}

src/mono/cmake/config.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,9 +1070,6 @@
10701070
/* Enable runtime checks of mempool references between metadata images (must set env var MONO_CHECK_MODE=metadata) */
10711071
#cmakedefine ENABLE_CHECKED_BUILD_METADATA 1
10721072

1073-
/* Enable runtime support for metadata updates */
1074-
#cmakedefine ENABLE_METADATA_UPDATE 1
1075-
10761073
/* Enable static linking of mono runtime components */
10771074
#cmakedefine STATIC_COMPONENTS
10781075

src/mono/cmake/options.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ option (ENABLE_CHECKED_BUILD_PRIVATE_TYPES "Enable compile time checking that ge
5353
option (ENABLE_CHECKED_BUILD_GC "Enable runtime GC Safe / Unsafe mode assertion checks (must set env var MONO_CHECK_MODE=gc)")
5454
option (ENABLE_CHECKED_BUILD_THREAD "Enable runtime history of per-thread coop state transitions (must set env var MONO_CHECK_MODE=thread)")
5555
option (ENABLE_CHECKED_BUILD_METADATA "Enable runtime checks of mempool references between metadata images (must set env var MONO_CHECK_MODE=metadata)")
56-
option (ENABLE_METADATA_UPDATE "Enable runtime support for metadata updates")
5756
option (ENABLE_MSCORDBI "Generate mscordbi to support icordbg interface")
5857
option (STATIC_COMPONENTS "Compile mono runtime components as static (not dynamic) libraries")
5958

@@ -63,4 +62,3 @@ set (ENABLE_MINIMAL "" CACHE STRING "Set many DISABLE_ options at once. Comma-se
6362
set (AOT_TARGET_TRIPLE "" CACHE STRING "Target triple for AOT cross compiler")
6463
set (AOT_OFFSETS_FILE "" CACHE STRING "Offsets file for AOT cross compiler")
6564
set (LLVM_PREFIX "" CACHE STRING "Enable LLVM support with LLVM installed at <LLVM_PREFIX>.")
66-

src/mono/mono.proj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
- MonoAOTEnableLLVM - enable LLVM for an AOT-only Mono
99
- MonoAOTLLVMDir - [optional] the directory where LLVM is located, for an AOT-only Mono
1010
- MonoVerboseBuild - enable verbose build
11-
- MonoMetadataUpdate - enable experimental method body replacement code (in Directory.Build.props)
1211
- MonoThreadSuspend - coop,hybrid,preemptive - default thread suspend mode
1312
-->
1413

@@ -412,10 +411,6 @@
412411
</ItemGroup>
413412

414413
<!-- Devloop features -->
415-
<ItemGroup Condition="'$(MonoMetadataUpdate)' == 'true'">
416-
<_MonoCMakeArgs Include="-DENABLE_METADATA_UPDATE=1" />
417-
</ItemGroup>
418-
419414
<ItemGroup Condition="'$(MonoMsCorDbi)' == 'true'">
420415
<_MonoCMakeArgs Include="-DENABLE_MSCORDBI=1" />
421416
</ItemGroup>
@@ -655,9 +650,6 @@
655650
<MonoAOTCMakeArgs Condition="'$(MonoAOTEnableLLVM)' == 'true'" Include="-DLLVM_PREFIX=$(MonoAOTLLVMDir.TrimEnd('\/'))" />
656651
<MonoAOTCMakeArgs Include="$(_MonoAOTCFLAGSOption)" />
657652
<MonoAOTCMakeArgs Include="$(_MonoAOTCXXFLAGSOption)" />
658-
<!-- Devloop features -->
659-
<MonoAOTCMakeArgs Condition="'$(MonoMetadataUpdate)' == 'true'" Include="-DENABLE_METADATA_UPDATE=1" />
660-
661653
<!-- thread suspend -->
662654
<MonoAOTCMakeArgs Include="-DGC_SUSPEND=$(MonoThreadSuspend)" />
663655
</ItemGroup>

src/mono/mono/metadata/domain.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,8 @@ void
485485
mono_close_exe_image (void)
486486
{
487487
gboolean do_close = exe_image != NULL;
488-
#ifdef ENABLE_METADATA_UPDATE
489488
/* FIXME: shutdown hack. We mess something up and try to double-close/free it. */
490489
do_close = do_close && !exe_image->has_updates;
491-
#endif
492490
if (do_close)
493491
mono_image_close (exe_image);
494492
}

src/mono/mono/metadata/icall-decl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,7 @@ ICALL_EXPORT void ves_icall_System_Threading_LowLevelLifoSemaphore_ReleaseIn
242242
ICALL_EXPORT void ves_icall_System_Runtime_Intrinsics_X86_X86Base___cpuidex (int abcd[4], int function_id, int subfunction_id);
243243
#endif
244244

245-
#ifdef ENABLE_METADATA_UPDATE
246245
ICALL_EXPORT void ves_icall_AssemblyExtensions_ApplyUpdate (MonoAssembly *assm, gconstpointer dmeta_bytes, int32_t dmeta_len, gconstpointer dil_bytes, int32_t dil_len, gconstpointer dpdb_bytes, int32_t dpdb_len);
247246
ICALL_EXPORT gint32 ves_icall_AssemblyExtensions_ApplyUpdateEnabled (void);
248-
#endif
249247

250248
#endif // __MONO_METADATA_ICALL_DECL_H__

src/mono/mono/metadata/icall-def-netcore.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,9 @@ ICALL_TYPE(FIELDI, "System.Reflection.FieldInfo", FILEDI_1)
245245
HANDLES(FILEDI_1, "get_marshal_info", ves_icall_System_Reflection_FieldInfo_get_marshal_info, MonoReflectionMarshalAsAttribute, 1, (MonoReflectionField))
246246
HANDLES(FILEDI_2, "internal_from_handle_type", ves_icall_System_Reflection_FieldInfo_internal_from_handle_type, MonoReflectionField, 2, (MonoClassField_ref, MonoType_ref))
247247

248-
#ifdef ENABLE_METADATA_UPDATE
249248
ICALL_TYPE(ASSMEXT, "System.Reflection.Metadata.AssemblyExtensions", ASSMEXT_2)
250249
NOHANDLES(ICALL(ASSMEXT_2, "ApplyUpdateEnabled", ves_icall_AssemblyExtensions_ApplyUpdateEnabled))
251250
NOHANDLES(ICALL(ASSMEXT_1, "ApplyUpdate_internal", ves_icall_AssemblyExtensions_ApplyUpdate))
252-
#endif
253251

254252
ICALL_TYPE(MBASE, "System.Reflection.MethodBase", MBASE_1)
255253
HANDLES(MBASE_1, "GetCurrentMethod", ves_icall_GetCurrentMethod, MonoReflectionMethod, 0, ())

0 commit comments

Comments
 (0)