Commit cc2a4d57 authored by Simon Marlow's avatar Simon Marlow
Browse files

profiling fixes

parent 70765e86
......@@ -247,8 +247,8 @@
// because LDV profiling relies on entering closures to mark them as
// "used".
#define LOAD_INFO \
info = %INFO_PTR(UNTAG(P1));
#define LOAD_INFO(ret,x) \
info = %INFO_PTR(UNTAG(x));
#define MAYBE_UNTAG(x) UNTAG(x);
......@@ -346,11 +346,13 @@
------------------------------------------------------------------------- */
#if defined(PROFILING)
#define PROF_HDR_FIELDS(w_) \
w_ prof_hdr_1, \
w_ prof_hdr_2,
#define PROF_HDR_FIELDS(w_) PROF_HDR_FIELDS_(w_,prof_hdr_1,prof_hdr_2)
#define PROF_HDR_FIELDS_(w_,hdr1,hdr2) \
w_ hdr1, \
w_ hdr2,
#else
#define PROF_HDR_FIELDS(w_) /* nothing */
#define PROF_HDR_FIELDS_(w_,hdr1,hdr2) /* nothing */
#endif
/* -------------------------------------------------------------------------
......
......@@ -216,7 +216,7 @@ stg_gc_prim_n (W_ arg)
/* The stg_enter_checkbh frame has the same shape as an update frame: */
INFO_TABLE_RET ( stg_enter_checkbh, RET_SMALL,
UPDATE_FRAME_FIELDS(W_,P_,info_ptr,updatee))
UPDATE_FRAME_FIELDS(W_,P_,info_ptr,ccs,updatee))
return (P_ ret)
{
foreign "C" checkBlockingQueues(MyCapability() "ptr",
......
......@@ -28,14 +28,11 @@
-------------------------------------------------------------------------- */
#ifdef PROFILING
#define RET_FIELDS(w_,info_ptr,ccs) \
w_ info_ptr, \
w_ ccs
#define GET_SAVED_CCCS CCCS = ccs
#define SAVE_CCS W_ saved_ccs; saved_ccs = CCCS;
#define RESTORE_CCS CCCS = saved_ccs;
#else
#define RET_FIELDS(w_,info_ptr,ccs) \
w_ info_ptr
#define GET_SAVED_CCCS /* empty */
#define SAVE_CCS /* nothing */
#define RESTORE_CCS /* nothing */
#endif
/*
......@@ -69,11 +66,13 @@
STK_CHK_NP(node); \
UPD_BH_UPDATABLE(node); \
LDV_ENTER(node); \
ENTER_CCS_THUNK(node); \
selectee = StgThunk_payload(node,0); \
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info,node)) { \
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info,CCCS,node)) { \
ENTER_CCS_THUNK(node); \
if (NEED_EVAL(selectee)) { \
SAVE_CCS; \
(P_ constr) = call %GET_ENTRY(selectee) (selectee); \
RESTORE_CCS; \
selectee = constr; \
} \
field = StgClosure_payload(UNTAG(selectee),offset); \
......@@ -111,10 +110,12 @@ SELECTOR_CODE_UPD(15)
STK_CHK_NP(node); \
UPD_BH_UPDATABLE(node); \
LDV_ENTER(node); \
ENTER_CCS_THUNK(node); \
selectee = StgThunk_payload(node,0); \
if (NEED_EVAL(selectee)) { \
ENTER_CCS_THUNK(node); \
SAVE_CCS; \
(P_ constr) = call %GET_ENTRY(selectee) (selectee); \
RESTORE_CCS; \
selectee = constr; \
} \
field = StgClosure_payload(UNTAG(selectee),offset); \
......@@ -164,8 +165,8 @@ INFO_TABLE(stg_ap_1_upd,1,0,THUNK_1_0,"stg_ap_1_upd_info","stg_ap_1_upd_info")
STK_CHK_NP(node);
UPD_BH_UPDATABLE(node);
LDV_ENTER(node);
ENTER_CCS_THUNK(node);
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, node)) {
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, node)) {
ENTER_CCS_THUNK(node);
jump stg_ap_0_fast
(StgThunk_payload(node,0));
}
......@@ -178,8 +179,8 @@ INFO_TABLE(stg_ap_2_upd,2,0,THUNK_2_0,"stg_ap_2_upd_info","stg_ap_2_upd_info")
STK_CHK_NP(node);
UPD_BH_UPDATABLE(node);
LDV_ENTER(node);
ENTER_CCS_THUNK(node);
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, node)) {
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, node)) {
ENTER_CCS_THUNK(node);
jump stg_ap_p_fast
(StgThunk_payload(node,0),
StgThunk_payload(node,1));
......@@ -193,8 +194,8 @@ INFO_TABLE(stg_ap_3_upd,3,0,THUNK,"stg_ap_3_upd_info","stg_ap_3_upd_info")
STK_CHK_NP(node);
UPD_BH_UPDATABLE(node);
LDV_ENTER(node);
ENTER_CCS_THUNK(node);
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, node)) {
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, node)) {
ENTER_CCS_THUNK(node);
jump stg_ap_pp_fast
(StgThunk_payload(node,0),
StgThunk_payload(node,1),
......@@ -209,8 +210,8 @@ INFO_TABLE(stg_ap_4_upd,4,0,THUNK,"stg_ap_4_upd_info","stg_ap_4_upd_info")
STK_CHK_NP(node);
UPD_BH_UPDATABLE(node);
LDV_ENTER(node);
ENTER_CCS_THUNK(node);
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, node)) {
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, node)) {
ENTER_CCS_THUNK(node);
jump stg_ap_ppp_fast
(StgThunk_payload(node,0),
StgThunk_payload(node,1),
......@@ -226,8 +227,8 @@ INFO_TABLE(stg_ap_5_upd,5,0,THUNK,"stg_ap_5_upd_info","stg_ap_5_upd_info")
STK_CHK_NP(node);
UPD_BH_UPDATABLE(node);
LDV_ENTER(node);
ENTER_CCS_THUNK(node);
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, node)) {
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, node)) {
ENTER_CCS_THUNK(node);
jump stg_ap_pppp_fast
(StgThunk_payload(node,0),
StgThunk_payload(node,1),
......@@ -244,8 +245,8 @@ INFO_TABLE(stg_ap_6_upd,6,0,THUNK,"stg_ap_6_upd_info","stg_ap_6_upd_info")
STK_CHK_NP(node);
UPD_BH_UPDATABLE(node);
LDV_ENTER(node);
ENTER_CCS_THUNK(node);
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, node)) {
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, node)) {
ENTER_CCS_THUNK(node);
jump stg_ap_ppppp_fast
(StgThunk_payload(node,0),
StgThunk_payload(node,1),
......@@ -263,8 +264,8 @@ INFO_TABLE(stg_ap_7_upd,7,0,THUNK,"stg_ap_7_upd_info","stg_ap_7_upd_info")
STK_CHK_NP(node);
UPD_BH_UPDATABLE(node);
LDV_ENTER(node);
ENTER_CCS_THUNK(node);
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, node)) {
push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, node)) {
ENTER_CCS_THUNK(node);
jump stg_ap_pppppp_fast
(StgThunk_payload(node,0),
StgThunk_payload(node,1),
......
......@@ -26,7 +26,7 @@
* we don't mind duplicating this jump.
*/
INFO_TABLE_RET ( stg_upd_frame, UPDATE_FRAME,
UPDATE_FRAME_FIELDS(W_,P_,info_ptr,updatee) )
UPDATE_FRAME_FIELDS(W_,P_,info_ptr,_ccs,updatee) )
return (P_ ret) /* the closure being returned */
{
/* ToDo: it might be a PAP, so we should check... */
......@@ -42,7 +42,7 @@ INFO_TABLE_RET ( stg_upd_frame, UPDATE_FRAME,
* another thread in the meantime.
*/
INFO_TABLE_RET ( stg_marked_upd_frame, UPDATE_FRAME,
UPDATE_FRAME_FIELDS(W_,P_,info_ptr,updatee) )
UPDATE_FRAME_FIELDS(W_,P_,info_ptr,_ccs,updatee) )
return (P_ ret) /* the closure being returned */
{
W_ v, i, tso, link;
......@@ -77,11 +77,11 @@ INFO_TABLE_RET ( stg_marked_upd_frame, UPDATE_FRAME,
* high watermark.
*/
INFO_TABLE_RET ( stg_bh_upd_frame, UPDATE_FRAME,
UPDATE_FRAME_FIELDS(W_,P_,info_ptr,updatee) )
UPDATE_FRAME_FIELDS(W_,P_,info_ptr,ccs,updatee) )
return (P_ ret) /* the closure being returned */
{
// This all compiles away to a single jump instruction (sigh)
jump RET_LBL(stg_marked_upd_frame)
( UPDATE_FRAME_FIELDS(,,info_ptr,updatee) )
( UPDATE_FRAME_FIELDS(,,info_ptr,ccs,updatee) )
(ret);
}
......@@ -35,9 +35,9 @@
*/
#ifdef CMINUSMINUS
#define UPDATE_FRAME_FIELDS(w_,p_,info_ptr,updatee) \
#define UPDATE_FRAME_FIELDS(w_,p_,info_ptr,ccs,updatee) \
w_ info_ptr, \
PROF_HDR_FIELDS(w_) \
PROF_HDR_FIELDS_(w_,ccs,_unused_) \
p_ updatee
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment