From: Scott Graham Date: Fri, 24 Apr 2015 23:06:55 +0000 (-0700) Subject: avoid calling ResumeDelayedJobs instead X-Git-Tag: v1.6.0^2~7^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c4887d26011225deaa20b6752193be0293624ab;p=platform%2Fupstream%2Fninja.git avoid calling ResumeDelayedJobs instead --- diff --git a/src/build.cc b/src/build.cc index f14831e..e266b5c 100644 --- a/src/build.cc +++ b/src/build.cc @@ -379,7 +379,7 @@ void Plan::ResumeDelayedJobs(Edge* edge) { edge->pool()->RetrieveReadyEdges(&ready_); } -void Plan::EdgeFinished(Edge* edge) { +void Plan::EdgeFinished(Edge* edge, bool directly_wanted) { map::iterator e = want_.find(edge); assert(e != want_.end()); if (e->second) @@ -388,7 +388,10 @@ void Plan::EdgeFinished(Edge* edge) { edge->outputs_ready_ = true; // See if this job frees up any delayed jobs - ResumeDelayedJobs(edge); + if (directly_wanted) + ResumeDelayedJobs(edge); + else + edge->pool()->RetrieveReadyEdges(&ready_); // Check off any nodes we were waiting for with this edge. for (vector::iterator o = edge->outputs_.begin(); @@ -411,10 +414,8 @@ void Plan::NodeFinished(Node* node) { ScheduleWork(*oe); } else { // We do not need to build this edge, but we might need to build one of - // its dependents. Make sure the pool schedules it before it's finished - // otherwise the pool use count may be invalid. - (*oe)->pool()->EdgeScheduled(**oe); - EdgeFinished(*oe); + // its dependents. + EdgeFinished(*oe, want_e->second); } } } diff --git a/src/build.h b/src/build.h index 4b48c5f..6eabae5 100644 --- a/src/build.h +++ b/src/build.h @@ -58,7 +58,7 @@ struct Plan { /// Mark an edge as done building. Used internally and by /// tests. - void EdgeFinished(Edge* edge); + void EdgeFinished(Edge* edge, bool directly_wanted = true); /// Clean the given node during the build. /// Return false on error. diff --git a/src/state.h b/src/state.h index 58fac13..d7987ba 100644 --- a/src/state.h +++ b/src/state.h @@ -71,9 +71,6 @@ struct Pool { /// |current_use_| is the total of the weights of the edges which are /// currently scheduled in the Plan (i.e. the edges in Plan::ready_). - /// This is generally <= to depth_. It can exceed it very briefly when the - /// pool is notified about an edge that's about to be finished that will - /// not actually be started. See Plan::NodeFinished(). int current_use_; int depth_;