Skip to content

[mono][llvm] Support exception filters #54185

Open
@imhameed

Description

@imhameed

Seen in https://github.com/dotnet/runtime/blob/6474c725025a8b29b4265c4d9485018982ee6b16/src/tests/JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32.cs. Makes Mono bail out of translating to LLVM with "LLVM failed for 'Program.Main': non-finally/catch/fault clause."

The resulting test then ends up with weird semi-consistent codegen which causes it to print:

Intrinsic Sse42.X64.Crc32 is called on non-supported hardware.
Sse42.IsSupported False
Environment.Is64BitProcess True
Intrinsic Sse42.X64.Crc32 is called via reflection on non-supported hardware.
Sse42.IsSupported False
Environment.Is64BitProcess True

but still yield 0 (instead of 100) as an exit code.

Random notes:

https://llvm.org/docs/LangRef.html#llvm-localescape-and-llvm-localrecover-intrinsics
https://github.com/dotnet/llvm-project/blob/release/11.x/llvm/test/CodeGen/X86/wineh-coreclr.ll

One difficulty with llvm.localaddress and llvm.localrecover is that they are currently only supported on x86, x86-64, and aarch64. But it doesn't look like it'd be too hard to add support for other platforms. (But I have no idea how involved this would be for WASM)

Also enable JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32_{r,ro} test with the fix

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions