summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-10-14 13:17:27 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-10-14 13:17:27 +0000
commit0856ac59cfb455d32a3042317fdba0f5e85cab9c (patch)
treee744d0c909780dabeffa65babfb9c4535f9a4d0a /rts
parentc5f93af1c663ab68f3b18f6a8c3264165a1c8883 (diff)
downloadhaskell-0856ac59cfb455d32a3042317fdba0f5e85cab9c.tar.gz
micro-opt: replace stmGetEnclosingTRec() with a field access
While fixing #3578 I noticed that this function was just a field access to StgTRecHeader, so I inlined it manually.
Diffstat (limited to 'rts')
-rw-r--r--rts/Exception.cmm4
-rw-r--r--rts/PrimOps.cmm10
-rw-r--r--rts/RaiseAsync.c4
-rw-r--r--rts/STM.c10
-rw-r--r--rts/STM.h7
-rw-r--r--rts/Schedule.c4
6 files changed, 11 insertions, 28 deletions
diff --git a/rts/Exception.cmm b/rts/Exception.cmm
index cd3f2bc4b8..6c887c22dc 100644
--- a/rts/Exception.cmm
+++ b/rts/Exception.cmm
@@ -398,7 +398,7 @@ retry_pop_stack:
W_ r;
trec = StgTSO_trec(CurrentTSO);
(r) = foreign "C" stmValidateNestOfTransactions(trec "ptr") [];
- ("ptr" outer) = foreign "C" stmGetEnclosingTRec(trec "ptr") [];
+ outer = StgTRecHeader_enclosing_trec(trec);
foreign "C" stmAbortTransaction(MyCapability() "ptr", trec "ptr") [];
foreign "C" stmFreeAbortedTRec(MyCapability() "ptr", trec "ptr") [];
@@ -498,7 +498,7 @@ retry_pop_stack:
} else {
W_ trec, outer;
trec = StgTSO_trec(CurrentTSO);
- ("ptr" outer) = foreign "C" stmGetEnclosingTRec(trec "ptr") [];
+ outer = StgTRecHeader_enclosing_trec(trec);
foreign "C" stmAbortTransaction(MyCapability() "ptr", trec "ptr") [];
foreign "C" stmFreeAbortedTRec(MyCapability() "ptr", trec "ptr") [];
StgTSO_trec(CurrentTSO) = outer;
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index d5b6c46f68..ac6de81e1c 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -650,7 +650,7 @@ INFO_TABLE_RET(stg_catch_retry_frame, CATCH_RETRY_FRAME,
frame = Sp;
trec = StgTSO_trec(CurrentTSO);
- ("ptr" outer) = foreign "C" stmGetEnclosingTRec(trec "ptr") [];
+ outer = StgTRecHeader_enclosing_trec(trec);
(r) = foreign "C" stmCommitNestedTransaction(MyCapability() "ptr", trec "ptr") [];
if (r != 0) {
/* Succeeded (either first branch or second branch) */
@@ -685,7 +685,7 @@ INFO_TABLE_RET(stg_atomically_frame, ATOMICALLY_FRAME,
frame = Sp;
trec = StgTSO_trec(CurrentTSO);
result = R1;
- ("ptr" outer) = foreign "C" stmGetEnclosingTRec(trec "ptr") [];
+ outer = StgTRecHeader_enclosing_trec(trec);
if (outer == NO_TREC) {
/* First time back at the atomically frame -- pick up invariants */
@@ -782,7 +782,7 @@ INFO_TABLE_RET(stg_catch_stm_frame, CATCH_STM_FRAME,
W_ r, frame, trec, outer;
frame = Sp;
trec = StgTSO_trec(CurrentTSO);
- ("ptr" outer) = foreign "C" stmGetEnclosingTRec(trec "ptr") [];
+ outer = StgTRecHeader_enclosing_trec(trec);
(r) = foreign "C" stmCommitNestedTransaction(MyCapability() "ptr", trec "ptr") [];
if (r != 0) {
/* Commit succeeded */
@@ -917,7 +917,7 @@ retry_pop_stack:
Sp = StgTSO_sp(CurrentTSO);
frame = Sp;
trec = StgTSO_trec(CurrentTSO);
- ("ptr" outer) = foreign "C" stmGetEnclosingTRec(trec "ptr") [];
+ outer = StgTRecHeader_enclosing_trec(trec);
if (frame_type == CATCH_RETRY_FRAME) {
// The retry reaches a CATCH_RETRY_FRAME before the atomic frame
@@ -950,7 +950,7 @@ retry_pop_stack:
foreign "C" stmFreeAbortedTRec(MyCapability() "ptr", trec "ptr") [];
trec = outer;
StgTSO_trec(CurrentTSO) = trec;
- ("ptr" outer) = foreign "C" stmGetEnclosingTRec(trec "ptr") [];
+ outer = StgTRecHeader_enclosing_trec(trec);
}
ASSERT(outer == NO_TREC);
diff --git a/rts/RaiseAsync.c b/rts/RaiseAsync.c
index 6510ce8b07..a0f78eeff7 100644
--- a/rts/RaiseAsync.c
+++ b/rts/RaiseAsync.c
@@ -884,7 +884,7 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
case ATOMICALLY_FRAME:
if (stop_at_atomically) {
- ASSERT(stmGetEnclosingTRec(tso->trec) == NO_TREC);
+ ASSERT(tso->trec->enclosing_trec == NO_TREC);
stmCondemnTransaction(cap, tso -> trec);
tso->sp = frame - 2;
// The ATOMICALLY_FRAME expects to be returned a
@@ -914,7 +914,7 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
{
StgTRecHeader *trec = tso -> trec;
- StgTRecHeader *outer = stmGetEnclosingTRec(trec);
+ StgTRecHeader *outer = trec -> enclosing_trec;
debugTrace(DEBUG_stm,
"found atomically block delivering async exception");
stmAbortTransaction(cap, trec);
diff --git a/rts/STM.c b/rts/STM.c
index 723f77acb6..7921a6750f 100644
--- a/rts/STM.c
+++ b/rts/STM.c
@@ -1026,16 +1026,6 @@ void stmCondemnTransaction(Capability *cap,
/*......................................................................*/
-StgTRecHeader *stmGetEnclosingTRec(StgTRecHeader *trec) {
- StgTRecHeader *outer;
- TRACE("%p : stmGetEnclosingTRec", trec);
- outer = trec -> enclosing_trec;
- TRACE("%p : stmGetEnclosingTRec()=%p", trec, outer);
- return outer;
-}
-
-/*......................................................................*/
-
StgBool stmValidateNestOfTransactions(StgTRecHeader *trec) {
StgTRecHeader *t;
StgBool result;
diff --git a/rts/STM.h b/rts/STM.h
index 495b763139..eae93b28a1 100644
--- a/rts/STM.h
+++ b/rts/STM.h
@@ -83,13 +83,6 @@ void stmFreeAbortedTRec(Capability *cap, StgTRecHeader *trec);
void stmCondemnTransaction(Capability *cap, StgTRecHeader *trec);
-/*
- * Return the trec within which the specified trec was created (not
- * valid if trec==NO_TREC).
- */
-
-StgTRecHeader *stmGetEnclosingTRec(StgTRecHeader *trec);
-
/*----------------------------------------------------------------------
Validation
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 9b261cf660..302ec1e7a5 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -1062,7 +1062,7 @@ schedulePostRunThread (Capability *cap, StgTSO *t)
// partially-evaluated thunks on the heap.
throwToSingleThreaded_(cap, t, NULL, rtsTrue);
- ASSERT(get_itbl((StgClosure *)t->sp)->type == ATOMICALLY_FRAME);
+// ASSERT(get_itbl((StgClosure *)t->sp)->type == ATOMICALLY_FRAME);
}
}
@@ -2564,7 +2564,7 @@ findRetryFrameHelper (StgTSO *tso)
case CATCH_STM_FRAME: {
StgTRecHeader *trec = tso -> trec;
- StgTRecHeader *outer = stmGetEnclosingTRec(trec);
+ StgTRecHeader *outer = trec -> enclosing_trec;
debugTrace(DEBUG_stm,
"found CATCH_STM_FRAME at %p during retry", p);
debugTrace(DEBUG_stm, "trec=%p outer=%p", trec, outer);