Skip to content

Commit 07bc73e

Browse files
authored
[clr-interp] Enable CoreCLR interpreter functional test on iOS and MacCatalyst (#119177)
* [clr-interp] Setup fully interpreted functional test on Apple mobile * Run tests in runtime.yml pipeline * Run arm64 architecture only * Fix build * Remove tvOS platform * Test linker option * Fix compiler flag * Link interpreter into coreclr library * Fix wasm build * Test maccatalyst build * Revery no-overriding-t-option flag * Test maccatalyst build * Revert no-overriding-t-option flag * Test maccatalyst build * Add SystemNative_Log and SystemNative_LogError declarations * Remove tvos_arm64 platform * Update APPLE_RUNTIME_IDENTIFIER to use placeholder * Update maccatalyst build args * Use checked configuration * Remove iOS device build from runtime pipeline * Fix interpreter build exports * Fix failing build * Fix R2R condition * Test debug config * Test checked build on MacCatalyst and simulator * Test debug config * Test checked configuration * Fix comment * Remove dependency on dn-containers * Define PAL_JitWriteProtect macro for platforms that don't allow JIT write protection * Update install_clr destination to sharedFramework * Fix build
1 parent f4a4d5c commit 07bc73e

File tree

23 files changed

+159
-77
lines changed

23 files changed

+159
-77
lines changed

eng/native/build-commons.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ build_native()
8989
fi
9090

9191
if [[ "$targetOS" == maccatalyst ]]; then
92-
cmakeArgs="-DCMAKE_SYSTEM_VARIANT=maccatalyst $cmakeArgs"
92+
cmakeArgs="-C $__RepoRootDir/eng/native/tryrun_ios_tvos.cmake $cmakeArgs"
93+
94+
# set default macCatalyst deployment target
95+
# keep in sync with SetOSTargetMinVersions in the root Directory.Build.props
96+
cmakeArgs="-DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_SYSROOT=macosx -DCMAKE_SYSTEM_VARIANT=maccatalyst -DCMAKE_OSX_DEPLOYMENT_TARGET=15.0 $cmakeArgs"
9397
fi
9498

9599
if [[ "$targetOS" == android || "$targetOS" == linux-bionic ]]; then

eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,36 @@ jobs:
166166
testBuildArgs: tree nativeaot/SmokeTests /p:BuildNativeAOTRuntimePack=true
167167
testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig)
168168
buildAllTestsAsStandalone: true
169+
170+
#
171+
# Build the whole product using CoreCLR and run functional tests
172+
#
173+
- template: /eng/pipelines/common/platform-matrix.yml
174+
parameters:
175+
jobTemplate: /eng/pipelines/common/global-build-job.yml
176+
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
177+
buildConfig: Checked
178+
runtimeFlavor: coreclr
179+
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
180+
isiOSLikeOnlyBuild: ${{ parameters.isiOSLikeOnlyBuild }}
181+
platforms:
182+
- ios_arm64
183+
variables:
184+
# map dependencies variables to local variables
185+
- name: librariesContainsChange
186+
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
187+
- name: coreclrContainsChange
188+
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'] ]
189+
- name: illinkContainsChange
190+
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'] ]
191+
jobParameters:
192+
testGroup: innerloop
193+
nameSuffix: AllSubsets_CoreCLR
194+
buildArgs: -s clr+clr.runtime+libs+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=false /p:UseMonoRuntime=false /p:MonoForceInterpreter=false /p:BuildTestsOnHelix=false /p:UseNativeAOTRuntime=false /p:RunSmokeTestsOnly=true
195+
timeoutInMinutes: 120
196+
# extra steps, run tests
197+
postBuildSteps:
198+
- template: /eng/pipelines/libraries/helix.yml
199+
parameters:
200+
creator: dotnet-bot
201+
testRunNamePrefixSuffix: CoreCLR_$(_BuildConfig)

eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,13 @@ jobs:
135135
buildAllTestsAsStandalone: true
136136

137137
#
138-
# iOS simulator
139138
# Build the whole product using CoreCLR and run functional tests
140139
#
141140
- template: /eng/pipelines/common/platform-matrix.yml
142141
parameters:
143142
jobTemplate: /eng/pipelines/common/global-build-job.yml
144143
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
145-
buildConfig: checked
144+
buildConfig: Checked
146145
runtimeFlavor: coreclr
147146
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
148147
isiOSLikeSimulatorOnlyBuild: ${{ parameters.isiOSLikeSimulatorOnlyBuild }}

