[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: Adjust AArch64 stackFrameHeaderSize

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Wed May 10 06:26:46 UTC 2023



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
0657b482 by Sven Tennie at 2023-05-09T22:22:42-04:00
Adjust AArch64 stackFrameHeaderSize

The prologue of each stack frame are the saved LR and FP registers, 8
byte each. I.e. the size of the stack frame header is 2 * 8 byte.

- - - - -
7788c09c by konsumlamm at 2023-05-09T22:23:23-04:00
Make `(&)` representation polymorphic in the return type

- - - - -
6ddb2302 by Ben Gamari at 2023-05-10T02:26:37-04:00
ghc-prim: Generalize keepAlive#/touch# in state token type

Closes #23163.

- - - - -
ab8d3510 by Cheng Shao at 2023-05-10T02:26:39-04:00
Bump hsc2hs submodule

Fixes #22981.

- - - - -


6 changed files:

- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- libraries/base/Data/Function.hs
- libraries/base/changelog.md
- libraries/ghc-prim/changelog.md
- utils/hsc2hs


Changes:

=====================================
compiler/GHC/Builtin/primops.txt.pp
=====================================
@@ -3407,7 +3407,7 @@ primop  FinalizeWeakOp "finalizeWeak#" GenPrimOp
    out_of_line      = True
 
 primop TouchOp "touch#" GenPrimOp
-   v -> State# RealWorld -> State# RealWorld
+   v -> State# s -> State# s
    with
    code_size = { 0 }
    has_side_effects = True
@@ -3723,7 +3723,7 @@ section "Controlling object lifetime"
 -- and "p" is the same as "b" except representation-polymorphic.
 -- See Note [Levity and representation polymorphic primops]
 primop KeepAliveOp "keepAlive#" GenPrimOp
-   v -> State# RealWorld -> (State# RealWorld -> p) -> p
+   v -> State# s -> (State# s -> p) -> p
    { @'keepAlive#' x s k@ keeps the value @x@ alive during the execution
      of the computation @k at .
 


=====================================
compiler/GHC/CmmToAsm/AArch64/Instr.hs
=====================================
@@ -32,9 +32,9 @@ import Data.Maybe (fromMaybe)
 
 import GHC.Stack
 
--- | TODO: verify this!
-stackFrameHeaderSize :: Platform -> Int
-stackFrameHeaderSize _ = 64
+-- | LR and FP (8 byte each) are the prologue of each stack frame
+stackFrameHeaderSize :: Int
+stackFrameHeaderSize = 2 * 8
 
 -- | All registers are 8 byte wide.
 spillSlotSize :: Int
@@ -49,14 +49,13 @@ stackAlign = 16
 maxSpillSlots :: NCGConfig -> Int
 maxSpillSlots config
 --  = 0 -- set to zero, to see when allocMoreStack has to fire.
-    = let platform = ncgPlatform config
-      in ((ncgSpillPreallocSize config - stackFrameHeaderSize platform)
+    = ((ncgSpillPreallocSize config - stackFrameHeaderSize)
          `div` spillSlotSize) - 1
 
 -- | Convert a spill slot number to a *byte* offset, with no sign.
 spillSlotToOffset :: NCGConfig -> Int -> Int
-spillSlotToOffset config slot
-   = stackFrameHeaderSize (ncgPlatform config) + spillSlotSize * slot
+spillSlotToOffset _ slot
+   = stackFrameHeaderSize + spillSlotSize * slot
 
 -- | Get the registers that are being used by this instruction.
 -- regUsage doesn't need to do any trickery for jumps and such.


=====================================
libraries/base/Data/Function.hs
=====================================
@@ -1,3 +1,5 @@
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE PolyKinds #-}
 {-# LANGUAGE Trustworthy #-}
 {-# LANGUAGE NoImplicitPrelude #-}
 {-# OPTIONS_HADDOCK print-explicit-runtime-reps #-}
@@ -28,7 +30,7 @@ module Data.Function
   , applyWhen
   ) where
 
-import GHC.Base ( ($), (.), id, const, flip )
+import GHC.Base ( TYPE, ($), (.), id, const, flip )
 import Data.Bool ( Bool(..) )
 
 infixl 0 `on`
@@ -120,7 +122,7 @@ on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
 -- "6"
 --
 -- @since 4.8.0.0
-(&) :: a -> (a -> b) -> b
+(&) :: forall r a (b :: TYPE r). a -> (a -> b) -> b
 x & f = f x
 
 -- | 'applyWhen' applies a function to a value if a condition is true,


=====================================
libraries/base/changelog.md
=====================================
@@ -21,9 +21,10 @@
       ([CLC proposal #149](https://github.com/haskell/core-libraries-committee/issues/149))
   * Make `($)` representation polymorphic ([CLC proposal #132](https://github.com/haskell/core-libraries-committee/issues/132))
   * Implemented [GHC Proposal #433](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0433-unsatisfiable.rst),
-    adding the class `Unsatisfiable :: ErrorMessage -> TypeError`` to `GHC.TypeError`,
+    adding the class `Unsatisfiable :: ErrorMessage -> TypeError` to `GHC.TypeError`,
     which provides a mechanism for custom type errors that reports the errors in
-    a more predictable behaviour than ``TypeError``.
+    a more predictable behaviour than `TypeError`.
+  * Make `(&)` representation polymorphic in the return type ([CLC proposal #158](https://github.com/haskell/core-libraries-committee/issues/158))
 
 ## 4.18.0.0 *March 2023*
   * Shipped with GHC 9.6.1


=====================================
libraries/ghc-prim/changelog.md
=====================================
@@ -14,6 +14,8 @@
     - `sameMutVar#`, `sameTVar#`, `sameMVar#`
     - `sameIOPort#`, `eqStableName#`.
 
+- `keepAlive#` and `touch#` are now polymorphic in their state token (#23163; [CLC#152](https://github.com/haskell/core-libraries-committee/issues/152))
+
 - Several new primops were added:
 
   - `copyMutableByteArrayNonOverlapping#`


=====================================
utils/hsc2hs
=====================================
@@ -1 +1 @@
-Subproject commit 1ba092932f86c1fda15091d355ba7975b8554437
+Subproject commit f70b360b295298e4da10afe02ebf022b21342008



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d137ce9c9a8fbdac3105167fa039269b2c35e477...ab8d351049cf3baaa8af8a8d069da21849f4edbe

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d137ce9c9a8fbdac3105167fa039269b2c35e477...ab8d351049cf3baaa8af8a8d069da21849f4edbe
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/20230510/a7b0389e/attachment-0001.html>


More information about the ghc-commits mailing list