CodeGen X86: fix unsafe foreign calls wrt inlining
Foreign calls (unsafe and safe) interact badly with inlining and register passing ABIs (see #11792 and #12614): the inlined code to compute a parameter of the call may overwrite a register already set to pass a preceding parameter. With this patch, we compute all parameters which are not simple expressions before assigning them to fixed registers required by the ABI. Test Plan: - Add test (test both reg and stack parameters) - Validate Reviewers: osa1, bgamari, austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2263 GHC Trac Issues: #11792, #12614
Showing
- compiler/nativeGen/X86/CodeGen.hs 75 additions, 36 deletionscompiler/nativeGen/X86/CodeGen.hs
- testsuite/tests/ffi/should_run/T12614.hs 22 additions, 0 deletionstestsuite/tests/ffi/should_run/T12614.hs
- testsuite/tests/ffi/should_run/T12614.stdout 6 additions, 0 deletionstestsuite/tests/ffi/should_run/T12614.stdout
- testsuite/tests/ffi/should_run/T12614_c.c 5 additions, 0 deletionstestsuite/tests/ffi/should_run/T12614_c.c
- testsuite/tests/ffi/should_run/all.T 5 additions, 0 deletionstestsuite/tests/ffi/should_run/all.T
Loading
Please register or sign in to comment