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
Refactor and correct the "is pure" and "can raise" (port upstream PR#10354 and PR#10387) (#555)
* Refactor Proc.op_is_pure and fix Mach.operation_can_raise
These two predicates test properties of Mach operations. For the
standard operations, the results are independent of the target
platform. For the platform-specific operations, results vary.
The "is pure" predicate was implemented in a platform-specific file,
$ARCH/proc.ml. The treatment of standard operations was duplicated.
The "can raise" predicate was implemented in a platform-independent file,
mach.ml. All specific operations were assumed not to raise, which is
incorrect for ARM and ARM64 and their "shiftcheckbound" specific operation.
(See #10339.)
This commit refactors the two predicates as follows:
- `Arch.operation_is_pure` and `Arch.operation_can_raise` predicates
are added to each platform description file. They deal with
specific operations only.
- `Mach.operation_is_pure` was added and `Mach.operation_can_raise`
was fixed to implement the test for standard operations and
delegate to the Arch functions for specific operations.
* Fix handling of exception-raising specific operations during spilling
The ARM and ARM64 architectures have `Ishiftcheckbound` specific instructions
that can raise an Invalid_argument exception. This exception can, in turn,
be handled in the same function (see PR#10339 for an example).
However, these specific instructions were not taken into account
during insertion of spill code in asmcomp/spill.ml. The consequence
is a variable that is reloaded from stack in the exception handler,
yet has not been spilled to stack before.
This commit fixes the issue by using the recently-fixed
`Mach.operation_can_raise` predicate to handle operations during spill
code insertion, instead of an ad-hoc pattern-matching.
Fixes: PR#10339
* Fix handling of exception-raising specific operations during liveness analysis (#10387)
This is a follow-up to 15e6354 and #10354.
Use the `Mach.operation_can_raise` predicate instead of an ad-hoc
pattern matching to spot operations where the variables live at entry
to the enclosing exception handler must also be live.
The ad-hoc pattern matching was missing the `Ishiftcheckbound`
specific operations of ARM and ARM64.
* Handle flambda-backend operations
* Update cfg
* Iprobe_is_enabled is pure
* Exhaustive match
* Fix after rebase
* Fix arm64 after rebase and cleanup
Co-authored-by: Xavier Leroy <xavier.leroy@college-de-france.fr>
Co-authored-by: Xavier Leroy <xavierleroy@users.noreply.github.com>
0 commit comments