Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b833b1e
[clr-interp] Setup fully interpreted functional test on Apple mobile
kotlarmilos Aug 28, 2025
653d009
Run tests in runtime.yml pipeline
kotlarmilos Aug 28, 2025
a2866a3
Run arm64 architecture only
kotlarmilos Aug 29, 2025
c4830a3
Merge branch 'main' into feature/maccatalyst-ios-clr-interp-startup
kotlarmilos Aug 29, 2025
2aa07bf
Fix build
kotlarmilos Aug 29, 2025
0b82995
Remove tvOS platform
kotlarmilos Aug 29, 2025
be24a2b
Test linker option
kotlarmilos Aug 29, 2025
bf3ab59
Fix compiler flag
kotlarmilos Aug 29, 2025
94c0392
Link interpreter into coreclr library
kotlarmilos Sep 1, 2025
f00cf53
Fix wasm build
kotlarmilos Sep 1, 2025
6d0d83e
Test maccatalyst build
kotlarmilos Sep 1, 2025
6caef22
Revery no-overriding-t-option flag
kotlarmilos Sep 1, 2025
92f7bf7
Test maccatalyst build
kotlarmilos Sep 1, 2025
4003125
Revert no-overriding-t-option flag
kotlarmilos Sep 1, 2025
75514e9
Test maccatalyst build
kotlarmilos Sep 1, 2025
0fce2ff
Add SystemNative_Log and SystemNative_LogError declarations
kotlarmilos Sep 1, 2025
ce3a3c1
Remove tvos_arm64 platform
kotlarmilos Sep 1, 2025
fe167d4
Update APPLE_RUNTIME_IDENTIFIER to use placeholder
kotlarmilos Sep 2, 2025
f5a7c36
Update maccatalyst build args
kotlarmilos Sep 2, 2025
ed1a8ad
Use checked configuration
kotlarmilos Sep 2, 2025
4863f43
Remove iOS device build from runtime pipeline
kotlarmilos Sep 2, 2025
9d82bc2
Fix interpreter build exports
kotlarmilos Sep 2, 2025
7e63cb9
Fix failing build
kotlarmilos Sep 2, 2025
4772de0
Fix R2R condition
kotlarmilos Sep 2, 2025
f2a16aa
Test debug config
kotlarmilos Sep 2, 2025
94be3cd
Test checked build on MacCatalyst and simulator
kotlarmilos Sep 2, 2025
92568aa
Test debug config
kotlarmilos Sep 2, 2025
0da835f
Test checked configuration
kotlarmilos Sep 3, 2025
16cf569
Fix comment
kotlarmilos Sep 3, 2025
f262cd9
Remove dependency on dn-containers
kotlarmilos Sep 3, 2025
7ea7f4b
Define PAL_JitWriteProtect macro for platforms that don't allow JIT w…
kotlarmilos Sep 3, 2025
0f15792
Update install_clr destination to sharedFramework
kotlarmilos Sep 3, 2025
c9496c6
Fix build
kotlarmilos Sep 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion eng/native/build-commons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ build_native()
fi

if [[ "$targetOS" == maccatalyst ]]; then
cmakeArgs="-DCMAKE_SYSTEM_VARIANT=maccatalyst $cmakeArgs"
cmakeArgs="-C $__RepoRootDir/eng/native/tryrun_ios_tvos.cmake $cmakeArgs"

# set default macCatalyst deployment target
# keep in sync with SetOSTargetMinVersions in the root Directory.Build.props
cmakeArgs="-DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_SYSROOT=macosx -DCMAKE_SYSTEM_VARIANT=maccatalyst -DCMAKE_OSX_DEPLOYMENT_TARGET=15.0 $cmakeArgs"
fi

if [[ "$targetOS" == android || "$targetOS" == linux-bionic ]]; then
Expand Down
33 changes: 33 additions & 0 deletions eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,36 @@ jobs:
testBuildArgs: tree nativeaot/SmokeTests /p:BuildNativeAOTRuntimePack=true
testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig)
buildAllTestsAsStandalone: true

