Replace autotools with CMake at the toplevel, backend now compiles with newer GCC
This commit is contained in:
parent
d50ec337d1
commit
616aef27a8
124 changed files with 1242 additions and 6315 deletions
|
@ -27,8 +27,6 @@
|
|||
|
||||
#include <cassert>
|
||||
|
||||
#include <sgpemv2/templates/smartp.tcc>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <functional>
|
||||
|
@ -36,10 +34,9 @@
|
|||
#include <iostream>
|
||||
|
||||
using namespace sgpem;
|
||||
using namespace memory;
|
||||
|
||||
ConcreteSimulation::ConcreteSimulation() :
|
||||
Simulation(), _state(state_stopped),
|
||||
Simulation(), _state(state_stopped),
|
||||
_mode(mode_continuous), _policy(NULL), _resource_policy(NULL)
|
||||
{
|
||||
}
|
||||
|
@ -57,13 +54,13 @@ ConcreteSimulation::get_mode() const
|
|||
}
|
||||
|
||||
void
|
||||
ConcreteSimulation::jump_to(History::position p) throw(UserInterruptException, NullPolicyException, MalformedPolicyException)
|
||||
ConcreteSimulation::jump_to(History::position p)
|
||||
{
|
||||
switch (_state)
|
||||
{
|
||||
case state_running:
|
||||
// pauses the simulation (done below)
|
||||
break;
|
||||
break;
|
||||
case state_stopped:
|
||||
_history.set_front(0);
|
||||
break;
|
||||
|
@ -71,23 +68,23 @@ ConcreteSimulation::jump_to(History::position p) throw(UserInterruptException, N
|
|||
break;
|
||||
}
|
||||
|
||||
// Disable momentarily updates for registered observers on
|
||||
// Disable momentarily updates for registered observers on
|
||||
// sgpem::Simulation and sgpem::History.
|
||||
History::LockNotify h_lock(_history);
|
||||
Simulation::LockNotify s_lock(*this);
|
||||
|
||||
pause();
|
||||
pause();
|
||||
|
||||
bool yet_to_finish = true;
|
||||
bool yet_to_finish = true;
|
||||
History::position increment = 0;
|
||||
while (yet_to_finish && p > _history.get_front() + increment)
|
||||
while (yet_to_finish && p > _history.get_front() + increment)
|
||||
{
|
||||
yet_to_finish = step();
|
||||
increment++;
|
||||
}
|
||||
get_history().set_front(std::min(p, _history.get_size()));
|
||||
if (!yet_to_finish)
|
||||
stop();
|
||||
if (!yet_to_finish)
|
||||
stop();
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,7 +109,7 @@ ConcreteSimulation::stop()
|
|||
}
|
||||
|
||||
void
|
||||
ConcreteSimulation::run() throw(UserInterruptException, NullPolicyException, MalformedPolicyException)
|
||||
ConcreteSimulation::run()
|
||||
{
|
||||
switch (_state)
|
||||
{
|
||||
|
@ -131,14 +128,14 @@ ConcreteSimulation::run() throw(UserInterruptException, NullPolicyException, Mal
|
|||
if (yet_to_finish)
|
||||
{
|
||||
|
||||
if(_mode == mode_step_by_step)
|
||||
if(_mode == mode_step_by_step)
|
||||
pause();
|
||||
else
|
||||
// We remain in running state, and we notify everybody!
|
||||
// This is non-trivial, and we must do so since we
|
||||
// put the state to running inconditionally. Don't
|
||||
// touch this if you don't provide another way to tell
|
||||
// a SimulationObserver that the simulation advanced
|
||||
// touch this if you don't provide another way to tell
|
||||
// a SimulationObserver that the simulation advanced
|
||||
// and *yet* it is in running state!
|
||||
notify_change();
|
||||
}
|
||||
|
@ -149,20 +146,19 @@ ConcreteSimulation::run() throw(UserInterruptException, NullPolicyException, Mal
|
|||
|
||||
bool
|
||||
ConcreteSimulation::step()
|
||||
throw(UserInterruptException, NullPolicyException, MalformedPolicyException)
|
||||
{
|
||||
if (get_policy() == NULL)
|
||||
if (get_policy() == nullptr)
|
||||
{
|
||||
stop();
|
||||
throw NullPolicyException("no CPU policy selected");
|
||||
}
|
||||
|
||||
if (get_resource_policy() == NULL)
|
||||
if (get_resource_policy() == nullptr)
|
||||
{
|
||||
stop();
|
||||
throw NullPolicyException("no resource policy selected");
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
// step forward
|
||||
|
@ -171,7 +167,7 @@ ConcreteSimulation::step()
|
|||
{
|
||||
if(!_history.is_sealed())
|
||||
yet_to_finish = Scheduler::get_instance().step_forward(_history, *get_policy(), *get_resource_policy());
|
||||
else
|
||||
else
|
||||
yet_to_finish = false;
|
||||
}
|
||||
|
||||
|
@ -183,8 +179,8 @@ ConcreteSimulation::step()
|
|||
// we have to make this horrible thing
|
||||
if (_history.get_front() == _history.get_size() - 2 && _history.is_sealed())
|
||||
yet_to_finish = false;
|
||||
|
||||
return yet_to_finish;
|
||||
|
||||
return yet_to_finish;
|
||||
}
|
||||
catch (const CPUPolicyException& e)
|
||||
{
|
||||
|
@ -214,7 +210,7 @@ ConcreteSimulation::get_history() const
|
|||
|
||||
|
||||
void
|
||||
ConcreteSimulation::set_policy(CPUPolicy* p) throw(CPUPolicyException)
|
||||
ConcreteSimulation::set_policy(CPUPolicy* p)
|
||||
{
|
||||
stop();
|
||||
|
||||
|
@ -227,12 +223,12 @@ ConcreteSimulation::set_policy(CPUPolicy* p) throw(CPUPolicyException)
|
|||
{
|
||||
try
|
||||
{
|
||||
// this is a no-op if _policy is NULL
|
||||
// this is a no-op if _policy is nullptr
|
||||
CPUPoliciesGatekeeper::get_instance().activate_policy(&_history, _policy);
|
||||
}
|
||||
catch(const CPUPolicyException& e2)
|
||||
{
|
||||
_policy = NULL;
|
||||
_policy = nullptr;
|
||||
|
||||
std::string msg = _("unable to change policy and to restore the previous: ");
|
||||
msg += e2.what();
|
||||
|
@ -242,7 +238,7 @@ ConcreteSimulation::set_policy(CPUPolicy* p) throw(CPUPolicyException)
|
|||
|
||||
std::string msg = _("unable to change policy: ");
|
||||
msg+= e1.what();
|
||||
|
||||
|
||||
throw CPUPolicyException(msg);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue