Fix whitespace in TcTyDecls
[ghc-hetmet.git] / rts / Updates.cmm
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The GHC Team, 1998-2004
4  *
5  * Code to perform updates.
6  *
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.
10  *
11  * ---------------------------------------------------------------------------*/
12
13
14 #include "Cmm.h"
15 #include "Updates.h"
16 #include "StgLdvProf.h"
17
18 /* on entry to the update code
19    (1) R1 points to the closure being returned
20    (2) Sp points to the update frame
21 */
22
23 /* The update fragment has been tuned so as to generate good
24    code with gcc, which accounts for some of the strangeness in the
25    way it is written.  
26
27    In particular, the JMP_(ret) bit is passed down and pinned on the
28    end of each branch (there end up being two major branches in the
29    code), since we don't mind duplicating this jump.
30 */
31
32 #define UPD_FRAME_ENTRY_TEMPLATE                                        \
33         {                                                               \
34           W_ updatee;                                                   \
35                                                                         \
36           updatee = StgUpdateFrame_updatee(Sp);                         \
37                                                                         \
38           /* remove the update frame from the stack */                  \
39           Sp = Sp + SIZEOF_StgUpdateFrame;                              \
40                                                                         \
41           /* ToDo: it might be a PAP, so we should check... */          \
42           TICK_UPD_CON_IN_NEW(sizeW_fromITBL(%GET_STD_INFO(updatee)));  \
43                                                                         \
44           UPD_SPEC_IND(updatee, stg_IND_direct_info, R1, jump %ENTRY_CODE(Sp(0))); \
45         }
46
47 #if defined(PROFILING)
48 #define UPD_FRAME_PARAMS W_ unused1, W_ unused2, "ptr" W_ unused3
49 #else
50 #define UPD_FRAME_PARAMS "ptr" W_ unused1
51 #endif
52
53 /* this bitmap indicates that the first word of an update frame is a
54  * non-pointer - this is the update frame link.  (for profiling,
55  * there's a cost-centre-stack in there too).
56  */
57
58 INFO_TABLE_RET( stg_upd_frame, UPDATE_FRAME, UPD_FRAME_PARAMS)
59 UPD_FRAME_ENTRY_TEMPLATE
60
61
62 INFO_TABLE_RET( stg_marked_upd_frame, UPDATE_FRAME, UPD_FRAME_PARAMS)
63 UPD_FRAME_ENTRY_TEMPLATE