Skip to content
Snippets Groups Projects
Commit 7bae3d04 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

make superfluous sorts implicit or skip them alltogether.

Former-commit-id: 95f9b781749d85eb1fd337283da3115428304f11
parent 101250b2
Branches
Tags
No related merge requests found
......@@ -65,7 +65,7 @@ struct cell {
/* Pointers for the sorted indices. */
struct entry *sort;
int sorted;
unsigned int sorted;
/* Number of pairs associated with this cell. */
// int nr_pairs;
......
......@@ -269,6 +269,15 @@ int engine_marktasks ( struct engine *e ) {
return 1;
}
/* Sort? */
else if ( t->type == task_type_sort ) {
/* If all the sorts have been done, make this task implicit. */
if ( !( t->flags & (t->flags ^ t->ci->sorted ) ) )
t->implicit = 1;
}
}
......@@ -320,10 +329,14 @@ int engine_marktasks ( struct engine *e ) {
/* Set the sort flags. */
if ( !t->skip && t->type == task_type_pair ) {
ci->sorts->flags |= (1 << t->flags);
ci->sorts->skip = 0;
cj->sorts->flags |= (1 << t->flags);
cj->sorts->skip = 0;
if ( !( ci->sorted & ( 1 << t->flags ) ) ) {
ci->sorts->flags |= (1 << t->flags);
ci->sorts->skip = 0;
}
if ( !( cj->sorted & ( 1 << t->flags ) ) ) {
cj->sorts->flags |= (1 << t->flags);
cj->sorts->skip = 0;
}
}
}
......
......@@ -692,18 +692,19 @@ void scheduler_done ( struct scheduler *s , struct task *t ) {
struct task *t2;
/* Release whatever locks this task held. */
switch ( t->type ) {
case task_type_self:
case task_type_sort:
cell_unlocktree( t->ci );
break;
case task_type_pair:
case task_type_sub:
cell_unlocktree( t->ci );
if ( t->cj != NULL )
cell_unlocktree( t->cj );
break;
}
if ( !t->implicit )
switch ( t->type ) {
case task_type_self:
case task_type_sort:
cell_unlocktree( t->ci );
break;
case task_type_pair:
case task_type_sub:
cell_unlocktree( t->ci );
if ( t->cj != NULL )
cell_unlocktree( t->cj );
break;
}
/* Loop through the dependencies and add them to a queue if
they are ready. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment