summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2019-07-09 11:09:34 +0200
committerDaniel Gröber <dxld@darkboxed.org>2019-09-22 15:18:10 +0200
commita813778062652584e38d2ed52a9bdeda83758247 (patch)
tree47aa948d2bc4f71a7e15a543ccc3abf64b377880
parent753552285ee6f988f8a8f6729d09a4d7b228490c (diff)
downloadhaskell-a813778062652584e38d2ed52a9bdeda83758247.tar.gz
rts: TraverseHeap: Move stackElement.cp back into nextPos union
The 'cp' field really is only used when type==posTypeFresh so it's more space efficient to have it in the nextPos union.
-rw-r--r--rts/TraverseHeap.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/rts/TraverseHeap.c b/rts/TraverseHeap.c
index 893b837fdc..67080355d4 100644
--- a/rts/TraverseHeap.c
+++ b/rts/TraverseHeap.c
@@ -80,6 +80,9 @@ typedef union {
struct {
StgClosure *srt;
} srt;
+
+ // parent of the current closure, used only when posTypeFresh is set
+ StgClosure *cp;
} nextPos;
/**
@@ -105,7 +108,6 @@ typedef struct {
typedef struct stackElement_ {
stackPos info;
StgClosure *c;
- StgClosure *cp; // parent of 'c'. Only used when info.type == posTypeFresh.
stackData data;
} stackElement;
@@ -345,7 +347,7 @@ traversePushClosure(traverseState *ts, StgClosure *c, StgClosure *cp, stackData
stackElement se;
se.c = c;
- se.cp = cp;
+ se.info.next.cp = cp;
se.data = data;
se.info.type = posTypeFresh;
@@ -389,7 +391,6 @@ traversePushChildren(traverseState *ts, StgClosure *c, stackData data, StgClosur
se.c = c;
se.data = data;
- // Note: se.cp ommitted on purpose, only traversePushClosure uses that.
// fill in se.info
switch (get_itbl(c)->type) {
@@ -572,8 +573,8 @@ traversePushChildren(traverseState *ts, StgClosure *c, stackData data, StgClosur
return;
}
- // se.cp has to be initialized when type==posTypeFresh. We don't do that
- // here though. So type must be !=posTypeFresh.
+ // se.info.next.cp has to be initialized when type==posTypeFresh. We don't
+ // do that here though. So type must be !=posTypeFresh.
ASSERT(se.info.type != posTypeFresh);
pushStackElement(ts, se);
@@ -687,7 +688,7 @@ traversePop(traverseState *ts, StgClosure **c, StgClosure **cp, stackData *data)
// If this is a top-level element, you should pop that out.
if (se->info.type == posTypeFresh) {
- *cp = se->cp;
+ *cp = se->info.next.cp;
*c = se->c;
*data = se->data;
popStackElement(ts);