eng/pipelines/extra-platforms/runtime-extra-platforms-maccatalyst.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,36 @@ jobs:
202202
buildAllTestsAsStandalone: true
203203
testBuildArgs: tree nativeaot/SmokeTests /p:BuildNativeAOTRuntimePack=true /p:DevTeamProvisioning=adhoc /p:EnableAppSandbox=true
204204
testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig)
205+
206+
#
207+
# Build the whole product using CoreCLR and run functional tests
208+
#
209+
- template: /eng/pipelines/common/platform-matrix.yml
210+
parameters:
211+
jobTemplate: /eng/pipelines/common/global-build-job.yml
212+
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
213+
buildConfig: Checked
214+
runtimeFlavor: coreclr
215+
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
216+
isMacCatalystOnlyBuild: ${{ parameters.isMacCatalystOnlyBuild }}
217+
platforms:
218+
- maccatalyst_arm64
219+
variables:
220+
# map dependencies variables to local variables
221+
- name: librariesContainsChange
222+
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
223+
- name: coreclrContainsChange
224+
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'] ]
225+
- name: illinkContainsChange
226+
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'] ]
227+
jobParameters:
228+
testGroup: innerloop
229+
nameSuffix: AllSubsets_CoreCLR
230+
buildArgs: -s clr+clr.runtime+libs+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=false /p:UseMonoRuntime=false /p:MonoForceInterpreter=false /p:BuildTestsOnHelix=false /p:UseNativeAOTRuntime=false /p:RunSmokeTestsOnly=true
231+
timeoutInMinutes: 120
232+
# extra steps, run tests
233+
postBuildSteps:
234+
- template: /eng/pipelines/libraries/helix.yml
235+
parameters:
236+
creator: dotnet-bot
237+
testRunNamePrefixSuffix: CoreCLR_$(_BuildConfig)

src/coreclr/clrdefinitions.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ if (FEATURE_CORECLR_FLUSH_INSTRUCTION_CACHE_TO_PROTECT_STUB_READS)
222222
endif()
223223

224224
if (CLR_CMAKE_TARGET_APPLE)
225-
# Re-enable when dbgshim containing https://github.com/dotnet/diagnostics/pull/5487 is generally available
226-
# add_definitions(-DFEATURE_MAP_THUNKS_FROM_IMAGE)
225+
add_definitions(-DFEATURE_MAP_THUNKS_FROM_IMAGE)
227226
endif()
228227

229228
# Use this function to enable building with a specific target OS and architecture set of defines

src/coreclr/clrfeatures.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
if (NOT CLR_CMAKE_TARGET_ARCH_WASM AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_MACCATALYST)
2-
set(FEATURE_JIT 1)
1+
if (NOT CLR_CMAKE_TARGET_ARCH_WASM)
32
set(FEATURE_TIERED_COMPILATION 1)
43
set(FEATURE_REJIT 1)
54
endif()
65

6+
if (NOT CLR_CMAKE_TARGET_ARCH_WASM AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_MACCATALYST)
7+
set(FEATURE_JIT 1)
8+
endif()
9+
710
if (CLR_CMAKE_TARGET_ARCH_WASM OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS OR CLR_CMAKE_TARGET_MACCATALYST)
811
set(FEATURE_STATICALLY_LINKED 1)
912
endif()

src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ if (FEATURE_STATICALLY_LINKED)
187187
set(CLRJIT_STATIC clrjit_static gcinfo)
188188
endif(FEATURE_JIT)
189189
if (FEATURE_INTERPRETER)
190-
set(CLRINTERPRETER_STATIC clrinterpreter)
190+
set(CLRINTERPRETER_STATIC clrinterpreter_objects dn-containers gcinfo)
191191
endif(FEATURE_INTERPRETER)
192192
endif(FEATURE_STATICALLY_LINKED)
193193

@@ -209,7 +209,7 @@ if(NOT CLR_CMAKE_HOST_ARCH_WASM)
209209
target_link_libraries(coreclr PUBLIC ${CORECLR_LIBRARIES} ${CLRJIT_STATIC} ${CLRINTERPRETER_STATIC} cee_wks_core cee_wks ${FOUNDATION})
210210
endif(NOT CLR_CMAKE_HOST_ARCH_WASM)
211211