#
# Build the whole product using CoreCLR and run functional tests
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: Checked
runtimeFlavor: coreclr
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
isiOSLikeOnlyBuild: ${{ parameters.isiOSLikeOnlyBuild }}
platforms:
- ios_arm64
variables:
# map dependencies variables to local variables
- name: librariesContainsChange
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
- name: coreclrContainsChange
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'] ]
- name: illinkContainsChange
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'] ]
jobParameters:
testGroup: innerloop
nameSuffix: AllSubsets_CoreCLR
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
timeoutInMinutes: 120
# extra steps, run tests
postBuildSteps:
- template: /eng/pipelines/libraries/helix.yml
parameters:
creator: dotnet-bot
testRunNamePrefixSuffix: CoreCLR_$(_BuildConfig)
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,13 @@ jobs:
buildAllTestsAsStandalone: true

#
# iOS simulator
# Build the whole product using CoreCLR and run functional tests
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: checked
buildConfig: Checked
runtimeFlavor: coreclr
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
isiOSLikeSimulatorOnlyBuild: ${{ parameters.isiOSLikeSimulatorOnlyBuild }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,36 @@ jobs:
buildAllTestsAsStandalone: true
testBuildArgs: tree nativeaot/SmokeTests /p:BuildNativeAOTRuntimePack=true /p:DevTeamProvisioning=adhoc /p:EnableAppSandbox=true
testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig)

#
# Build the whole product using CoreCLR and run functional tests
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: Checked
runtimeFlavor: coreclr
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
isMacCatalystOnlyBuild: ${{ parameters.isMacCatalystOnlyBuild }}
platforms:
- maccatalyst_arm64
variables:
# map dependencies variables to local variables
- name: librariesContainsChange
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
- name: coreclrContainsChange
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'] ]
- name: illinkContainsChange
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'] ]
jobParameters:
testGroup: innerloop
nameSuffix: AllSubsets_CoreCLR
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
timeoutInMinutes: 120
# extra steps, run tests
postBuildSteps:
- template: /eng/pipelines/libraries/helix.yml
parameters:
creator: dotnet-bot
testRunNamePrefixSuffix: CoreCLR_$(_BuildConfig)
3 changes: 1 addition & 2 deletions src/coreclr/clrdefinitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ if (FEATURE_CORECLR_FLUSH_INSTRUCTION_CACHE_TO_PROTECT_STUB_READS)
endif()

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

# Use this function to enable building with a specific target OS and architecture set of defines
Expand Down
7 changes: 5 additions & 2 deletions src/coreclr/clrfeatures.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
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)
set(FEATURE_JIT 1)
if (NOT CLR_CMAKE_TARGET_ARCH_WASM)
set(FEATURE_TIERED_COMPILATION 1)
set(FEATURE_REJIT 1)
endif()

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)
set(FEATURE_JIT 1)
endif()

if (CLR_CMAKE_TARGET_ARCH_WASM OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS OR CLR_CMAKE_TARGET_MACCATALYST)
set(FEATURE_STATICALLY_LINKED 1)
endif()
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ if (FEATURE_STATICALLY_LINKED)
set(CLRJIT_STATIC clrjit_static gcinfo)
endif(FEATURE_JIT)
if (FEATURE_INTERPRETER)
set(CLRINTERPRETER_STATIC clrinterpreter)
set(CLRINTERPRETER_STATIC clrinterpreter_objects dn-containers gcinfo)
endif(FEATURE_INTERPRETER)
endif(FEATURE_STATICALLY_LINKED)

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

target_link_libraries(coreclr_static PUBLIC ${CORECLR_LIBRARIES} cee_wks_core ${CORECLR_STATIC_CLRJIT_STATIC} ${CEE_WKS_STATIC} ${FOUNDATION})
target_link_libraries(coreclr_static PUBLIC ${CORECLR_LIBRARIES} cee_wks_core ${CORECLR_STATIC_CLRJIT_STATIC} ${CLRINTERPRETER_STATIC} ${CEE_WKS_STATIC} ${FOUNDATION})
target_compile_definitions(coreclr_static PUBLIC CORECLR_EMBEDDED)

