Add Windows ARM64 support - #138
Conversation
|
/build-preview |
|
🔄 Preview build started Release tag: |
This commit adds Windows ARM64 (WoA) support to JavaScriptCore. Source code changes: - Add _M_ARM64 MSVC macro to CPU detection (PlatformCPU.h, BPlatform.h) - Limit SYSV_ABI to x86_64 only on Windows (6 files) - Expand LinkRecord::CopyTypes for Windows and add FlushInstructionCache to cacheFlush (ARM64Assembler.h) - Add Windows ARM64 DECLARE_CALL_FRAME macro with x29 clobber (CallFrame.h) - Disable USE_BUILTIN_FRAME_ADDRESS for Windows ARM64 (PlatformUse.h) - Add Windows ARM64 register mappings to MachineContext.h (Sp, Fp, Pc, X1, X19, X4) - Exclude .previous directive for Windows (MacroAssemblerARM64.cpp) - Add Windows ARM64 currentStackPointer implementation (StackPointer.cpp) - Disable inline ASM unaryDoubleOpWrapper for Windows ARM64 (ThunkGenerators.cpp) - Add Windows ARM64 COFF-style addressing to globaladdr (arm64.rb) - Add architecture detection for clang_rt.builtins (OptionsMSVC.cmake) CI changes: - Add Windows ARM64 matrix entries (windows-11-arm runner) - Add ARM64-specific LLVM installation step - Update Build WebKit step with Platform parameter - Add Windows ARM64 artifact download/upload in release job
8d20fd8 to
a48085e
Compare
|
/build-preview |
|
This may have been caused by a newer build being triggered for the same PR. |
|
🔄 Preview build started Release tag: |
|
This may have been caused by a newer build being triggered for the same PR. |
|
❌ Preview build failed Check the workflow run for details. |
Use the official LLVM releases URL instead of aspect-build/llvm-project which doesn't have Windows ARM64 (woa64) builds. The correct URL format is: https://github.com/llvm/llvm-project/releases/download/llvmorg-<version>/LLVM-<version>-woa64.exe Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
❌ Preview build failed Check the workflow run for details. |
The ICU project files specify Windows SDK 10.0.16299.0 which isn't available on the Windows ARM64 GitHub Actions runner. Add /p:WindowsTargetPlatformVersion=10.0 to MSBuild calls to let it pick the latest available SDK version. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
❌ Preview build failed Check the workflow run for details. |
The VS Developer Shell adds VS's bundled x64 LLVM tools to PATH before our explicitly installed ARM64 LLVM. This caused cmake to use the x64 clang-cl which generates x64 code, but the ARM64 libraries were being linked, causing architecture mismatch errors. For ARM64 builds, explicitly specify the full path to the ARM64 LLVM toolchain we installed (C:/LLVM/bin/clang-cl.exe and lld-link.exe). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
❌ Preview build failed Check the workflow run for details. |
LLVM 19 has a bug in the AArch64 backend that causes SEH unwind info errors when compiling JSC on Windows ARM64: "fatal error: error in backend: Failed to evaluate function length in SEH unwind info" LLVM 21.1.8 has better Windows ARM64 support and likely fixes this issue. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
❌ Preview build failed Check the workflow run for details. |
Use /clang: prefix instead of -Xclang when passing Clang-specific flags to clang-cl. The /clang: prefix is the proper clang-cl syntax for passing flags directly to the Clang frontend.
|
This may have been caused by a newer build being triggered for the same PR. |
|
❌ Preview build failed Check the workflow run for details. |
Add -mllvm -align-loops=1 flag for Windows ARM64 builds to work around the LLVM bug llvm/llvm-project#47432 which causes 'Failed to evaluate function length in SEH unwind info' errors when inline assembly contains alignment directives. This is a known issue that affects all current LLVM versions on Windows ARM64. The workaround disables loop alignment which prevents the compiler from generating the problematic alignment directives in inline assembly.
|
❌ Preview build failed Check the workflow run for details. |
The -mllvm -align-loops option was removed in LLVM 21. Use the official Clang frontend -falign-loops=1 flag instead.
|
❌ Preview build failed Check the workflow run for details. |
LLVM has a bug (llvm/llvm-project#47432) on Windows ARM64 that causes a fatal error 'Failed to evaluate function length in SEH unwind info' when inline assembly contains alignment directives like .balign. The probe trampoline in MacroAssemblerARM64.cpp uses .balign 16 for function alignment, which triggers this bug. Since the probe functionality is primarily used for debugging/profiling and is not critical for normal operation, we disable it on Windows ARM64 by wrapping the inline assembly and probe() function in a conditional compilation guard. A stub implementation is provided that triggers RELEASE_ASSERT if probe is ever called on Windows ARM64, ensuring any code paths that rely on it will be caught during development.
|
❌ Preview build failed Check the workflow run for details. |
LLVM has a bug (llvm/llvm-project#47432) on Windows ARM64 that causes a fatal error 'Failed to evaluate function length in SEH unwind info' when inline assembly contains alignment directives like .balign/.balignl. The LowLevelInterpreter uses alignment directives for performance optimization (better instruction cache usage), but they are not required for correctness. On Windows ARM64, we disable these directives to work around the LLVM bug.
|
❌ Preview build failed Check the workflow run for details. |
LLVM has a bug (llvm/llvm-project#47432) that causes a fatal error "Failed to evaluate function length in SEH unwind info" when inline assembly contains alignment directives like .p2align on Windows ARM64. The gcSafeZeroMemory function has ARM64-specific inline assembly with .p2align 4, which triggers this bug. Fall back to the generic scalar implementation on Windows ARM64.
|
✅ Preview build completed Release: autobuild-preview-pr-138-a5af1deb |
|
Caution Review failedThe pull request is closed. WalkthroughAdds Windows ARM64 support across the WebKit build infrastructure, including platform-specific CI workflows, assembly handling, calling convention adjustments, and toolchain configuration while maintaining x86_64 compatibility. Changes
Possibly related PRs
Comment |
Summary
This PR adds Windows ARM64 (WoA) support to JavaScriptCore.
Source Code Changes
CPU Detection
_M_ARM64MSVC macro to ARM64 CPU detection inPlatformCPU.handBPlatform.hCalling Conventions
SYSV_ABIattribute to x86_64 only on Windows (ARM64 uses a different ABI)PlatformCallingConventions.hCodePtr.hFunctionPtr.hFunctionTraits.h(2 locations)AbstractMacroAssembler.hARM64 Assembler
LinkRecord::CopyTypestouint64_t content[5]for Windows (different struct packing)FlushInstructionCache()API call tocacheFlush()for WindowsFrame Pointer Handling
DECLARE_CALL_FRAMEmacro withx29clobber inCallFrame.hUSE_BUILTIN_FRAME_ADDRESSfor Windows ARM64 inPlatformUse.hRegister Mappings
MachineContext.h:stackPointerImpl:regs.SpframePointerImpl:regs.FpinstructionPointerImpl:regs.PcargumentPointer<1>:regs.X1wasmInstancePointer:regs.X19llintInstructionPointer:regs.X4Assembler Directives
.previousdirective for Windows inMacroAssemblerARM64.cpp(COFF doesn't support it)currentStackPointerimplementation inStackPointer.cppJIT/Offlineasm
unaryDoubleOpWrapperfor Windows ARM64 inThunkGenerators.cppglobaladdrinarm64.rbBuild System
clang_rt.builtinslibrary inOptionsMSVC.cmake(aarch64vsx86_64)CI Changes
windows-11-armrunner-PlatformparameterTesting
This PR needs to be tested on Windows ARM64 hardware via CI.