212-
target_link_libraries(coreclr_static PUBLIC ${CORECLR_LIBRARIES} cee_wks_core ${CORECLR_STATIC_CLRJIT_STATIC} ${CEE_WKS_STATIC} ${FOUNDATION})
212+
target_link_libraries(coreclr_static PUBLIC ${CORECLR_LIBRARIES} cee_wks_core ${CORECLR_STATIC_CLRJIT_STATIC} ${CLRINTERPRETER_STATIC} ${CEE_WKS_STATIC} ${FOUNDATION})
213213
target_compile_definitions(coreclr_static PUBLIC CORECLR_EMBEDDED)
214214

215215
if (CLR_CMAKE_HOST_ANDROID)

src/coreclr/hosts/corewasmrun/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ target_link_options(corewasmrun PRIVATE -fwasm-exceptions -sEXIT_RUNTIME=1 -sINI
2020

2121
target_link_libraries(corewasmrun PRIVATE
2222
coreclr_static
23-
clrinterpreter
2423
icuuc
2524
icui18n
2625
icudata)

src/coreclr/inc/clrconfigvalues.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,11 @@ CONFIG_DWORD_INFO(INTERNAL_FastGCCheckStack, W("FastGCCheckStack"), 0, "")
244244
CONFIG_DWORD_INFO(INTERNAL_FastGCStress, W("FastGCStress"), 0, "Reduce the number of GCs done by enabling GCStress")
245245
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_GCBreakOnOOM, W("GCBreakOnOOM"), 0, "Does a DebugBreak at the soonest time we detect an OOM")
246246
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_gcConcurrent, W("gcConcurrent"), (DWORD)-1, "Enables/Disables concurrent GC")
247+
#if defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)
248+
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_UseGCWriteBarrierCopy, W("UseGCWriteBarrierCopy"), 0, "Use a copy of the write barrier for the GC. This is somewhat faster and for optimizations where the barrier is mutated as the program runs. Setting this to 0 removes scenarios where the write barrier is ever mutable.")
249+
#else
247250
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_UseGCWriteBarrierCopy, W("UseGCWriteBarrierCopy"), 1, "Use a copy of the write barrier for the GC. This is somewhat faster and for optimizations where the barrier is mutated as the program runs. Setting this to 0 removes scenarios where the write barrier is ever mutable.")
251+
#endif // defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)
248252

249253
#ifdef FEATURE_CONSERVATIVE_GC
250254
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_gcConservative, W("gcConservative"), 0, "Enables/Disables conservative GC")
@@ -554,8 +558,11 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_VirtualCallStubLogging, W("VirtualCallStubLogg
554558
CONFIG_DWORD_INFO(INTERNAL_VirtualCallStubMissCount, W("VirtualCallStubMissCount"), 100, "Used only when STUB_LOGGING is defined, which by default is not.")
555559
CONFIG_DWORD_INFO(INTERNAL_VirtualCallStubResetCacheCounter, W("VirtualCallStubResetCacheCounter"), 0, "Used only when STUB_LOGGING is defined, which by default is not.")
556560
CONFIG_DWORD_INFO(INTERNAL_VirtualCallStubResetCacheIncr, W("VirtualCallStubResetCacheIncr"), 0, "Used only when STUB_LOGGING is defined, which by default is not.")
561+
#if defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)
562+
CONFIG_DWORD_INFO(INTERNAL_UseCachedInterfaceDispatch, W("UseCachedInterfaceDispatch"), 1, "If cached interface dispatch is compiled in, use that instead of virtual stub dispatch")
563+
#else
557564
CONFIG_DWORD_INFO(INTERNAL_UseCachedInterfaceDispatch, W("UseCachedInterfaceDispatch"), 0, "If cached interface dispatch is compiled in, use that instead of virtual stub dispatch")
558-
565+
#endif // defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)
559566
///
560567
/// Watson
561568
///
@@ -573,7 +580,11 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_CreateDumpDiagnostics, W("CreateDumpDiagnostic
573580
/// R2R
574581
///
575582
RETAIL_CONFIG_STRING_INFO(INTERNAL_NativeImageSearchPaths, W("NativeImageSearchPaths"), "Extra search paths for native composite R2R images")
583+
#if defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)
584+
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ReadyToRun, W("ReadyToRun"), 0, "Enable/disable use of ReadyToRun native code") // Off by default for Apple mobile
585+
#else
576586
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ReadyToRun, W("ReadyToRun"), 1, "Enable/disable use of ReadyToRun native code") // On by default for CoreCLR
587+
#endif // defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)
577588
RETAIL_CONFIG_STRING_INFO(EXTERNAL_ReadyToRunExcludeList, W("ReadyToRunExcludeList"), "List of assemblies that cannot use Ready to Run images")
578589
RETAIL_CONFIG_STRING_INFO(EXTERNAL_ReadyToRunLogFile, W("ReadyToRunLogFile"), "Name of file to log success/failure of using Ready to Run images")
579590

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
set(CMAKE_INCLUDE_CURRENT_DIR ON)
22

