summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-10-19 11:27:53 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-10-19 11:49:37 +0100
commit53810006bbcd3fc9b58893858f95c3432cb33f0e (patch)
treeff4308239be53eb2ed75afb46bee03fc3a6f7ae9
parent660dc69a777b462fc635e9914fa59bd784bb233c (diff)
downloadhaskell-53810006bbcd3fc9b58893858f95c3432cb33f0e.tar.gz
profiling fixes
-rw-r--r--includes/Cmm.h14
-rw-r--r--rts/Exception.cmm8
-rw-r--r--rts/HeapStackCheck.cmm2
-rw-r--r--rts/PrimOps.cmm42
-rw-r--r--rts/StgStartup.cmm2
-rw-r--r--rts/StgStdThunks.cmm18
-rw-r--r--rts/Updates.cmm8
-rw-r--r--rts/Updates.h4
8 files changed, 50 insertions, 48 deletions
diff --git a/includes/Cmm.h b/includes/Cmm.h
index 805806b309..9cb2dbce4b 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -250,7 +250,7 @@
#define LOAD_INFO(ret,x) \
info = %INFO_PTR(UNTAG(x));
-#define MAYBE_UNTAG(x) UNTAG(x);
+#define UNTAG_IF_PROF(x) UNTAG(x)
#else
@@ -260,7 +260,7 @@
} \
info = %INFO_PTR(x);
-#define MAYBE_UNTAG(x) (x) /* already untagged */
+#define UNTAG_IF_PROF(x) (x) /* already untagged */
#endif
@@ -306,7 +306,7 @@
} \
default: \
{ \
- x = MAYBE_UNTAG(x); \
+ x = UNTAG_IF_PROF(x); \
jump %ENTRY_CODE(info) (x); \
} \
}
@@ -346,13 +346,11 @@
------------------------------------------------------------------------- */
#if defined(PROFILING)
-#define PROF_HDR_FIELDS(w_) PROF_HDR_FIELDS_(w_,prof_hdr_1,prof_hdr_2)
-#define PROF_HDR_FIELDS_(w_,hdr1,hdr2) \
- w_ hdr1, \
+#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 */
+#define PROF_HDR_FIELDS(w_,hdr1,hdr2) /* nothing */
#endif
/* -------------------------------------------------------------------------
diff --git a/rts/Exception.cmm b/rts/Exception.cmm
index 8a9f4e62c9..3f1dc100be 100644
--- a/rts/Exception.cmm
+++ b/rts/Exception.cmm
@@ -341,15 +341,15 @@ stg_killMyself
* kind of return to the activation record underneath us on the stack.
*/
-#define CATCH_FRAME_FIELDS(w_,p_,info_ptr,exceptions_blocked,handler) \
+#define CATCH_FRAME_FIELDS(w_,p_,info_ptr,p1,p2,exceptions_blocked,handler) \
w_ info_ptr, \
- PROF_HDR_FIELDS(w_) \
+ PROF_HDR_FIELDS(w_,p1,p2) \
w_ exceptions_blocked, \
p_ handler
INFO_TABLE_RET(stg_catch_frame, CATCH_FRAME,
- CATCH_FRAME_FIELDS(W_,P_,info_ptr,
+ CATCH_FRAME_FIELDS(W_,P_,info_ptr, p1, p2,
exceptions_blocked,handler))
return (P_ ret)
{
@@ -388,7 +388,7 @@ stg_catchzh ( P_ io, /* :: IO a */
TICK_SLOW_CALL_v();
jump stg_ap_v_fast
- (CATCH_FRAME_FIELDS(,,stg_catch_frame_info,
+ (CATCH_FRAME_FIELDS(,,stg_catch_frame_info, CCCS, 0,
exceptions_blocked, handler))
(io);
}
diff --git a/rts/HeapStackCheck.cmm b/rts/HeapStackCheck.cmm
index 1375216646..4fd44302f5 100644
--- a/rts/HeapStackCheck.cmm
+++ b/rts/HeapStackCheck.cmm
@@ -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,ccs,updatee))
+ UPDATE_FRAME_FIELDS(W_,P_,info_ptr,ccs,p2,updatee))
return (P_ ret)
{
foreign "C" checkBlockingQueues(MyCapability() "ptr",
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index fb46cee0b5..6cba3f53fc 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -676,11 +676,12 @@ stg_threadStatuszh ( gcptr tso )
// Catch retry frame -----------------------------------------------------------
#define CATCH_RETRY_FRAME_FIELDS(w_,p_,info_ptr, \
+ p1, p2, \
running_alt_code, \
first_code, \
alt_code) \
w_ info_ptr, \
- PROF_HDR_FIELDS(w_) \
+ PROF_HDR_FIELDS(w_,p1,p2) \
w_ running_alt_code, \
p_ first_code, \
p_ alt_code
@@ -688,7 +689,7 @@ stg_threadStatuszh ( gcptr tso )
INFO_TABLE_RET(stg_catch_retry_frame, CATCH_RETRY_FRAME,
CATCH_RETRY_FRAME_FIELDS(W_,P_,
- info_ptr,
+ info_ptr, p1, p2,
running_alt_code,
first_code,
alt_code))
@@ -712,14 +713,14 @@ INFO_TABLE_RET(stg_catch_retry_frame, CATCH_RETRY_FRAME,
StgTSO_trec(CurrentTSO) = new_trec;
if (running_alt_code != 0) {
jump stg_ap_v_fast
- (CATCH_RETRY_FRAME_FIELDS(,,info_ptr,
+ (CATCH_RETRY_FRAME_FIELDS(,,info_ptr, p1, p2,
running_alt_code,
first_code,
alt_code))
(alt_code);
} else {
jump stg_ap_v_fast
- (CATCH_RETRY_FRAME_FIELDS(,,info_ptr,
+ (CATCH_RETRY_FRAME_FIELDS(,,info_ptr, p1, p2,
running_alt_code,
first_code,
alt_code))
@@ -731,9 +732,9 @@ INFO_TABLE_RET(stg_catch_retry_frame, CATCH_RETRY_FRAME,
// Atomically frame ------------------------------------------------------------
// This must match StgAtomicallyFrame in Closures.h
-#define ATOMICALLY_FRAME_FIELDS(w_,p_,info_ptr,code,next,result) \
+#define ATOMICALLY_FRAME_FIELDS(w_,p_,info_ptr,p1,p2,code,next,result) \
w_ info_ptr, \
- PROF_HDR_FIELDS(w_) \
+ PROF_HDR_FIELDS(w_,p1,p2) \
p_ code, \
p_ next, \
p_ result
@@ -742,7 +743,7 @@ INFO_TABLE_RET(stg_catch_retry_frame, CATCH_RETRY_FRAME,
INFO_TABLE_RET(stg_atomically_frame, ATOMICALLY_FRAME,
// layout of the frame, and bind the field names
ATOMICALLY_FRAME_FIELDS(W_,P_,
- info_ptr,
+ info_ptr, p1, p2,
code,
next_invariant,
frame_result))
@@ -779,7 +780,8 @@ INFO_TABLE_RET(stg_atomically_frame, ATOMICALLY_FRAME,
StgTSO_trec(CurrentTSO) = trec;
q = StgInvariantCheckQueue_invariant(next_invariant);
jump stg_ap_v_fast
- (ATOMICALLY_FRAME_FIELDS(,,info_ptr,code,next_invariant,frame_result))
+ (ATOMICALLY_FRAME_FIELDS(,,info_ptr,p1,p2,
+ code,next_invariant,frame_result))
(StgAtomicInvariant_code(q));
} else {
@@ -799,7 +801,8 @@ INFO_TABLE_RET(stg_atomically_frame, ATOMICALLY_FRAME,
jump stg_ap_v_fast
// push the StgAtomicallyFrame again: the code generator is
// clever enough to only assign the fields that have changed.
- (ATOMICALLY_FRAME_FIELDS(,,info_ptr,code,next_invariant,frame_result))
+ (ATOMICALLY_FRAME_FIELDS(,,info_ptr,p1,p2,
+ code,next_invariant,frame_result))
(code);
}
}
@@ -809,7 +812,7 @@ INFO_TABLE_RET(stg_atomically_frame, ATOMICALLY_FRAME,
INFO_TABLE_RET(stg_atomically_waiting_frame, ATOMICALLY_FRAME,
// layout of the frame, and bind the field names
ATOMICALLY_FRAME_FIELDS(W_,P_,
- info_ptr,
+ info_ptr, p1, p2,
code,
next_invariant,
frame_result))
@@ -822,7 +825,7 @@ INFO_TABLE_RET(stg_atomically_waiting_frame, ATOMICALLY_FRAME,
if (valid != 0) {
/* Previous attempt is still valid: no point trying again yet */
jump stg_block_noregs
- (ATOMICALLY_FRAME_FIELDS(,,info_ptr,
+ (ATOMICALLY_FRAME_FIELDS(,,info_ptr, p1, p2,
code,next_invariant,frame_result))
();
} else {
@@ -832,7 +835,7 @@ INFO_TABLE_RET(stg_atomically_waiting_frame, ATOMICALLY_FRAME,
// change the frame header to stg_atomically_frame_info
jump stg_ap_v_fast
- (ATOMICALLY_FRAME_FIELDS(,,stg_atomically_frame_info,
+ (ATOMICALLY_FRAME_FIELDS(,,stg_atomically_frame_info, p1, p2,
code,next_invariant,frame_result))
(code);
}
@@ -845,15 +848,15 @@ INFO_TABLE_RET(stg_atomically_waiting_frame, ATOMICALLY_FRAME,
* kind of return to the activation record underneath us on the stack.
*/
-#define CATCH_STM_FRAME_FIELDS(w_,p_,info_ptr,code,handler) \
+#define CATCH_STM_FRAME_FIELDS(w_,p_,info_ptr,p1,p2,code,handler) \
w_ info_ptr, \
- PROF_HDR_FIELDS(w_) \
+ PROF_HDR_FIELDS(w_,p1,p2) \
p_ code, \
p_ handler
INFO_TABLE_RET(stg_catch_stm_frame, CATCH_STM_FRAME,
// layout of the frame, and bind the field names
- CATCH_STM_FRAME_FIELDS(W_,P_,info_ptr,code,handler))
+ CATCH_STM_FRAME_FIELDS(W_,P_,info_ptr,p1,p2,code,handler))
return (P_ ret)
{
W_ r, trec, outer;
@@ -872,7 +875,7 @@ INFO_TABLE_RET(stg_catch_stm_frame, CATCH_STM_FRAME,
StgTSO_trec(CurrentTSO) = new_trec;
jump stg_ap_v_fast
- (CATCH_STM_FRAME_FIELDS(,,info_ptr,code,handler))
+ (CATCH_STM_FRAME_FIELDS(,,info_ptr,p1,p2,code,handler))
(code);
}
}
@@ -907,7 +910,7 @@ stg_atomicallyzh (P_ stm)
StgTSO_trec(CurrentTSO) = new_trec;
jump stg_ap_v_fast
- (ATOMICALLY_FRAME_FIELDS(,,stg_atomically_frame_info,
+ (ATOMICALLY_FRAME_FIELDS(,,stg_atomically_frame_info, CCCS, 0,
code,next_invariant,frame_result))
(stm);
}
@@ -937,7 +940,8 @@ stg_catchSTMzh (P_ code /* :: STM a */,
StgTSO_trec(CurrentTSO) = new_trec;
jump stg_ap_v_fast
- (CATCH_STM_FRAME_FIELDS(,,stg_catch_stm_frame_info, code, handler))
+ (CATCH_STM_FRAME_FIELDS(,,stg_catch_stm_frame_info, CCCS, 0,
+ code, handler))
(code);
}
@@ -959,7 +963,7 @@ stg_catchRetryzh (P_ first_code, /* :: STM a */
// push the CATCH_RETRY stack frame, and apply first_code to realWorld#
jump stg_ap_v_fast
- (CATCH_RETRY_FRAME_FIELDS(,, stg_catch_retry_frame_info,
+ (CATCH_RETRY_FRAME_FIELDS(,, stg_catch_retry_frame_info, CCCS, 0,
0, /* not running_alt_code */
first_code,
alt_code))
diff --git a/rts/StgStartup.cmm b/rts/StgStartup.cmm
index 6793913464..5ad2ff6930 100644
--- a/rts/StgStartup.cmm
+++ b/rts/StgStartup.cmm
@@ -36,7 +36,7 @@
INFO_TABLE_RET(stg_stop_thread, STOP_FRAME,
W_ info_ptr,
- PROF_HDR_FIELDS(W_))
+ PROF_HDR_FIELDS(W_,p1,p2))
/* no return list: explicit stack layout */
{
/*
diff --git a/rts/StgStdThunks.cmm b/rts/StgStdThunks.cmm
index bd2b3df178..53e4cb1d23 100644
--- a/rts/StgStdThunks.cmm
+++ b/rts/StgStdThunks.cmm
@@ -67,11 +67,11 @@
UPD_BH_UPDATABLE(node); \
LDV_ENTER(node); \
selectee = StgThunk_payload(node,0); \
- push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info,CCCS,node)) { \
+ push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info,CCCS,0,node)) { \
ENTER_CCS_THUNK(node); \
if (NEED_EVAL(selectee)) { \
SAVE_CCS; \
- (P_ constr) = call %GET_ENTRY(selectee) (selectee); \
+ (P_ constr) = call %GET_ENTRY(UNTAG_IF_PROF(selectee)) (selectee); \
RESTORE_CCS; \
selectee = constr; \
} \
@@ -165,7 +165,7 @@ 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);
- push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, node)) {
+ push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, 0, node)) {
ENTER_CCS_THUNK(node);
jump stg_ap_0_fast
(StgThunk_payload(node,0));
@@ -179,7 +179,7 @@ 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);
- push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, node)) {
+ push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, 0, node)) {
ENTER_CCS_THUNK(node);
jump stg_ap_p_fast
(StgThunk_payload(node,0),
@@ -194,7 +194,7 @@ 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);
- push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, node)) {
+ push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, 0, node)) {
ENTER_CCS_THUNK(node);
jump stg_ap_pp_fast
(StgThunk_payload(node,0),
@@ -210,7 +210,7 @@ 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);
- push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, node)) {
+ push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, 0, node)) {
ENTER_CCS_THUNK(node);
jump stg_ap_ppp_fast
(StgThunk_payload(node,0),
@@ -227,7 +227,7 @@ 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);
- push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, node)) {
+ push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, 0, node)) {
ENTER_CCS_THUNK(node);
jump stg_ap_pppp_fast
(StgThunk_payload(node,0),
@@ -245,7 +245,7 @@ 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);
- push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, node)) {
+ push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, 0, node)) {
ENTER_CCS_THUNK(node);
jump stg_ap_ppppp_fast
(StgThunk_payload(node,0),
@@ -264,7 +264,7 @@ 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);
- push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, node)) {
+ push (UPDATE_FRAME_FIELDS(,,stg_upd_frame_info, CCCS, 0, node)) {
ENTER_CCS_THUNK(node);
jump stg_ap_pppppp_fast
(StgThunk_payload(node,0),
diff --git a/rts/Updates.cmm b/rts/Updates.cmm
index bd6060f142..01eb6829a3 100644
--- a/rts/Updates.cmm
+++ b/rts/Updates.cmm
@@ -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,_ccs,updatee) )
+ UPDATE_FRAME_FIELDS(W_,P_,info_ptr,_ccs,_unused,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,_ccs,updatee) )
+ UPDATE_FRAME_FIELDS(W_,P_,info_ptr,_ccs,_unused,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,ccs,updatee) )
+ UPDATE_FRAME_FIELDS(W_,P_,info_ptr,ccs,_unused,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,ccs,updatee) )
+ ( UPDATE_FRAME_FIELDS(,,info_ptr,ccs,_unused,updatee) )
(ret);
}
diff --git a/rts/Updates.h b/rts/Updates.h
index c65af9ace6..b4ff7d131b 100644
--- a/rts/Updates.h
+++ b/rts/Updates.h
@@ -35,9 +35,9 @@
*/
#ifdef CMINUSMINUS
-#define UPDATE_FRAME_FIELDS(w_,p_,info_ptr,ccs,updatee) \
+#define UPDATE_FRAME_FIELDS(w_,p_,info_ptr,ccs,p2,updatee) \
w_ info_ptr, \
- PROF_HDR_FIELDS_(w_,ccs,_unused_) \
+ PROF_HDR_FIELDS(w_,ccs,p2) \
p_ updatee