[Git][ghc/ghc][wip/js-staging] correct stack offset when restarting an STM transaction

Luite Stegeman (@luite) gitlab at gitlab.haskell.org
Fri Oct 21 12:23:22 UTC 2022



Luite Stegeman pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC


Commits:
3c4a512f by Luite Stegeman at 2022-10-21T14:22:46+02:00
correct stack offset when restarting an STM transaction

- - - - -


2 changed files:

- compiler/GHC/StgToJS/Rts/Rts.hs
- rts/js/rts.js


Changes:

=====================================
compiler/GHC/StgToJS/Rts/Rts.hs
=====================================
@@ -626,7 +626,7 @@ rts' s =
                     (appS "h$stmCommitTransaction" []
                      <> adjSpN' 2
                      <> returnS (stack .! sp))
-                    (returnS (app "h$stmStartTransaction" [stack .! (sp - 2)])))
+                    (returnS (app "h$stmStartTransaction" [stack .! (sp - 1)])))
 
           , closure (ClosureInfo (TxtI "h$stmCatchRetry_e") (CIRegs 0 [PtrV]) "catch retry" (CILayoutFixed 1 [PtrV]) CIStackFrame mempty)
                         (adjSpN' 2
@@ -643,7 +643,7 @@ rts' s =
                                     , blocked |= stack .! (sp - 1)
                                     , adjSpN' 2
                                     , appS "h$stmRemoveBlockedThread" [blocked, var "h$currentThread"]
-                                    , returnS (app "h$stmStartTransaction" [stack .! (sp - 2)])
+                                    , returnS (app "h$stmStartTransaction" [stack .! (sp - 1)])
                                     ])
           , closure (ClosureInfo (TxtI "h$lazy_e") (CIRegs 0 [PtrV]) "generic lazy value" (CILayoutFixed 0 []) CIThunk mempty)
                         (jVar $ \x ->


=====================================
rts/js/rts.js
=====================================
@@ -426,7 +426,7 @@ function h$throw(e, async) {
       } else if(!h$stmValidateTransaction()) { // restart transaction if invalid, don't propagate exception
       h$sp++;
       h$stack[h$sp] = h$checkInvariants_e;
-      return h$stmStartTransaction(h$stack[h$sp-2]);
+      return h$stmStartTransaction(h$stack[h$sp-1]);
     }
   }
   if(f === h$catchStm_e && !async) break; // catchSTM only catches sync



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3c4a512f1b45cd7fa5d763a7f1aa25cfd32f4dea

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3c4a512f1b45cd7fa5d763a7f1aa25cfd32f4dea
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/20221021/04e77015/attachment-0001.html>


More information about the ghc-commits mailing list