From: Evgeny Karpov Date: Thu, 27 Apr 2023 00:45:00 +0000 (+0200) Subject: Add arm64 wasm support (#83677) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~2609 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86c71e4a9b2742802541afb087a9f6541b27bb4a;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Add arm64 wasm support (#83677) --- diff --git a/eng/native/init-vs-env.cmd b/eng/native/init-vs-env.cmd index 68242ed..6c1ad8f 100644 --- a/eng/native/init-vs-env.cmd +++ b/eng/native/init-vs-env.cmd @@ -8,7 +8,7 @@ if /i "%~1" == "x86" (set __VCBuildArch=x86) if /i "%~1" == "x64" (set __VCBuildArch=x86_amd64) if /i "%~1" == "arm" (set __VCBuildArch=x86_arm) if /i "%~1" == "arm64" (set __VCBuildArch=x86_arm64) -if /i "%~1" == "wasm" (set __VCBuildArch=x86_amd64) +if /i "%~1" == "wasm" (if /i "%PROCESSOR_ARCHITECTURE%" == "ARM64" (set __VCBuildArch=x86_arm64) else (set __VCBuildArch=x86_amd64)) :: Default to highest Visual Studio version available that has Visual C++ tools. :: diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index 77b4d14..92a0ac8 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -41,9 +41,11 @@ set(CMAKE_MODULE_PATH ) set(CMAKE_INSTALL_MESSAGE LAZY) -find_program(CCACHE_PROGRAM ccache) -if(CCACHE_PROGRAM) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") +if(USE_CCACHE) + find_program(CCACHE_PROGRAM ccache) + if(CCACHE_PROGRAM) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") + endif() endif() function(append value) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 802958d..8765984 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -737,7 +737,6 @@ $(MonoLLVMDir)/$(BuildArchitecture)/lib/libclang.dylib $(MonoLLVMDir)/$(BuildArchitecture)/lib/libclang.so $([MSBuild]::NormalizePath('$(MonoLLVMDir)', '$(BuildArchitecture)', 'bin', 'libclang.dll')) - setlocal EnableDelayedExpansion && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.bat'))" && !EMSDK_PYTHON! <_ForceRelease Condition="$([MSBuild]::IsOSPlatform('Windows')) and '$(TargetArchitecture)' == 'wasm' and '$(Configuration)' == 'Debug'">true diff --git a/src/mono/mono/metadata/coree.c b/src/mono/mono/metadata/coree.c index 2efdfd2..37c94da 100644 --- a/src/mono/mono/metadata/coree.c +++ b/src/mono/mono/metadata/coree.c @@ -646,7 +646,7 @@ STDAPI MonoFixupCorEE(HMODULE ModuleHandle) *(Trampoline)++ = 0xFF; *(Trampoline)++ = 0xE3; #else -#error Unsupported architecture. + g_assert_not_reached(); #endif #else ProcRva = (DWORD)(ExportFixup->ProcAddress.DWordPtr - (DWORD_PTR)DosHeader); diff --git a/src/mono/mono/mini/mini-windows.c b/src/mono/mono/mini/mini-windows.c index c678f4c..f5d81c5 100644 --- a/src/mono/mono/mini/mini-windows.c +++ b/src/mono/mono/mini/mini-windows.c @@ -283,7 +283,9 @@ thread_timer_expired (HANDLE thread) if (GetThreadContext (thread, &context)) { guchar *ip; -#ifdef _WIN64 +#ifdef _ARM64_ + ip = (guchar *) context.Pc; +#elif _WIN64 ip = (guchar *) context.Rip; #else ip = (guchar *) context.Eip; diff --git a/src/mono/mono/utils/mono-threads-coop.c b/src/mono/mono/utils/mono-threads-coop.c index 4ed659d..b6263bd 100644 --- a/src/mono/mono/utils/mono-threads-coop.c +++ b/src/mono/mono/utils/mono-threads-coop.c @@ -219,6 +219,7 @@ typedef struct { __declspec(naked) void __cdecl copy_stack_data_internal_win32_wrapper (MonoThreadInfo *info, MonoStackData *stackdata_begin, MonoBuiltinUnwindInfo *unwind_info_data, CopyStackDataFunc func) { +#if defined(TARGET_X86) || defined(TARGET_AMD64) __asm { mov edx, dword ptr [esp + 0Ch] mov dword ptr [edx + 00h], ebx @@ -230,6 +231,7 @@ copy_stack_data_internal_win32_wrapper (MonoThreadInfo *info, MonoStackData *sta mov edx, dword ptr [esp + 10h] jmp edx }; +#endif } #endif