Skip to content

Commit

Permalink
Only report the post-event corresponding to the outermost post
Browse files Browse the repository at this point in the history
  • Loading branch information
chschulte committed Dec 4, 2018
1 parent 8660eed commit d86a8f0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
12 changes: 8 additions & 4 deletions gecode/kernel/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ namespace Gecode {
pc.p.queue[i].init();
pc.p.bid_sc = (reserved_bid+1) << sc_bits;
pc.p.n_sub = 0;
pc.p.vti.other();
}

void
Expand Down Expand Up @@ -385,7 +386,7 @@ namespace Gecode {
// Support disabled propagators and tracing
// Find a non-disabled tracer recorder (possibly null)
TraceRecorder* tr = findtracerecorder();

ViewTraceInfo vti;
#define GECODE_STATUS_TRACE(q,s) \
if ((tr != NULL) && (tr->events() & TE_PROPAGATE) && \
(tr->filter()(p->group()))) { \
Expand All @@ -399,6 +400,7 @@ namespace Gecode {
stat.propagate++;
if (p->disabled())
goto t_put_into_idle;
vti = pc.p.vti;
pc.p.vti.propagator(*p);
// Keep old modification event delta
med_o = p->u.med;
Expand Down Expand Up @@ -461,7 +463,7 @@ namespace Gecode {
GECODE_NEVER;
}
t_stable:
pc.p.vti.other();
pc.p.vti = vti;
#undef GECODE_STATUS_TRACE
}
}
Expand Down Expand Up @@ -586,9 +588,10 @@ namespace Gecode {
CommitTraceInfo cti(*b,c,a);
tr->tracer()._commit(*this,cti);
}
ViewTraceInfo vti = pc.p.vti;
pc.p.vti.brancher(*b);
ExecStatus es = b->commit(*this,c,a);
pc.p.vti.other();
pc.p.vti = vti;
if (es == ES_FAILED)
fail();
} else {
Expand Down Expand Up @@ -616,9 +619,10 @@ namespace Gecode {
CommitTraceInfo cti(*b,c,a);
tr->tracer()._commit(*this,cti);
}
ViewTraceInfo vti = pc.p.vti;
pc.p.vti.brancher(*b);
ExecStatus es = b->commit(*this,c,a);
pc.p.vti.other();
pc.p.vti = vti;
if (es == ES_FAILED)
fail();
} else {
Expand Down
14 changes: 10 additions & 4 deletions gecode/kernel/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,8 @@ namespace Gecode {
PropagatorGroup pg;
/// Next free propagator id
unsigned int pid;
/// Whether it is used nested
bool nested;
public:
/// Set information
PostInfo(Home home);
Expand Down Expand Up @@ -3352,16 +3354,20 @@ namespace Gecode {
*/
forceinline
PostInfo::PostInfo(Home home)
: h(home), pg(home.propagatorgroup()), pid(h.ssd.data().gpi.pid()) {
: h(home), pg(home.propagatorgroup()),
pid(h.ssd.data().gpi.pid()),
nested(h.pc.p.vti.what() != ViewTraceInfo::OTHER) {
assert(!home.failed());
h.pc.p.vti.post(pg);
}

forceinline
PostInfo::~PostInfo(void) {
if (h.pc.p.bid_sc & Space::sc_trace)
h.post(*this);
h.pc.p.vti.other();
if (!nested) {
if (h.pc.p.bid_sc & Space::sc_trace)
h.post(*this);
h.pc.p.vti.other();
}
}


Expand Down

0 comments on commit d86a8f0

Please sign in to comment.