You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b61e6c6
Browse filesBrowse the repository at this point in the historyBrowse files
Throw and catch in 32-bit programs (32-bit support, phase 3) (#336)
* Add the Phase 3 plan for 32-bit support (x86 exception handling)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* Make EH cross-references absolute on 32-bit x86
ThrowInfo, CatchableType and CatchableTypeArray hold i32 cross-references.
64-bit MSVC stores image-base-relative RVAs there; 32-bit x86 stores the
absolute address, which is also 4 bytes, so only the value changes.
Both RTTI helpers (MLIR-level and LLVM-dialect) now build these through one
ehReference() helper gated on targetInfo.usesImageBaseRelativeEH, and
declare __ImageBase only when it is referenced. x64 output is unchanged.
Adds tslang/test/check-x86-eh.sh, which checks the x86 and x64 IR and the
x86 object's relocations (DIR32, not DIR32NB).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* Make _CxxThrowException stdcall on 32-bit x86
On i686-pc-windows-msvc, _CxxThrowException is __stdcall, so its symbol
is __CxxThrowException@8 and the link failed on the undecorated name.
A new module pass, CxxThrowCallingConvPass, sets x86_stdcallcc on the
declaration and on every call and invoke of it. It runs after
Win32ExceptionPass (which synthesizes rethrows and turns calls into
invokes) and before the optimization pipeline, since a call whose
convention differs from its callee's is UB that InstCombine turns into
unreachable. Any non-callee use is a hard error. It is gated on
targetInfo.stdcallDecoratesCxxThrow, so x64 output is unchanged.
check-x86-eh.sh gains the decorated-symbol check at x86 and x64 and an
IR check that no call site keeps the C convention, with and without
--opt. mask-ir.sh lists 00typeof_union_narrowing as known-noisy.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* Run exception programs as 32-bit exes under every model
check-x86-eh.sh now links and runs x86 programs that throw. eh_order.ts
prints a trace that pins the unwinding order: finally blocks run
innermost-first, a throw from a catch reaches the outer try, a rethrow is
caught, and execution continues after each. Eleven exception corpus files
run beside it; they assert internally, so exit 0 is the check. Every case
runs under gc, rc and none, checks the exe is I386, and has a 20 s limit.
The rethrow in eh_order.ts uses a typed catch. An untyped catch variable
gets a void* handler, which does not match a thrown int, at x64 as well.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* Bring the spec up to date with Phase 3; decide EH RVAs by pointer width
The spec now describes the calling-convention pass and ehReference as
built, records the Phase 4 findings (async exits 139 at i686, 64-bit EH
name mangling, untyped catch misses thrown numbers) and the catch_value
results. usesImageBaseRelativeEH follows pointer width, as clang's
MicrosoftCXXABI does, so 32-bit ARM Windows is absolute too.
check-x86-eh.sh requires timeout.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
0 commit comments