3-
# So simdhash will build correctly without a dn-config.h
4-
add_compile_definitions(NO_CONFIG_H)
5-
63
set(INTERPRETER_SOURCES
74
compiler.cpp
85
compileropt.cpp
@@ -12,10 +9,7 @@ set(INTERPRETER_SOURCES
129
stackmap.cpp
1310
naming.cpp
1411
methodset.cpp
15-
intrinsics.cpp
16-
../../native/containers/dn-simdhash.c
17-
../../native/containers/dn-simdhash-ght-compatible.c
18-
../../native/containers/dn-simdhash-ptr-ptr.c)
12+
intrinsics.cpp)
1913

2014
set(INTERPRETER_LINK_LIBRARIES
2115
gcinfo
@@ -32,39 +26,39 @@ if(CLR_CMAKE_HOST_WIN32)
3226
set(CLRINTERPRETER_EXPORTS ${CMAKE_CURRENT_LIST_DIR}/clrinterpreter.exports)
3327
set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/clrinterpreter.def)
3428
preprocess_file(${CLRINTERPRETER_EXPORTS} ${EXPORTS_FILE})
35-
list(APPEND INTERPRETER_SOURCES ${EXPORTS_FILE})
36-
add_custom_target(interpreter_exports DEPENDS ${EXPORTS_FILE})
29+
add_custom_target(clrinterpreter_exports DEPENDS ${EXPORTS_FILE})
3730
else()
3831
set(CLRINTERPRETER_EXPORTS ${CMAKE_CURRENT_LIST_DIR}/clrinterpreter_unixexports.src)
3932
set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/clrinterpreter.exports)
4033
generate_exports_file(${CLRINTERPRETER_EXPORTS} ${EXPORTS_FILE})
41-
add_custom_target(interpreter_exports DEPENDS ${EXPORTS_FILE})
34+
add_custom_target(clrinterpreter_exports DEPENDS ${EXPORTS_FILE})
4235
endif()
4336

44-
if(FEATURE_STATICALLY_LINKED AND NOT FEATURE_JIT)
45-
set(LIBRARY_TYPE STATIC)
46-
else()
47-
set(LIBRARY_TYPE SHARED)
37+
add_library_clr(clrinterpreter_objects OBJECT ${INTERPRETER_SOURCES})
38+
39+
if (NOT CMAKE_GENERATOR MATCHES "Visual Studio")
40+
set_target_properties(clrinterpreter_objects PROPERTIES EXCLUDE_FROM_ALL $<NOT:${FEATURE_INTERPRETER}>)
4841
endif()
4942

50-
add_library_clr(clrinterpreter ${LIBRARY_TYPE} ${INTERPRETER_SOURCES})
43+
add_library_clr(clrinterpreter SHARED $<TARGET_OBJECTS:clrinterpreter_objects> $<TARGET_OBJECTS:dn-containers>)
5144

5245
if (NOT CMAKE_GENERATOR MATCHES "Visual Studio")
5346
set_target_properties(clrinterpreter PROPERTIES EXCLUDE_FROM_ALL $<NOT:${FEATURE_INTERPRETER}>)
5447
endif()
5548

56-
add_dependencies(clrinterpreter interpreter_exports)
57-
58-
if(NOT CLR_CMAKE_HOST_WIN32)
49+
if(CLR_CMAKE_HOST_WIN32)
50+
target_sources(clrinterpreter PRIVATE ${EXPORTS_FILE})
51+
else()
5952
set_exports_linker_option(${EXPORTS_FILE})
6053
set_property(TARGET clrinterpreter APPEND_STRING PROPERTY LINK_FLAGS ${EXPORTS_LINKER_OPTION})
6154
endif()
6255

56+
set_property(TARGET clrinterpreter APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE})
57+
add_dependencies(clrinterpreter clrinterpreter_exports)
58+
6359
target_link_libraries(clrinterpreter
6460
PRIVATE
6561
${INTERPRETER_LINK_LIBRARIES}
6662
)
6763

68-
set_property(TARGET clrinterpreter APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE})
69-
7064
install_clr(TARGETS clrinterpreter DESTINATIONS . sharedFramework COMPONENT runtime OPTIONAL)

0 commit comments

Comments
 (0)