Commit a8137780 authored by Daniel Gröber (dxld)'s avatar Daniel Gröber (dxld)

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.
parent 75355228
...@@ -80,6 +80,9 @@ typedef union { ...@@ -80,6 +80,9 @@ typedef union {
struct { struct {
StgClosure *srt; StgClosure *srt;
} srt; } srt;
// parent of the current closure, used only when posTypeFresh is set
StgClosure *cp;
} nextPos; } nextPos;
/** /**
...@@ -105,7 +108,6 @@ typedef struct { ...@@ -105,7 +108,6 @@ typedef struct {
typedef struct stackElement_ { typedef struct stackElement_ {
stackPos info; stackPos info;
StgClosure *c; StgClosure *c;
StgClosure *cp; // parent of 'c'. Only used when info.type == posTypeFresh.
stackData data; stackData data;
} stackElement; } stackElement;
...@@ -345,7 +347,7 @@ traversePushClosure(traverseState *ts, StgClosure *c, StgClosure *cp, stackData ...@@ -345,7 +347,7 @@ traversePushClosure(traverseState *ts, StgClosure *c, StgClosure *cp, stackData
stackElement se; stackElement se;
se.c = c; se.c = c;
se.cp = cp; se.info.next.cp = cp;
se.data = data; se.data = data;
se.info.type = posTypeFresh; se.info.type = posTypeFresh;
...@@ -389,7 +391,6 @@ traversePushChildren(traverseState *ts, StgClosure *c, stackData data, StgClosur ...@@ -389,7 +391,6 @@ traversePushChildren(traverseState *ts, StgClosure *c, stackData data, StgClosur
se.c = c; se.c = c;
se.data = data; se.data = data;
// Note: se.cp ommitted on purpose, only traversePushClosure uses that.
// fill in se.info // fill in se.info
switch (get_itbl(c)->type) { switch (get_itbl(c)->type) {
...@@ -572,8 +573,8 @@ traversePushChildren(traverseState *ts, StgClosure *c, stackData data, StgClosur ...@@ -572,8 +573,8 @@ traversePushChildren(traverseState *ts, StgClosure *c, stackData data, StgClosur
return; return;
} }
// se.cp has to be initialized when type==posTypeFresh. We don't do that // se.info.next.cp has to be initialized when type==posTypeFresh. We don't
// here though. So type must be !=posTypeFresh. // do that here though. So type must be !=posTypeFresh.
ASSERT(se.info.type != posTypeFresh); ASSERT(se.info.type != posTypeFresh);
pushStackElement(ts, se); pushStackElement(ts, se);
...@@ -687,7 +688,7 @@ traversePop(traverseState *ts, StgClosure **c, StgClosure **cp, stackData *data) ...@@ -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 this is a top-level element, you should pop that out.
if (se->info.type == posTypeFresh) { if (se->info.type == posTypeFresh) {
*cp = se->cp; *cp = se->info.next.cp;
*c = se->c; *c = se->c;
*data = se->data; *data = se->data;
popStackElement(ts); popStackElement(ts);
......
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