Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add arm64 wasm support #83677

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion eng/native/init-vs-env.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
::
Expand Down
8 changes: 5 additions & 3 deletions src/mono/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,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)
Expand Down
1 change: 0 additions & 1 deletion src/mono/mono.proj
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,6 @@
<MonoLibClang Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(MonoLLVMDir)/$(BuildArchitecture)/lib/libclang.dylib</MonoLibClang>
<MonoLibClang Condition="$([MSBuild]::IsOSPlatform('Linux'))">$(MonoLLVMDir)/$(BuildArchitecture)/lib/libclang.so</MonoLibClang>
<MonoLibClang Condition="$([MSBuild]::IsOSPlatform('Windows'))">$([MSBuild]::NormalizePath('$(MonoLLVMDir)', '$(BuildArchitecture)', 'bin', 'libclang.dll'))</MonoLibClang>
<PythonCmd Condition="'$(HostOS)' == 'windows'and '$(TargetsBrowser)' == 'true'">setlocal EnableDelayedExpansion &amp;&amp; call &quot;$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.bat'))&quot; &amp;&amp; !EMSDK_PYTHON!</PythonCmd>
<_ForceRelease Condition="$([MSBuild]::IsOSPlatform('Windows')) and '$(TargetArchitecture)' == 'wasm' and '$(Configuration)' == 'Debug'">true</_ForceRelease>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/coree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/mono/mono/mini/mini-windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/mono/mono/utils/mono-threads-coop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -230,6 +231,7 @@ copy_stack_data_internal_win32_wrapper (MonoThreadInfo *info, MonoStackData *sta
mov edx, dword ptr [esp + 10h]
jmp edx
};
#endif
}
#endif

Expand Down
1 change: 0 additions & 1 deletion src/mono/wasm/wasm.proj
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@
<_EmccLinkFlags Include="-s EXPORTED_RUNTIME_METHODS=$(_EmccExportedRuntimeMethods)" />
<_EmccLinkFlags Include="-s EXPORTED_FUNCTIONS=$(_EmccExportedFunctions)" />
<_EmccLinkFlags Include="--source-map-base http://example.com" />
<_EmccLinkFlags Include="-s STRICT_JS=1" />
<_EmccLinkFlags Include="-s WASM_BIGINT=1" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed/related ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is a fix to resolve issue related to regression in the latest emscripten

Copy link
Member

Choose a reason for hiding this comment

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

I think that latest emscripten doesn't allow it together with EXPORT_ES6=1 which is fine because that is always strict. I think @radekdoulik mentioned that last week.

<_EmccLinkFlags Include="-s EXPORT_NAME=&quot;'createDotnetRuntime'&quot;" />
<_EmccLinkFlags Include="-s MODULARIZE=1"/>
Expand Down