[Git][ghc/ghc][master] compiler: fix cost centre profiling breakage in wasm NCG due to incorrect register mapping
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Mon Feb 20 15:35:48 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
2592ab69 by Cheng Shao at 2023-02-20T10:35:30-05:00
compiler: fix cost centre profiling breakage in wasm NCG due to incorrect register mapping
The wasm NCG used to map CCCS to a wasm global, based on the
observation that CCCS is a transient register that's already handled
by thread state load/store logic, so it doesn't need to be backed by
the rCCCS field in the register table.
Unfortunately, this is wrong, since even when Cmm execution hasn't
yielded back to the scheduler, the Cmm code may call enterFunCCS,
which does use rCCCS.
This breaks cost centre profiling in a subtle way, resulting in
inaccurate stack traces in some test cases. The fix is simple though:
just remove the CCCS mapping.
- - - - -
2 changed files:
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
- rts/wasm/Wasm.S
Changes:
=====================================
compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
=====================================
@@ -191,7 +191,6 @@ globalInfoFromCmmGlobalReg t reg = case reg of
SpLim -> Just ("__SpLim", ty_word)
Hp -> Just ("__Hp", ty_word)
HpLim -> Just ("__HpLim", ty_word)
- CCCS -> Just ("__CCCS", ty_word)
_ -> Nothing
where
ty_word = SomeWasmType t
@@ -202,7 +201,7 @@ supportedCmmGlobalRegs =
<> [FloatReg i | i <- [1 .. 6]]
<> [DoubleReg i | i <- [1 .. 6]]
<> [LongReg i | i <- [1 .. 1]]
- <> [Sp, SpLim, Hp, HpLim, CCCS]
+ <> [Sp, SpLim, Hp, HpLim]
-- | Truncate a subword.
truncSubword :: Width -> WasmTypeTag t -> WasmExpr w t -> WasmExpr w t
=====================================
rts/wasm/Wasm.S
=====================================
@@ -169,10 +169,3 @@ __Hp:
.section .data.__HpLim,"",@
.globaltype __HpLim, W_
__HpLim:
-
- .hidden __CCCS
- .globl __CCCS
- .section .data.__CCCS,"",@
- .globaltype __CCCS, W_
-__CCCS:
-
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2592ab6924ee34ed0f0d82a7cb0aed393d93bb14
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2592ab6924ee34ed0f0d82a7cb0aed393d93bb14
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230220/7e772e20/attachment-0001.html>
More information about the ghc-commits
mailing list