Skip to content

Commit d86a8f0

Browse files
committed
Only report the post-event corresponding to the outermost post
1 parent 8660eed commit d86a8f0

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

gecode/kernel/core.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ namespace Gecode {
133133
pc.p.queue[i].init();
134134
pc.p.bid_sc = (reserved_bid+1) << sc_bits;
135135
pc.p.n_sub = 0;
136+
pc.p.vti.other();
136137
}
137138

138139
void
@@ -385,7 +386,7 @@ namespace Gecode {
385386
// Support disabled propagators and tracing
386387
// Find a non-disabled tracer recorder (possibly null)
387388
TraceRecorder* tr = findtracerecorder();
388-
389+
ViewTraceInfo vti;
389390
#define GECODE_STATUS_TRACE(q,s) \
390391
if ((tr != NULL) && (tr->events() & TE_PROPAGATE) && \
391392
(tr->filter()(p->group()))) { \
@@ -399,6 +400,7 @@ namespace Gecode {
399400
stat.propagate++;
400401
if (p->disabled())
401402
goto t_put_into_idle;
403+
vti = pc.p.vti;
402404
pc.p.vti.propagator(*p);
403405
// Keep old modification event delta
404406
med_o = p->u.med;
@@ -461,7 +463,7 @@ namespace Gecode {
461463
GECODE_NEVER;
462464
}
463465
t_stable:
464-
pc.p.vti.other();
466+
pc.p.vti = vti;
465467
#undef GECODE_STATUS_TRACE
466468
}
467469
}
@@ -586,9 +588,10 @@ namespace Gecode {
586588
CommitTraceInfo cti(*b,c,a);
587589
tr->tracer()._commit(*this,cti);
588590
}
591+
ViewTraceInfo vti = pc.p.vti;
589592
pc.p.vti.brancher(*b);
590593
ExecStatus es = b->commit(*this,c,a);
591-
pc.p.vti.other();
594+
pc.p.vti = vti;
592595
if (es == ES_FAILED)
593596
fail();
594597
} else {
@@ -616,9 +619,10 @@ namespace Gecode {
616619
CommitTraceInfo cti(*b,c,a);
617620
tr->tracer()._commit(*this,cti);
618621
}
622+
ViewTraceInfo vti = pc.p.vti;
619623
pc.p.vti.brancher(*b);
620624
ExecStatus es = b->commit(*this,c,a);
621-
pc.p.vti.other();
625+
pc.p.vti = vti;
622626
if (es == ES_FAILED)
623627
fail();
624628
} else {

gecode/kernel/core.hpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,8 @@ namespace Gecode {
954954
PropagatorGroup pg;
955955
/// Next free propagator id
956956
unsigned int pid;
957+
/// Whether it is used nested
958+
bool nested;
957959
public:
958960
/// Set information
959961
PostInfo(Home home);
@@ -3352,16 +3354,20 @@ namespace Gecode {
33523354
*/
33533355
forceinline
33543356
PostInfo::PostInfo(Home home)
3355-
: h(home), pg(home.propagatorgroup()), pid(h.ssd.data().gpi.pid()) {
3357+
: h(home), pg(home.propagatorgroup()),
3358+
pid(h.ssd.data().gpi.pid()),
3359+
nested(h.pc.p.vti.what() != ViewTraceInfo::OTHER) {
33563360
assert(!home.failed());
33573361
h.pc.p.vti.post(pg);
33583362
}
33593363

33603364
forceinline
33613365
PostInfo::~PostInfo(void) {
3362-
if (h.pc.p.bid_sc & Space::sc_trace)
3363-
h.post(*this);
3364-
h.pc.p.vti.other();
3366+
if (!nested) {
3367+
if (h.pc.p.bid_sc & Space::sc_trace)
3368+
h.post(*this);
3369+
h.pc.p.vti.other();
3370+
}
33653371
}
33663372

33673373

0 commit comments

Comments
 (0)