- Make Scheduler::step_forward return a bool representing if

the step went okay or otherwise if the simulation ended
- Fix simulation states in concrete_simulation.cc
- Manage end of input (now CTRL+D exits the program, and 
you can redirect a file in input knowing that at EOF
sgpemv2 will terminate)
- Fix a bug in Scheduler that didn't add the newly created
environment to History when the simulation ended, thus leading
both to a memory leak and an inconsistency in representing
the simulation


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@807 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-08-01 09:19:26 +00:00
parent 6f8625d308
commit c6ebe792e4
6 changed files with 57 additions and 85 deletions

View file

@ -161,7 +161,7 @@ Scheduler::get_policy()
}
void
bool
Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterruptException)
{
// This very method should be exclusive: no concurrent behaviour, from when we
@ -233,7 +233,9 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup
// ---------- FIXME ----------------
// What to do now if the simulation ended?
// Check correctness: Now if the simulation ended we
// append the newly created environment and return false
if(simulation_ended) goto final_cleanup;
/* /
@ -329,6 +331,8 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup
// - SimulationController that everything stopped
throw;
}
final_cleanup:
// append the new snapshot...
// ...and remember to release the auto_ptr!
@ -337,6 +341,9 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup
// Reset values that the policy doesn't need anymore
_policy = NULL;
_ready_queue = NULL;
// If we got there, a step has been performed
return simulation_ended == false;
}