[Git][ghc/ghc][master] rts: drop stale mentions of MIN_UPD_SIZE
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Sun Oct 22 06:50:03 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
c1e3719c by Cheng Shao at 2023-10-22T02:49:33-04:00
rts: drop stale mentions of MIN_UPD_SIZE
We used to have MIN_UPD_SIZE macro that describes the minimum reserved
size for thunks, so that the thunk can be overwritten in place as
indirections or blackholes. However, this macro has not been actually
defined or used anywhere since a long time ago; StgThunkHeader already
reserves a padding word for this purpose. Hence this patch which drops
stale mentions of MIN_UPD_SIZE.
- - - - -
2 changed files:
- docs/rts/rts.tex
- rts/PrimOps.cmm
Changes:
=====================================
docs/rts/rts.tex
=====================================
@@ -1970,10 +1970,9 @@ Here the right-hand sides of @range@ and @ys@ are both thunks; the former
is static while the latter is dynamic.
The layout of a thunk is the same as that for a function closure.
-However, thunks must have a payload of at least @MIN_UPD_SIZE@
-words to allow it to be overwritten with a black hole and an
-indirection. The compiler may have to add extra non-pointer fields to
-satisfy this constraint.
+However, a thunk header always contains an extra padding word at the
+end. This allows the thunk to be overwritten with an indirection,
+where the padding word will be repurposed as the indirectee pointer.
\begin{center}
\begin{tabular}{|l|l|l|l|l|}\hline
=====================================
rts/PrimOps.cmm
=====================================
@@ -740,25 +740,15 @@ stg_atomicModifyMutVar2zh ( gcptr mv, gcptr f )
obviously we can share (f x).
- z = [stg_ap_2 f x] (max (HS + 2) MIN_UPD_SIZE)
- y = [stg_sel_0 z] (max (HS + 1) MIN_UPD_SIZE)
+ z = [stg_ap_2 f x] (SIZEOF_StgThunkHeader + WDS(2))
+ y = [stg_sel_0 z] (SIZEOF_StgThunkHeader + WDS(1))
*/
-#if defined(MIN_UPD_SIZE) && MIN_UPD_SIZE > 1
-#define THUNK_1_SIZE (SIZEOF_StgThunkHeader + WDS(MIN_UPD_SIZE))
-#define TICK_ALLOC_THUNK_1() TICK_ALLOC_UP_THK(WDS(1),WDS(MIN_UPD_SIZE-1))
-#else
#define THUNK_1_SIZE (SIZEOF_StgThunkHeader + WDS(1))
#define TICK_ALLOC_THUNK_1() TICK_ALLOC_UP_THK(WDS(1),0)
-#endif
-#if defined(MIN_UPD_SIZE) && MIN_UPD_SIZE > 2
-#define THUNK_2_SIZE (SIZEOF_StgThunkHeader + WDS(MIN_UPD_SIZE))
-#define TICK_ALLOC_THUNK_2() TICK_ALLOC_UP_THK(WDS(2),WDS(MIN_UPD_SIZE-2))
-#else
#define THUNK_2_SIZE (SIZEOF_StgThunkHeader + WDS(2))
#define TICK_ALLOC_THUNK_2() TICK_ALLOC_UP_THK(WDS(2),0)
-#endif
#define SIZE (THUNK_2_SIZE + THUNK_1_SIZE)
@@ -815,13 +805,8 @@ stg_atomicModifyMutVarzuzh ( gcptr mv, gcptr f )
z = [stg_ap_2 f x] (max (HS + 2) MIN_UPD_SIZE)
*/
-#if defined(MIN_UPD_SIZE) && MIN_UPD_SIZE > 2
-#define THUNK_SIZE (SIZEOF_StgThunkHeader + WDS(MIN_UPD_SIZE))
-#define TICK_ALLOC_THUNK() TICK_ALLOC_UP_THK(WDS(2),WDS(MIN_UPD_SIZE-2))
-#else
#define THUNK_SIZE (SIZEOF_StgThunkHeader + WDS(2))
#define TICK_ALLOC_THUNK() TICK_ALLOC_UP_THK(WDS(2),0)
-#endif
HP_CHK_GEN_TICKY(THUNK_SIZE);
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c1e3719cc59f20d32c917e066ae7cd5edb98a96d
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c1e3719cc59f20d32c917e066ae7cd5edb98a96d
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/20231022/f2404377/attachment-0001.html>
More information about the ghc-commits
mailing list