1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team, 1998-2004
5 * Code to perform updates.
7 * This file is written in a subset of C--, extended with various
8 * features specific to GHC. It is compiled by GHC directly. For the
9 * syntax of .cmm files, see the parser in ghc/compiler/cmm/CmmParse.y.
11 * ---------------------------------------------------------------------------*/
15 #include "rts/prof/LDV.h"
19 /* on entry to the update code
20 (1) R1 points to the closure being returned
21 (2) Sp points to the update frame
24 /* The update fragment has been tuned so as to generate good
25 code with gcc, which accounts for some of the strangeness in the
28 In particular, the JMP_(ret) bit is passed down and pinned on the
29 end of each branch (there end up being two major branches in the
30 code), since we don't mind duplicating this jump.
33 #define UPD_FRAME_ENTRY_TEMPLATE \
37 updatee = StgUpdateFrame_updatee(Sp); \
39 /* remove the update frame from the stack */ \
40 Sp = Sp + SIZEOF_StgUpdateFrame; \
42 /* ToDo: it might be a PAP, so we should check... */ \
43 TICK_UPD_CON_IN_NEW(sizeW_fromITBL(%GET_STD_INFO(updatee))); \
45 UPD_SPEC_IND(updatee, stg_IND_direct_info, R1, jump %ENTRY_CODE(Sp(0))); \
48 #if defined(PROFILING)
49 #define UPD_FRAME_PARAMS W_ unused1, W_ unused2, P_ unused3
51 #define UPD_FRAME_PARAMS P_ unused1
54 /* this bitmap indicates that the first word of an update frame is a
55 * non-pointer - this is the update frame link. (for profiling,
56 * there's a cost-centre-stack in there too).
59 INFO_TABLE_RET( stg_upd_frame, UPDATE_FRAME, UPD_FRAME_PARAMS)
60 UPD_FRAME_ENTRY_TEMPLATE
63 INFO_TABLE_RET( stg_marked_upd_frame, UPDATE_FRAME, UPD_FRAME_PARAMS)
64 UPD_FRAME_ENTRY_TEMPLATE