Skip to content
Snippets Groups Projects
Forked from Glasgow Haskell Compiler / GHC
Source project has a limited visibility.
  • Cheng Shao's avatar
    c657ffc4
    compiler: avoid saving foreign call target to local when there are no caller-save GlobalRegs · c657ffc4
    Cheng Shao authored
    This patch makes the STG->Cmm backend avoid saving foreign call target
    to local when there are no caller-save GlobalRegs.
    
    Since 321941a8, when we lower a
    foreign call, we unconditionally save the foreign call target to a
    temporary local first, then rely on cmmSink to clean it up later,
    which only happens with -fcmm-sink (implied by -O) and not in
    unoptimized code.
    
    And this is troublesome for the wasm backend NCG, which needs to infer
    a foreign call target symbol's type signature from the Cmm call site.
    Previously, the NCG has been emitting incorrect type signatures for
    unoptimized code, which happens to work with `wasm-ld` most of the
    time, but this is never future-proof against upstream toolchain
    updates, and it causes horrible breakages when LTO objects are
    included in linker input. Hence this patch.
    
    (cherry picked from commit 8dd8a076)
    (cherry picked from commit 2b2a3db8)
    (cherry picked from commit de7c02b5)
    c657ffc4
    History
    compiler: avoid saving foreign call target to local when there are no caller-save GlobalRegs
    Cheng Shao authored
    This patch makes the STG->Cmm backend avoid saving foreign call target
    to local when there are no caller-save GlobalRegs.
    
    Since 321941a8, when we lower a
    foreign call, we unconditionally save the foreign call target to a
    temporary local first, then rely on cmmSink to clean it up later,
    which only happens with -fcmm-sink (implied by -O) and not in
    unoptimized code.
    
    And this is troublesome for the wasm backend NCG, which needs to infer
    a foreign call target symbol's type signature from the Cmm call site.
    Previously, the NCG has been emitting incorrect type signatures for
    unoptimized code, which happens to work with `wasm-ld` most of the
    time, but this is never future-proof against upstream toolchain
    updates, and it causes horrible breakages when LTO objects are
    included in linker input. Hence this patch.
    
    (cherry picked from commit 8dd8a076)
    (cherry picked from commit 2b2a3db8)
    (cherry picked from commit de7c02b5)
Code owners
Assign users and groups as approvers for specific file changes. Learn more.