if (CLR_CMAKE_HOST_ANDROID)
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/hosts/corewasmrun/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ target_link_options(corewasmrun PRIVATE -fwasm-exceptions -sEXIT_RUNTIME=1 -sINI

target_link_libraries(corewasmrun PRIVATE
coreclr_static
clrinterpreter
icuuc
icui18n
icudata)
Expand Down
13 changes: 12 additions & 1 deletion src/coreclr/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,11 @@ CONFIG_DWORD_INFO(INTERNAL_FastGCCheckStack, W("FastGCCheckStack"), 0, "")
CONFIG_DWORD_INFO(INTERNAL_FastGCStress, W("FastGCStress"), 0, "Reduce the number of GCs done by enabling GCStress")
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_GCBreakOnOOM, W("GCBreakOnOOM"), 0, "Does a DebugBreak at the soonest time we detect an OOM")
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_gcConcurrent, W("gcConcurrent"), (DWORD)-1, "Enables/Disables concurrent GC")
#if defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)
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.")
#else
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.")
#endif // defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)

#ifdef FEATURE_CONSERVATIVE_GC
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_gcConservative, W("gcConservative"), 0, "Enables/Disables conservative GC")
Expand Down Expand Up @@ -554,8 +558,11 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_VirtualCallStubLogging, W("VirtualCallStubLogg
CONFIG_DWORD_INFO(INTERNAL_VirtualCallStubMissCount, W("VirtualCallStubMissCount"), 100, "Used only when STUB_LOGGING is defined, which by default is not.")
CONFIG_DWORD_INFO(INTERNAL_VirtualCallStubResetCacheCounter, W("VirtualCallStubResetCacheCounter"), 0, "Used only when STUB_LOGGING is defined, which by default is not.")
CONFIG_DWORD_INFO(INTERNAL_VirtualCallStubResetCacheIncr, W("VirtualCallStubResetCacheIncr"), 0, "Used only when STUB_LOGGING is defined, which by default is not.")
#if defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)
CONFIG_DWORD_INFO(INTERNAL_UseCachedInterfaceDispatch, W("UseCachedInterfaceDispatch"), 1, "If cached interface dispatch is compiled in, use that instead of virtual stub dispatch")
#else
CONFIG_DWORD_INFO(INTERNAL_UseCachedInterfaceDispatch, W("UseCachedInterfaceDispatch"), 0, "If cached interface dispatch is compiled in, use that instead of virtual stub dispatch")

#endif // defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)
///
/// Watson
///
Expand All @@ -573,7 +580,11 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_CreateDumpDiagnostics, W("CreateDumpDiagnostic
/// R2R
///
RETAIL_CONFIG_STRING_INFO(INTERNAL_NativeImageSearchPaths, W("NativeImageSearchPaths"), "Extra search paths for native composite R2R images")
#if defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MACCATALIST isn't mobile?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a different feature in the build system, but it is treated the same as mobile where JIT is not allowed.

RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ReadyToRun, W("ReadyToRun"), 0, "Enable/disable use of ReadyToRun native code") // Off by default for Apple mobile
#else
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ReadyToRun, W("ReadyToRun"), 1, "Enable/disable use of ReadyToRun native code") // On by default for CoreCLR
#endif // defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)
RETAIL_CONFIG_STRING_INFO(EXTERNAL_ReadyToRunExcludeList, W("ReadyToRunExcludeList"), "List of assemblies that cannot use Ready to Run images")
RETAIL_CONFIG_STRING_INFO(EXTERNAL_ReadyToRunLogFile, W("ReadyToRunLogFile"), "Name of file to log success/failure of using Ready to Run images")

Expand Down
34 changes: 14 additions & 20 deletions src/coreclr/interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)

# So simdhash will build correctly without a dn-config.h
add_compile_definitions(NO_CONFIG_H)

set(INTERPRETER_SOURCES
compiler.cpp
compileropt.cpp
Expand All @@ -12,10 +9,7 @@ set(INTERPRETER_SOURCES
stackmap.cpp
naming.cpp
methodset.cpp
intrinsics.cpp
../../native/containers/dn-simdhash.c
../../native/containers/dn-simdhash-ght-compatible.c
../../native/containers/dn-simdhash-ptr-ptr.c)
intrinsics.cpp)

