From 6d7e6ad803be11cb7a79dca727c37e4ef21cda4b Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Mon, 13 May 2024 13:36:08 -0400
Subject: [PATCH] rts: Fix size of StgOrigThunkInfo frames

Previously the entry code of the `stg_orig_thunk` frame failed to
account for the size of the profiling header as it hard-coded the frame
size. Fix this.

Fixes #24809.
---
 rts/StgMiscClosures.cmm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rts/StgMiscClosures.cmm b/rts/StgMiscClosures.cmm
index 80dc84692c54..d9546940c6c0 100644
--- a/rts/StgMiscClosures.cmm
+++ b/rts/StgMiscClosures.cmm
@@ -51,8 +51,8 @@ INFO_TABLE_RET (stg_orig_thunk_info_frame, RET_SMALL,
                 W_ thunk_info_ptr)
     /* no args => explicit stack */
 {
-    unwind Sp = W_[Sp + WDS(2)];
-    Sp_adj(2);
+    unwind Sp = W_[Sp + SIZEOF_StgOrigThunkInfoFrame];
+    Sp = Sp + SIZEOF_StgOrigThunkInfoFrame;
     jump %ENTRY_CODE(Sp(0)) [*]; // NB. all registers live!
 }
 
-- 
GitLab