set(INTERPRETER_LINK_LIBRARIES
gcinfo
Expand All @@ -32,39 +26,39 @@ if(CLR_CMAKE_HOST_WIN32)
set(CLRINTERPRETER_EXPORTS ${CMAKE_CURRENT_LIST_DIR}/clrinterpreter.exports)
set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/clrinterpreter.def)
preprocess_file(${CLRINTERPRETER_EXPORTS} ${EXPORTS_FILE})
list(APPEND INTERPRETER_SOURCES ${EXPORTS_FILE})
add_custom_target(interpreter_exports DEPENDS ${EXPORTS_FILE})
add_custom_target(clrinterpreter_exports DEPENDS ${EXPORTS_FILE})
else()
set(CLRINTERPRETER_EXPORTS ${CMAKE_CURRENT_LIST_DIR}/clrinterpreter_unixexports.src)
set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/clrinterpreter.exports)
generate_exports_file(${CLRINTERPRETER_EXPORTS} ${EXPORTS_FILE})
add_custom_target(interpreter_exports DEPENDS ${EXPORTS_FILE})
add_custom_target(clrinterpreter_exports DEPENDS ${EXPORTS_FILE})
endif()

if(FEATURE_STATICALLY_LINKED AND NOT FEATURE_JIT)
set(LIBRARY_TYPE STATIC)
else()
set(LIBRARY_TYPE SHARED)
add_library_clr(clrinterpreter_objects OBJECT ${INTERPRETER_SOURCES})

if (NOT CMAKE_GENERATOR MATCHES "Visual Studio")
set_target_properties(clrinterpreter_objects PROPERTIES EXCLUDE_FROM_ALL $<NOT:${FEATURE_INTERPRETER}>)
endif()

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

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

add_dependencies(clrinterpreter interpreter_exports)

if(NOT CLR_CMAKE_HOST_WIN32)
if(CLR_CMAKE_HOST_WIN32)
target_sources(clrinterpreter PRIVATE ${EXPORTS_FILE})
else()
set_exports_linker_option(${EXPORTS_FILE})
set_property(TARGET clrinterpreter APPEND_STRING PROPERTY LINK_FLAGS ${EXPORTS_LINKER_OPTION})
endif()

set_property(TARGET clrinterpreter APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE})
add_dependencies(clrinterpreter clrinterpreter_exports)

target_link_libraries(clrinterpreter
PRIVATE
${INTERPRETER_LINK_LIBRARIES}
)

set_property(TARGET clrinterpreter APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE})

install_clr(TARGETS clrinterpreter DESTINATIONS . sharedFramework COMPONENT runtime OPTIONAL)
9 changes: 7 additions & 2 deletions src/coreclr/pal/inc/pal.h
Original file line number Diff line number Diff line change
Expand Up @@ -2739,14 +2739,19 @@ VirtualFree(
IN DWORD dwFreeType);


#if defined(HOST_APPLE) && defined(HOST_ARM64)
#if defined(HOST_OSX) && defined(HOST_ARM64)

PALIMPORT
VOID
PALAPI
PAL_JitWriteProtect(bool writeEnable);

#endif // defined(HOST_APPLE) && defined(HOST_ARM64)
#elif defined(HOST_IOS) || defined(HOST_TVOS) || defined(HOST_MACCATALYST)

// Define empty macro for platforms that don't allow JIT write protection
#define PAL_JitWriteProtect(writeEnable) do { } while(0)

#endif // defined(HOST_OSX) && defined(HOST_ARM64)


PALIMPORT
Expand Down
20 changes: 3 additions & 17 deletions src/coreclr/pal/src/map/virtual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ static PCMI pVirtualMemory;

static size_t s_virtualPageSize = 0;

#if defined(HOST_APPLE) && defined(HOST_ARM64) && !defined(HOST_OSX)
void (*jit_write_protect_np)(int enabled);
#define pthread_jit_write_protect_np jit_write_protect_np
#endif // defined(HOST_APPLE) && defined(HOST_ARM64) && !defined(HOST_OSX)

/* We need MAP_ANON. However on some platforms like HP-UX, it is defined as MAP_ANONYMOUS */
#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
#define MAP_ANON MAP_ANONYMOUS
Expand Down Expand Up @@ -183,15 +178,6 @@ VIRTUALInitialize(bool initializeExecutableMemoryAllocator)
g_executableMemoryAllocator.Initialize();
}

#if defined(HOST_APPLE) && defined(HOST_ARM64) && !defined(HOST_OSX)
jit_write_protect_np = (void (*)(int))dlsym(RTLD_DEFAULT, "pthread_jit_write_protect_np");
if (jit_write_protect_np == NULL)
{
ERROR("pthread_jit_write_protect_np not available.\n");
return FALSE;
}
#endif // defined(HOST_APPLE) && defined(HOST_ARM64) && !defined(HOST_OSX)

return TRUE;
}

Expand Down Expand Up @@ -596,7 +582,7 @@ static LPVOID ReserveVirtualMemory(
#endif
}

#ifdef __APPLE__
#if defined(HOST_OSX)
if ((fAllocationType & MEM_RESERVE_EXECUTABLE) && IsRunningOnMojaveHardenedRuntime())
{
mmapFlags |= MAP_JIT;
Expand Down Expand Up @@ -1259,7 +1245,7 @@ VirtualProtect(
return bRetVal;
}

#if defined(HOST_APPLE) && defined(HOST_ARM64)
#if defined(HOST_OSX) && defined(HOST_ARM64)
PALAPI VOID PAL_JitWriteProtect(bool writeEnable)
{
thread_local int enabledCount = 0;
Expand All @@ -1279,7 +1265,7 @@ PALAPI VOID PAL_JitWriteProtect(bool writeEnable)
_ASSERTE(enabledCount >= 0);
}
}
#endif // HOST_APPLE && HOST_ARM64
#endif // HOST_OSX && HOST_ARM64

#if HAVE_VM_ALLOCATE
//---------------------------------------------------------------------------------------
Expand Down
14 changes: 9 additions & 5 deletions src/coreclr/utilcode/executableallocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ HRESULT ExecutableAllocator::StaticInitialize(FatalErrorHandler fatalErrorHandle
minipal_log_print_error("Invalid value in 'EXECUTABLE_ALLOCATOR_CACHE_SIZE' environment variable'\n");
return E_FAIL;
}

g_cachedMappingSize = customCacheSize;
}
}
Expand Down Expand Up @@ -498,7 +498,11 @@ void* ExecutableAllocator::Commit(void* pStart, size_t size, bool isExecutable)
}
else
{
#if defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_MACCATALYST)
return ClrVirtualAlloc(pStart, size, MEM_COMMIT, PAGE_READWRITE);
#else
return ClrVirtualAlloc(pStart, size, MEM_COMMIT, isExecutable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE);
#endif
}
}

Expand Down Expand Up @@ -710,7 +714,7 @@ void* ExecutableAllocator::ReserveWithinRange(size_t size, const void* loAddress
else
{
DWORD allocationType = MEM_RESERVE;
#ifdef HOST_UNIX
#if defined(HOST_UNIX) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) && !defined(TARGET_MACCATALYST)
// Tell PAL to use the executable memory allocator to satisfy this request for virtual memory.
// This will allow us to place JIT'ed code close to the coreclr library
// and thus improve performance by avoiding jump stubs in managed code.
Expand Down Expand Up @@ -800,7 +804,7 @@ void* ExecutableAllocator::Reserve(size_t size)
else
{
DWORD allocationType = MEM_RESERVE;
#ifdef HOST_UNIX
#if defined(HOST_UNIX) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) && !defined(TARGET_MACCATALYST)
// Tell PAL to use the executable memory allocator to satisfy this request for virtual memory.
// This will allow us to place JIT'ed code close to the coreclr library
// and thus improve performance by avoiding jump stubs in managed code.
Expand Down Expand Up @@ -983,14 +987,14 @@ void* ExecutableAllocator::AllocateThunksFromTemplate(void *pTemplate, size_t te
if (IsDoubleMappingEnabled() && VMToOSInterface::AllocateThunksFromTemplateRespectsStartAddress())
{
CRITSEC_Holder csh(m_CriticalSection);

bool isFreeBlock;
BlockRX* block = AllocateBlock(templateSize * 2, &isFreeBlock);
if (block == NULL)
{
return NULL;
}

void* result = VMToOSInterface::ReserveDoubleMappedMemory(m_doubleMemoryMapperHandle, block->offset, templateSize * 2, 0, 0);

if (result != NULL)
Expand Down
Loading
Loading